aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/parser.h')
-rw-r--r--src/google/protobuf/compiler/parser.h51
1 files changed, 28 insertions, 23 deletions
diff --git a/src/google/protobuf/compiler/parser.h b/src/google/protobuf/compiler/parser.h
index 5d98e5e1..9ae6c6da 100644
--- a/src/google/protobuf/compiler/parser.h
+++ b/src/google/protobuf/compiler/parser.h
@@ -45,10 +45,13 @@
#include <google/protobuf/descriptor.h>
#include <google/protobuf/repeated_field.h>
-namespace google {
-namespace protobuf { class Message; }
+#include <google/protobuf/port_def.inc>
+namespace google {
namespace protobuf {
+
+class Message;
+
namespace compiler {
// Defined in this file.
@@ -62,7 +65,7 @@ class SourceLocationTable;
// to a FileDescriptorProto. It does not resolve import directives or perform
// many other kinds of validation needed to construct a complete
// FileDescriptor.
-class LIBPROTOBUF_EXPORT Parser {
+class PROTOBUF_EXPORT Parser {
public:
Parser();
~Parser();
@@ -92,7 +95,7 @@ class LIBPROTOBUF_EXPORT Parser {
// Returns the identifier used in the "syntax = " declaration, if one was
// seen during the last call to Parse(), or the empty string otherwise.
- const string& GetSyntaxIdentifier() { return syntax_identifier_; }
+ const std::string& GetSyntaxIdentifier() { return syntax_identifier_; }
// If set true, input files will be required to begin with a syntax
// identifier. Otherwise, files may omit this. If a syntax identifier
@@ -162,7 +165,7 @@ class LIBPROTOBUF_EXPORT Parser {
// where "text" is the expected token text.
bool Consume(const char* text);
// Consume a token of type IDENTIFIER and store its text in "output".
- bool ConsumeIdentifier(string* output, const char* error);
+ bool ConsumeIdentifier(std::string* output, const char* error);
// Consume an integer and store its value in "output".
bool ConsumeInteger(int* output, const char* error);
// Consume a signed integer and store its value in "output".
@@ -174,7 +177,7 @@ class LIBPROTOBUF_EXPORT Parser {
// tokens of either INTEGER or FLOAT type.
bool ConsumeNumber(double* output, const char* error);
// Consume a string literal and store its (unescaped) value in "output".
- bool ConsumeString(string* output, const char* error);
+ bool ConsumeString(std::string* output, const char* error);
// Consume a token representing the end of the statement. Comments between
// this token and the next will be harvested for documentation. The given
@@ -197,18 +200,18 @@ class LIBPROTOBUF_EXPORT Parser {
// Error logging helpers
// Invokes error_collector_->AddError(), if error_collector_ is not NULL.
- void AddError(int line, int column, const string& error);
+ void AddError(int line, int column, const std::string& error);
// Invokes error_collector_->AddError() with the line and column number
// of the current token.
- void AddError(const string& error);
+ void AddError(const std::string& error);
// Records a location in the SourceCodeInfo.location table (see
// descriptor.proto). We use RAII to ensure that the start and end locations
// are recorded -- the constructor records the start location and the
// destructor records the end location. Since the parser is
// recursive-descent, this works out beautifully.
- class LIBPROTOBUF_EXPORT LocationRecorder {
+ class PROTOBUF_EXPORT LocationRecorder {
public:
// Construct the file's "root" location.
LocationRecorder(Parser* parser);
@@ -226,7 +229,7 @@ class LIBPROTOBUF_EXPORT Parser {
// Creates a recorder that generates locations into given source code info.
LocationRecorder(const LocationRecorder& parent, int path1,
- SourceCodeInfo* source_code_info);
+ SourceCodeInfo* source_code_info);
~LocationRecorder();
@@ -263,8 +266,8 @@ class LIBPROTOBUF_EXPORT Parser {
//
// TODO(kenton): See comment on TryConsumeEndOfDeclaration(), above, for
// why this is const.
- void AttachComments(string* leading, string* trailing,
- std::vector<string>* detached_comments) const;
+ void AttachComments(std::string* leading, std::string* trailing,
+ std::vector<std::string>* detached_comments) const;
private:
// Indexes of parent and current location in the parent
@@ -312,7 +315,7 @@ class LIBPROTOBUF_EXPORT Parser {
bool ParsePackage(FileDescriptorProto* file,
const LocationRecorder& root_location,
const FileDescriptorProto* containing_file);
- bool ParseImport(RepeatedPtrField<string>* dependency,
+ bool ParseImport(RepeatedPtrField<std::string>* dependency,
RepeatedField<int32>* public_dependency,
RepeatedField<int32>* weak_dependency,
const LocationRecorder& root_location,
@@ -436,10 +439,10 @@ class LIBPROTOBUF_EXPORT Parser {
// Parse a type name and fill in "type" (if it is a primitive) or
// "type_name" (if it is not) with the type parsed.
bool ParseType(FieldDescriptorProto::Type* type,
- string* type_name);
+ std::string* type_name);
// Parse a user-defined type and fill in "type_name" with the name.
// If a primitive type is named, it is treated as an error.
- bool ParseUserDefinedType(string* type_name);
+ bool ParseUserDefinedType(std::string* type_name);
// Parses field options, i.e. the stuff in square brackets at the end
// of a field definition. Also parses default value.
@@ -488,7 +491,7 @@ class LIBPROTOBUF_EXPORT Parser {
// REQUIRES: LookingAt("{")
// When finished successfully, we are looking at the first token past
// the ending brace.
- bool ParseUninterpretedBlock(string* value);
+ bool ParseUninterpretedBlock(std::string* value);
struct MapField {
// Whether the field is a map field.
@@ -497,8 +500,8 @@ class LIBPROTOBUF_EXPORT Parser {
FieldDescriptorProto::Type key_type;
FieldDescriptorProto::Type value_type;
// Or the type names string if the types are customized types.
- string key_type_name;
- string value_type_name;
+ std::string key_type_name;
+ std::string value_type_name;
MapField() : is_map_field(false) {}
};
@@ -523,18 +526,18 @@ class LIBPROTOBUF_EXPORT Parser {
bool had_errors_;
bool require_syntax_identifier_;
bool stop_after_syntax_identifier_;
- string syntax_identifier_;
+ std::string syntax_identifier_;
// Leading doc comments for the next declaration. These are not complete
// yet; use ConsumeEndOfDeclaration() to get the complete comments.
- string upcoming_doc_comments_;
+ std::string upcoming_doc_comments_;
// Detached comments are not connected to any syntax entities. Elements in
// this vector are paragraphs of comments separated by empty lines. The
// detached comments will be put into the leading_detached_comments field for
// the next element (See SourceCodeInfo.Location in descriptor.proto), when
// ConsumeEndOfDeclaration() is called.
- std::vector<string> upcoming_detached_comments_;
+ std::vector<std::string> upcoming_detached_comments_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Parser);
};
@@ -547,7 +550,7 @@ class LIBPROTOBUF_EXPORT Parser {
// far more complete information about source locations. However, as of this
// writing you still need to use SourceLocationTable when integrating with
// DescriptorPool.
-class LIBPROTOBUF_EXPORT SourceLocationTable {
+class PROTOBUF_EXPORT SourceLocationTable {
public:
SourceLocationTable();
~SourceLocationTable();
@@ -578,6 +581,8 @@ class LIBPROTOBUF_EXPORT SourceLocationTable {
} // namespace compiler
} // namespace protobuf
-
} // namespace google
+
+#include <google/protobuf/port_undef.inc>
+
#endif // GOOGLE_PROTOBUF_COMPILER_PARSER_H__