You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by jr...@apache.org on 2022/11/28 13:13:25 UTC

[incubator-brpc] branch custom-rapidjson created (now 5b62c4e5)

This is an automated email from the ASF dual-hosted git repository.

jrjbear pushed a change to branch custom-rapidjson
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git


      at 5b62c4e5 - Make BUTIL_RAPIDJSON_NAMESPACE_BEGIN::GenericDocument's handler method public to enable outside custom parser/writer

This branch includes the following new commits:

     new 5b62c4e5 - Make BUTIL_RAPIDJSON_NAMESPACE_BEGIN::GenericDocument's handler method public to enable outside custom parser/writer

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[incubator-brpc] 01/01: - Make BUTIL_RAPIDJSON_NAMESPACE_BEGIN::GenericDocument's handler method public to enable outside custom parser/writer

Posted by jr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jrjbear pushed a commit to branch custom-rapidjson
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git

commit 5b62c4e508273c68d550cf86e22eee15879fe672
Author: jiangrujie <ji...@bytedance.com>
AuthorDate: Mon Nov 28 21:07:15 2022 +0800

    - Make BUTIL_RAPIDJSON_NAMESPACE_BEGIN::GenericDocument's handler method public to enable outside custom parser/writer
---
 src/butil/third_party/rapidjson/document.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/butil/third_party/rapidjson/document.h b/src/butil/third_party/rapidjson/document.h
index c78ae420..783186b9 100644
--- a/src/butil/third_party/rapidjson/document.h
+++ b/src/butil/third_party/rapidjson/document.h
@@ -1942,6 +1942,8 @@ private:
     template <typename,typename,typename> friend class GenericReader; // for parsing
     template <typename, typename> friend class GenericValue; // for deep copying
 
+// NOTE(jrj): Make the following methods public to enable outside parser/writer 
+public:
     // Implementation of Handler
     bool Null() { new (stack_.template Push<ValueType>()) ValueType(); return true; }
     bool Bool(bool b) { new (stack_.template Push<ValueType>()) ValueType(b); return true; }
@@ -1977,6 +1979,17 @@ private:
         return true;
     }
 
+    // NOTE(jrj): Extract the last element from the stack and move into `this' GenericDocument
+    void FinalizeHandler() {
+        if (StackSize() > 0) {
+            ValueType* rhs = stack_.template Pop<ValueType>(1);
+            this->RawAssign(*rhs);  // Transfer ownership
+        }
+        RAPIDJSON_ASSERT(stack_.Empty());
+    }
+
+    size_t StackSize() const { return stack_.GetSize(); }
+
 private:
     //! Prohibit copying
     GenericDocument(const GenericDocument&);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org