aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/util/internal/json_objectwriter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/util/internal/json_objectwriter.h')
-rw-r--r--src/google/protobuf/util/internal/json_objectwriter.h43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/google/protobuf/util/internal/json_objectwriter.h b/src/google/protobuf/util/internal/json_objectwriter.h
index 4c25b465..c8a061d5 100644
--- a/src/google/protobuf/util/internal/json_objectwriter.h
+++ b/src/google/protobuf/util/internal/json_objectwriter.h
@@ -84,30 +84,30 @@ namespace converter {
// JsonObjectWriter is thread-unsafe.
class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
public:
- JsonObjectWriter(StringPiece indent_string,
- google::protobuf::io::CodedOutputStream* out)
+ JsonObjectWriter(StringPiece indent_string, io::CodedOutputStream* out)
: element_(new Element(/*parent=*/nullptr, /*is_json_object=*/false)),
stream_(out),
sink_(out),
- indent_string_(indent_string.ToString()),
+ indent_string_(indent_string),
use_websafe_base64_for_bytes_(false) {}
virtual ~JsonObjectWriter();
// ObjectWriter methods.
- virtual JsonObjectWriter* StartObject(StringPiece name) override;
- virtual JsonObjectWriter* EndObject() override;
- virtual JsonObjectWriter* StartList(StringPiece name) override;
- virtual JsonObjectWriter* EndList() override;
- virtual JsonObjectWriter* RenderBool(StringPiece name, bool value) override;
- virtual JsonObjectWriter* RenderInt32(StringPiece name, int32 value) override;
- virtual JsonObjectWriter* RenderUint32(StringPiece name, uint32 value) override;
- virtual JsonObjectWriter* RenderInt64(StringPiece name, int64 value) override;
- virtual JsonObjectWriter* RenderUint64(StringPiece name, uint64 value) override;
- virtual JsonObjectWriter* RenderDouble(StringPiece name, double value) override;
- virtual JsonObjectWriter* RenderFloat(StringPiece name, float value) override;
- virtual JsonObjectWriter* RenderString(StringPiece name, StringPiece value) override;
- virtual JsonObjectWriter* RenderBytes(StringPiece name, StringPiece value) override;
- virtual JsonObjectWriter* RenderNull(StringPiece name) override;
+ virtual JsonObjectWriter* StartObject(StringPiece name);
+ virtual JsonObjectWriter* EndObject();
+ virtual JsonObjectWriter* StartList(StringPiece name);
+ virtual JsonObjectWriter* EndList();
+ virtual JsonObjectWriter* RenderBool(StringPiece name, bool value);
+ virtual JsonObjectWriter* RenderInt32(StringPiece name, int32 value);
+ virtual JsonObjectWriter* RenderUint32(StringPiece name, uint32 value);
+ virtual JsonObjectWriter* RenderInt64(StringPiece name, int64 value);
+ virtual JsonObjectWriter* RenderUint64(StringPiece name, uint64 value);
+ virtual JsonObjectWriter* RenderDouble(StringPiece name, double value);
+ virtual JsonObjectWriter* RenderFloat(StringPiece name, float value);
+ virtual JsonObjectWriter* RenderString(StringPiece name,
+ StringPiece value);
+ virtual JsonObjectWriter* RenderBytes(StringPiece name, StringPiece value);
+ virtual JsonObjectWriter* RenderNull(StringPiece name);
virtual JsonObjectWriter* RenderNullAsEmpty(StringPiece name);
void set_use_websafe_base64_for_bytes(bool value) {
@@ -148,8 +148,7 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
private:
class LIBPROTOBUF_EXPORT ByteSinkWrapper : public strings::ByteSink {
public:
- explicit ByteSinkWrapper(google::protobuf::io::CodedOutputStream* stream)
- : stream_(stream) {}
+ explicit ByteSinkWrapper(io::CodedOutputStream* stream) : stream_(stream) {}
~ByteSinkWrapper() override {}
// ByteSink methods.
@@ -158,7 +157,7 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
}
private:
- google::protobuf::io::CodedOutputStream* stream_;
+ io::CodedOutputStream* stream_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ByteSinkWrapper);
};
@@ -209,7 +208,7 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
void WriteChar(const char c) { stream_->WriteRaw(&c, sizeof(c)); }
std::unique_ptr<Element> element_;
- google::protobuf::io::CodedOutputStream* stream_;
+ io::CodedOutputStream* stream_;
ByteSinkWrapper sink_;
const string indent_string_;
@@ -223,6 +222,6 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
} // namespace converter
} // namespace util
} // namespace protobuf
-
} // namespace google
+
#endif // GOOGLE_PROTOBUF_UTIL_CONVERTER_JSON_OBJECTWRITER_H__