Merge pull request #280 from protobuf-c/edmonds/fix-namespace-errors

Fix namespace errors when compiled with latest protobuf
This commit is contained in:
Robert Edmonds 2017-07-29 19:10:00 -04:00 committed by GitHub
commit d7189b6940
13 changed files with 19 additions and 19 deletions

View File

@ -74,7 +74,7 @@ namespace c {
using internal::WireFormat; using internal::WireFormat;
void SetBytesVariables(const FieldDescriptor* descriptor, void SetBytesVariables(const FieldDescriptor* descriptor,
map<string, string>* variables) { std::map<string, string>* variables) {
(*variables)["name"] = FieldName(descriptor); (*variables)["name"] = FieldName(descriptor);
(*variables)["default"] = (*variables)["default"] =
"\"" + CEscape(descriptor->default_value_string()) + "\""; "\"" + CEscape(descriptor->default_value_string()) + "\"";

View File

@ -86,7 +86,7 @@ class BytesFieldGenerator : public FieldGenerator {
void GenerateStaticInit(io::Printer* printer) const; void GenerateStaticInit(io::Printer* printer) const;
private: private:
map<string, string> variables_; std::map<string, string> variables_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BytesFieldGenerator); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BytesFieldGenerator);
}; };

View File

@ -81,7 +81,7 @@ EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor,
EnumGenerator::~EnumGenerator() {} EnumGenerator::~EnumGenerator() {}
void EnumGenerator::GenerateDefinition(io::Printer* printer) { void EnumGenerator::GenerateDefinition(io::Printer* printer) {
map<string, string> vars; std::map<string, string> vars;
vars["classname"] = FullNameToC(descriptor_->full_name()); vars["classname"] = FullNameToC(descriptor_->full_name());
vars["shortname"] = descriptor_->name(); vars["shortname"] = descriptor_->name();
vars["uc_name"] = FullNameToUpper(descriptor_->full_name()); vars["uc_name"] = FullNameToUpper(descriptor_->full_name());
@ -126,7 +126,7 @@ void EnumGenerator::GenerateDefinition(io::Printer* printer) {
} }
void EnumGenerator::GenerateDescriptorDeclarations(io::Printer* printer) { void EnumGenerator::GenerateDescriptorDeclarations(io::Printer* printer) {
map<string, string> vars; std::map<string, string> vars;
if (dllexport_decl_.empty()) { if (dllexport_decl_.empty()) {
vars["dllexport"] = ""; vars["dllexport"] = "";
} else { } else {
@ -149,7 +149,7 @@ struct ValueIndex
void EnumGenerator::GenerateValueInitializer(io::Printer *printer, int index) void EnumGenerator::GenerateValueInitializer(io::Printer *printer, int index)
{ {
const EnumValueDescriptor *vd = descriptor_->value(index); const EnumValueDescriptor *vd = descriptor_->value(index);
map<string, string> vars; std::map<string, string> vars;
bool optimize_code_size = descriptor_->file()->options().has_optimize_for() && bool optimize_code_size = descriptor_->file()->options().has_optimize_for() &&
descriptor_->file()->options().optimize_for() == descriptor_->file()->options().optimize_for() ==
FileOptions_OptimizeMode_CODE_SIZE; FileOptions_OptimizeMode_CODE_SIZE;
@ -182,7 +182,7 @@ static int compare_value_indices_by_name(const void *a, const void *b)
} }
void EnumGenerator::GenerateEnumDescriptor(io::Printer* printer) { void EnumGenerator::GenerateEnumDescriptor(io::Printer* printer) {
map<string, string> vars; std::map<string, string> vars;
vars["fullname"] = descriptor_->full_name(); vars["fullname"] = descriptor_->full_name();
vars["lcclassname"] = FullNameToLower(descriptor_->full_name()); vars["lcclassname"] = FullNameToLower(descriptor_->full_name());
vars["cname"] = FullNameToC(descriptor_->full_name()); vars["cname"] = FullNameToC(descriptor_->full_name());

View File

@ -75,7 +75,7 @@ using internal::WireFormat;
// TODO(kenton): Factor out a "SetCommonFieldVariables()" to get rid of // TODO(kenton): Factor out a "SetCommonFieldVariables()" to get rid of
// repeat code between this and the other field types. // repeat code between this and the other field types.
void SetEnumVariables(const FieldDescriptor* descriptor, void SetEnumVariables(const FieldDescriptor* descriptor,
map<string, string>* variables) { std::map<string, string>* variables) {
(*variables)["name"] = FieldName(descriptor); (*variables)["name"] = FieldName(descriptor);
(*variables)["type"] = FullNameToC(descriptor->enum_type()->full_name()); (*variables)["type"] = FullNameToC(descriptor->enum_type()->full_name());

View File

@ -84,7 +84,7 @@ class EnumFieldGenerator : public FieldGenerator {
void GenerateStaticInit(io::Printer* printer) const; void GenerateStaticInit(io::Printer* printer) const;
private: private:
map<string, string> variables_; std::map<string, string> variables_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
}; };

View File

@ -106,7 +106,7 @@ void FieldGenerator::GenerateDescriptorInitializerGeneric(io::Printer* printer,
const string &type_macro, const string &type_macro,
const string &descriptor_addr) const const string &descriptor_addr) const
{ {
map<string, string> variables; std::map<string, string> variables;
variables["TYPE"] = type_macro; variables["TYPE"] = type_macro;
variables["classname"] = FullNameToC(FieldScope(descriptor_)->full_name()); variables["classname"] = FullNameToC(FieldScope(descriptor_)->full_name());
variables["name"] = FieldName(descriptor_); variables["name"] = FieldName(descriptor_);

View File

@ -268,7 +268,7 @@ const char* const kKeywordList[] = {
}; };
std::set<string> MakeKeywordsMap() { std::set<string> MakeKeywordsMap() {
set<string> result; std::set<string> result;
for (int i = 0; i < GOOGLE_ARRAYSIZE(kKeywordList); i++) { for (int i = 0; i < GOOGLE_ARRAYSIZE(kKeywordList); i++) {
result.insert(kKeywordList[i]); result.insert(kKeywordList[i]);
} }
@ -365,7 +365,7 @@ string GetLabelName(FieldDescriptor::Label label) {
unsigned unsigned
WriteIntRanges(io::Printer* printer, int n_values, const int *values, const string &name) WriteIntRanges(io::Printer* printer, int n_values, const int *values, const string &name)
{ {
map<string, string> vars; std::map<string, string> vars;
vars["name"] = name; vars["name"] = name;
if (n_values > 0) { if (n_values > 0) {
int n_ranges = 1; int n_ranges = 1;
@ -504,7 +504,7 @@ void SplitStringToIteratorUsing(const string& full,
void SplitStringUsing(const string& full, void SplitStringUsing(const string& full,
const char* delim, const char* delim,
vector<string>* result) { vector<string>* result) {
back_insert_iterator< vector<string> > it(*result); std::back_insert_iterator< vector<string> > it(*result);
SplitStringToIteratorUsing(full, delim, it); SplitStringToIteratorUsing(full, delim, it);
} }

View File

@ -388,7 +388,7 @@ GenerateHelperFunctionDefinitions(io::Printer* printer, bool is_submessage)
void MessageGenerator:: void MessageGenerator::
GenerateMessageDescriptor(io::Printer* printer) { GenerateMessageDescriptor(io::Printer* printer) {
map<string, string> vars; std::map<string, string> vars;
vars["fullname"] = descriptor_->full_name(); vars["fullname"] = descriptor_->full_name();
vars["classname"] = FullNameToC(descriptor_->full_name()); vars["classname"] = FullNameToC(descriptor_->full_name());
vars["lcclassname"] = FullNameToLower(descriptor_->full_name()); vars["lcclassname"] = FullNameToLower(descriptor_->full_name());

View File

@ -83,7 +83,7 @@ MessageFieldGenerator::~MessageFieldGenerator() {}
void MessageFieldGenerator::GenerateStructMembers(io::Printer* printer) const void MessageFieldGenerator::GenerateStructMembers(io::Printer* printer) const
{ {
map<string, string> vars; std::map<string, string> vars;
vars["name"] = FieldName(descriptor_); vars["name"] = FieldName(descriptor_);
vars["type"] = FullNameToC(descriptor_->message_type()->full_name()); vars["type"] = FullNameToC(descriptor_->message_type()->full_name());
vars["deprecated"] = FieldDeprecated(descriptor_); vars["deprecated"] = FieldDeprecated(descriptor_);

View File

@ -80,7 +80,7 @@ PrimitiveFieldGenerator::~PrimitiveFieldGenerator() {}
void PrimitiveFieldGenerator::GenerateStructMembers(io::Printer* printer) const void PrimitiveFieldGenerator::GenerateStructMembers(io::Printer* printer) const
{ {
string c_type; string c_type;
map<string, string> vars; std::map<string, string> vars;
switch (descriptor_->type()) { switch (descriptor_->type()) {
case FieldDescriptor::TYPE_SINT32 : case FieldDescriptor::TYPE_SINT32 :
case FieldDescriptor::TYPE_SFIXED32: case FieldDescriptor::TYPE_SFIXED32:
@ -149,7 +149,7 @@ string PrimitiveFieldGenerator::GetDefaultValue() const
} }
void PrimitiveFieldGenerator::GenerateStaticInit(io::Printer* printer) const void PrimitiveFieldGenerator::GenerateStaticInit(io::Printer* printer) const
{ {
map<string, string> vars; std::map<string, string> vars;
if (descriptor_->has_default_value()) { if (descriptor_->has_default_value()) {
vars["default_value"] = GetDefaultValue(); vars["default_value"] = GetDefaultValue();
} else { } else {

View File

@ -99,7 +99,7 @@ class ServiceGenerator {
void GenerateCallersImplementations(io::Printer* printer); void GenerateCallersImplementations(io::Printer* printer);
const ServiceDescriptor* descriptor_; const ServiceDescriptor* descriptor_;
map<string, string> vars_; std::map<string, string> vars_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator);
}; };

View File

@ -74,7 +74,7 @@ namespace c {
using internal::WireFormat; using internal::WireFormat;
void SetStringVariables(const FieldDescriptor* descriptor, void SetStringVariables(const FieldDescriptor* descriptor,
map<string, string>* variables) { std::map<string, string>* variables) {
(*variables)["name"] = FieldName(descriptor); (*variables)["name"] = FieldName(descriptor);
(*variables)["default"] = FullNameToLower(descriptor->full_name()) (*variables)["default"] = FullNameToLower(descriptor->full_name())
+ "__default_value"; + "__default_value";

View File

@ -86,7 +86,7 @@ class StringFieldGenerator : public FieldGenerator {
void GenerateStaticInit(io::Printer* printer) const; void GenerateStaticInit(io::Printer* printer) const;
private: private:
map<string, string> variables_; std::map<string, string> variables_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator);
}; };