diff options
Diffstat (limited to 'src/google/protobuf/util/internal/type_info.cc')
-rw-r--r-- | src/google/protobuf/util/internal/type_info.cc | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/google/protobuf/util/internal/type_info.cc b/src/google/protobuf/util/internal/type_info.cc index 3847b179..60cc3fc0 100644 --- a/src/google/protobuf/util/internal/type_info.cc +++ b/src/google/protobuf/util/internal/type_info.cc @@ -58,8 +58,8 @@ class TypeInfoForTypeResolver : public TypeInfo { DeleteCachedTypes(&cached_enums_); } - virtual util::StatusOr<const google::protobuf::Type*> ResolveTypeUrl( - StringPiece type_url) const { + util::StatusOr<const google::protobuf::Type*> ResolveTypeUrl( + StringPiece type_url) const override { std::map<StringPiece, StatusOrType>::iterator it = cached_types_.find(type_url); if (it != cached_types_.end()) { @@ -68,7 +68,7 @@ class TypeInfoForTypeResolver : public TypeInfo { // Stores the string value so it can be referenced using StringPiece in the // cached_types_ map. const string& string_type_url = - *string_storage_.insert(type_url.ToString()).first; + *string_storage_.insert(string(type_url)).first; std::unique_ptr<google::protobuf::Type> type(new google::protobuf::Type()); util::Status status = type_resolver_->ResolveMessageType(string_type_url, type.get()); @@ -78,14 +78,14 @@ class TypeInfoForTypeResolver : public TypeInfo { return result; } - virtual const google::protobuf::Type* GetTypeByTypeUrl( - StringPiece type_url) const { + const google::protobuf::Type* GetTypeByTypeUrl( + StringPiece type_url) const override { StatusOrType result = ResolveTypeUrl(type_url); return result.ok() ? result.ValueOrDie() : NULL; } - virtual const google::protobuf::Enum* GetEnumByTypeUrl( - StringPiece type_url) const { + const google::protobuf::Enum* GetEnumByTypeUrl( + StringPiece type_url) const override { std::map<StringPiece, StatusOrEnum>::iterator it = cached_enums_.find(type_url); if (it != cached_enums_.end()) { @@ -94,7 +94,7 @@ class TypeInfoForTypeResolver : public TypeInfo { // Stores the string value so it can be referenced using StringPiece in the // cached_enums_ map. const string& string_type_url = - *string_storage_.insert(type_url.ToString()).first; + *string_storage_.insert(string(type_url)).first; std::unique_ptr<google::protobuf::Enum> enum_type( new google::protobuf::Enum()); util::Status status = @@ -105,16 +105,17 @@ class TypeInfoForTypeResolver : public TypeInfo { return result.ok() ? result.ValueOrDie() : NULL; } - virtual const google::protobuf::Field* FindField( - const google::protobuf::Type* type, StringPiece camel_case_name) const { + const google::protobuf::Field* FindField( + const google::protobuf::Type* type, + StringPiece camel_case_name) const override { std::map<const google::protobuf::Type*, CamelCaseNameTable>::const_iterator it = indexed_types_.find(type); const CamelCaseNameTable& camel_case_name_table = (it == indexed_types_.end()) ? PopulateNameLookupTable(type, &indexed_types_[type]) : it->second; - StringPiece name = - FindWithDefault(camel_case_name_table, camel_case_name, StringPiece()); + StringPiece name = FindWithDefault( + camel_case_name_table, camel_case_name, StringPiece()); if (name.empty()) { // Didn't find a mapping. Use whatever provided. name = camel_case_name; @@ -129,7 +130,8 @@ class TypeInfoForTypeResolver : public TypeInfo { template <typename T> static void DeleteCachedTypes(std::map<StringPiece, T>* cached_types) { - for (typename std::map<StringPiece, T>::iterator it = cached_types->begin(); + for (typename std::map<StringPiece, T>::iterator it = + cached_types->begin(); it != cached_types->end(); ++it) { if (it->second.ok()) { delete it->second.ValueOrDie(); @@ -144,8 +146,8 @@ class TypeInfoForTypeResolver : public TypeInfo { const google::protobuf::Field& field = type->fields(i); StringPiece name = field.name(); StringPiece camel_case_name = field.json_name(); - const StringPiece* existing = - InsertOrReturnExisting(camel_case_name_table, camel_case_name, name); + const StringPiece* existing = InsertOrReturnExisting( + camel_case_name_table, camel_case_name, name); if (existing && *existing != name) { GOOGLE_LOG(WARNING) << "Field '" << name << "' and '" << *existing << "' map to the same camel case name '" << camel_case_name |