38 #ifndef GOOGLE_PROTOBUF_TEXT_FORMAT_H__
39 #define GOOGLE_PROTOBUF_TEXT_FORMAT_H__
75 static bool PrintToString(
const Message& message,
string* output);
78 static bool PrintUnknownFieldsToString(
const UnknownFieldSet& unknown_fields,
85 static void PrintFieldValueToString(
const Message& message,
99 virtual string PrintBool(
bool val)
const;
100 virtual string PrintInt32(
int32 val)
const;
101 virtual string PrintUInt32(
uint32 val)
const;
102 virtual string PrintInt64(
int64 val)
const;
103 virtual string PrintUInt64(
uint64 val)
const;
104 virtual string PrintFloat(
float val)
const;
105 virtual string PrintDouble(
double val)
const;
106 virtual string PrintString(
const string& val)
const;
107 virtual string PrintBytes(
const string& val)
const;
108 virtual string PrintEnum(
int32 val,
const string& name)
const;
109 virtual string PrintFieldName(
const Message& message,
112 virtual string PrintMessageStart(
const Message& message,
115 bool single_line_mode)
const;
116 virtual string PrintMessageEnd(
const Message& message,
119 bool single_line_mode)
const;
138 bool PrintToString(
const Message& message,
string* output)
const;
141 string* output)
const;
143 void PrintFieldValueToString(
const Message& message,
146 string* output)
const;
151 initial_indent_level_ = indent_level;
157 single_line_mode_ = single_line_mode;
161 return single_line_mode_;
166 use_field_number_ = use_field_number;
175 use_short_repeated_primitives_ = use_short_repeated_primitives;
182 void SetUseUtf8StringEscaping(
bool as_utf8);
196 hide_unknown_fields_ = hide;
203 bool print_message_fields_in_index_order) {
204 print_message_fields_in_index_order_ =
205 print_message_fields_in_index_order;
223 void Print(
const Message& message,
224 TextGenerator& generator)
const;
227 void PrintField(
const Message& message,
230 TextGenerator& generator)
const;
233 void PrintShortRepeatedField(
const Message& message,
236 TextGenerator& generator)
const;
240 void PrintFieldName(
const Message& message,
243 TextGenerator& generator)
const;
247 void PrintFieldValue(
const Message& message,
251 TextGenerator& generator)
const;
257 TextGenerator& generator)
const;
282 static bool ParseFromString(
const string&
input,
Message* output);
288 static bool MergeFromString(
const string&
input,
Message* output);
293 static bool ParseFieldValueFromString(
const string&
input,
308 const string& name)
const = 0;
318 : line(line_param), column(column_param) {}
350 typedef map<const FieldDescriptor*, vector<ParseLocation> >
LocationMap;
354 typedef map<const FieldDescriptor*, vector<ParseInfoTree*> >
NestedMap;
371 bool ParseFromString(
const string& input,
Message* output);
375 bool MergeFromString(
const string& input,
Message* output);
380 error_collector_ = error_collector;
393 parse_info_tree_ = tree;
399 allow_partial_ = allow;
407 allow_case_insensitive_field_ = allow;
411 bool ParseFieldValueFromString(
const string& input,
417 allow_field_number_ = allow;
429 ParserImpl* parser_impl);
473 #endif // GOOGLE_PROTOBUF_TEXT_FORMAT_H__
void SetFinder(Finder *finder)
Definition: text_format.h:386
Definition: tokenizer.h:57
NestedMap nested_
Definition: text_format.h:357
void SetHideUnknownFields(bool hide)
Definition: text_format.h:195
void RecordLocation(const FieldDescriptor *field, ParseLocation location)
Definition: text_format.h:363
bool use_field_number_
Definition: text_format.h:263
map< const FieldDescriptor *, vector< ParseLocation > > LocationMap
Definition: text_format.h:350
bool use_short_repeated_primitives_
Definition: text_format.h:265
void SetInitialIndentLevel(int indent_level)
Definition: text_format.h:150
Definition: unknown_field_set.h:74
bool allow_case_insensitive_field_
Definition: text_format.h:435
bool allow_partial_
Definition: text_format.h:434
Definition: text_format.h:95
scoped_ptr< const FieldValuePrinter > default_field_value_printer_
Definition: text_format.h:271
int column
Definition: text_format.h:314
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName)
Definition: common.h:89
bool single_line_mode_
Definition: text_format.h:261
bool print_message_fields_in_index_order_
Definition: text_format.h:269
map< const FieldDescriptor *, const FieldValuePrinter * > CustomPrinterMap
Definition: text_format.h:273
Definition: message.h:357
void AllowPartialMessage(bool allow)
Definition: text_format.h:398
Definition: text_format.h:323
ParseInfoTree * CreateNested(const FieldDescriptor *field)
Definition: message.h:165
io::ErrorCollector * error_collector_
Definition: text_format.h:431
static ParseInfoTree * CreateNested(ParseInfoTree *info_tree, const FieldDescriptor *field)
Definition: text_format.h:465
Finder * finder_
Definition: text_format.h:432
int32_t int32
Definition: common.h:172
void SetUseFieldNumber(bool use_field_number)
Definition: text_format.h:165
bool hide_unknown_fields_
Definition: text_format.h:267
void SetUseShortRepeatedPrimitives(bool use_short_repeated_primitives)
Definition: text_format.h:174
LocationMap locations_
Definition: text_format.h:356
bool allow_field_number_
Definition: text_format.h:438
bool allow_relaxed_whitespace_
Definition: text_format.h:439
static void RecordLocation(ParseInfoTree *info_tree, const FieldDescriptor *field, ParseLocation location)
Definition: text_format.h:458
bool allow_unknown_field_
Definition: text_format.h:436
uint32_t uint32
Definition: common.h:177
Definition: text_format.h:312
uint64_t uint64
Definition: common.h:178
Definition: zero_copy_stream.h:181
bool allow_unknown_enum_
Definition: text_format.h:437
void AllowCaseInsensitiveField(bool allow)
Definition: text_format.h:406
int initial_indent_level_
Definition: text_format.h:259
map< const FieldDescriptor *, vector< ParseInfoTree * > > NestedMap
Definition: text_format.h:354
Definition: text_format.h:300
void RecordErrorsTo(io::ErrorCollector *error_collector)
Definition: text_format.h:379
#define LIBPROTOBUF_EXPORT
Definition: common.h:105
int64_t int64
Definition: common.h:173
Definition: text_format.h:62
Definition: text_format.h:127
Definition: descriptor.h:342
ParseLocation(int line_param, int column_param)
Definition: text_format.h:317
void AllowFieldNumber(bool allow)
Definition: text_format.h:416
int line
Definition: text_format.h:313
bool IsInSingleLineMode()
Definition: text_format.h:160
Definition: BnetFileGenerator.h:47
void WriteLocationsTo(ParseInfoTree *tree)
Definition: text_format.h:392
void SetPrintMessageFieldsInIndexOrder(bool print_message_fields_in_index_order)
Definition: text_format.h:202
CustomPrinterMap custom_printers_
Definition: text_format.h:274
ParseLocation()
Definition: text_format.h:316
bool allow_singular_overwrites_
Definition: text_format.h:440
void SetSingleLineMode(bool single_line_mode)
Definition: text_format.h:156
ParseInfoTree * parse_info_tree_
Definition: text_format.h:433