diff options
Diffstat (limited to 'src/google/protobuf/descriptor_database.cc')
-rw-r--r-- | src/google/protobuf/descriptor_database.cc | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/google/protobuf/descriptor_database.cc b/src/google/protobuf/descriptor_database.cc index 2117c020..57ae960f 100644 --- a/src/google/protobuf/descriptor_database.cc +++ b/src/google/protobuf/descriptor_database.cc @@ -97,11 +97,12 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddSymbol( // Try to look up the symbol to make sure a super-symbol doesn't already // exist. - typename map<string, Value>::iterator iter = FindLastLessOrEqual(name); + typename std::map<string, Value>::iterator iter = FindLastLessOrEqual(name); if (iter == by_symbol_.end()) { // Apparently the map is currently empty. Just insert and be done with it. - by_symbol_.insert(typename map<string, Value>::value_type(name, value)); + by_symbol_.insert( + typename std::map<string, Value>::value_type(name, value)); return true; } @@ -128,7 +129,8 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddSymbol( // Insert the new symbol using the iterator as a hint, the new entry will // appear immediately before the one the iterator is pointing at. - by_symbol_.insert(iter, typename map<string, Value>::value_type(name, value)); + by_symbol_.insert(iter, + typename std::map<string, Value>::value_type(name, value)); return true; } @@ -179,7 +181,7 @@ Value SimpleDescriptorDatabase::DescriptorIndex<Value>::FindFile( template <typename Value> Value SimpleDescriptorDatabase::DescriptorIndex<Value>::FindSymbol( const string& name) { - typename map<string, Value>::iterator iter = FindLastLessOrEqual(name); + typename std::map<string, Value>::iterator iter = FindLastLessOrEqual(name); return (iter != by_symbol_.end() && IsSubSymbol(iter->first, name)) ? iter->second : Value(); @@ -196,8 +198,8 @@ Value SimpleDescriptorDatabase::DescriptorIndex<Value>::FindExtension( template <typename Value> bool SimpleDescriptorDatabase::DescriptorIndex<Value>::FindAllExtensionNumbers( const string& containing_type, - vector<int>* output) { - typename map<pair<string, int>, Value>::const_iterator it = + std::vector<int>* output) { + typename std::map<pair<string, int>, Value>::const_iterator it = by_extension_.lower_bound(std::make_pair(containing_type, 0)); bool success = false; @@ -217,7 +219,8 @@ SimpleDescriptorDatabase::DescriptorIndex<Value>::FindLastLessOrEqual( // Find the last key in the map which sorts less than or equal to the // symbol name. Since upper_bound() returns the *first* key that sorts // *greater* than the input, we want the element immediately before that. - typename map<string, Value>::iterator iter = by_symbol_.upper_bound(name); + typename std::map<string, Value>::iterator iter = + by_symbol_.upper_bound(name); if (iter != by_symbol_.begin()) --iter; return iter; } @@ -284,7 +287,7 @@ bool SimpleDescriptorDatabase::FindFileContainingExtension( bool SimpleDescriptorDatabase::FindAllExtensionNumbers( const string& extendee_type, - vector<int>* output) { + std::vector<int>* output) { return index_.FindAllExtensionNumbers(extendee_type, output); } @@ -340,7 +343,7 @@ bool EncodedDescriptorDatabase::FindFileContainingSymbol( bool EncodedDescriptorDatabase::FindNameOfFileContainingSymbol( const string& symbol_name, string* output) { - pair<const void*, int> encoded_file = index_.FindSymbol(symbol_name); + std::pair<const void*, int> encoded_file = index_.FindSymbol(symbol_name); if (encoded_file.first == NULL) return false; // Optimization: The name should be the first field in the encoded message. @@ -352,7 +355,7 @@ bool EncodedDescriptorDatabase::FindNameOfFileContainingSymbol( FileDescriptorProto::kNameFieldNumber, internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED); - if (input.ReadTag() == kNameTag) { + if (input.ReadTagNoLastTag() == kNameTag) { // Success! return internal::WireFormatLite::ReadString(&input, output); } else { @@ -376,12 +379,12 @@ bool EncodedDescriptorDatabase::FindFileContainingExtension( bool EncodedDescriptorDatabase::FindAllExtensionNumbers( const string& extendee_type, - vector<int>* output) { + std::vector<int>* output) { return index_.FindAllExtensionNumbers(extendee_type, output); } bool EncodedDescriptorDatabase::MaybeParse( - pair<const void*, int> encoded_file, + std::pair<const void*, int> encoded_file, FileDescriptorProto* output) { if (encoded_file.first == NULL) return false; return output->ParseFromArray(encoded_file.first, encoded_file.second); @@ -431,11 +434,11 @@ bool DescriptorPoolDatabase::FindFileContainingExtension( bool DescriptorPoolDatabase::FindAllExtensionNumbers( const string& extendee_type, - vector<int>* output) { + std::vector<int>* output) { const Descriptor* extendee = pool_.FindMessageTypeByName(extendee_type); if (extendee == NULL) return false; - vector<const FieldDescriptor*> extensions; + std::vector<const FieldDescriptor*> extensions; pool_.FindAllExtensions(extendee, &extensions); for (int i = 0; i < extensions.size(); ++i) { @@ -454,7 +457,7 @@ MergedDescriptorDatabase::MergedDescriptorDatabase( sources_.push_back(source2); } MergedDescriptorDatabase::MergedDescriptorDatabase( - const vector<DescriptorDatabase*>& sources) + const std::vector<DescriptorDatabase*>& sources) : sources_(sources) {} MergedDescriptorDatabase::~MergedDescriptorDatabase() {} @@ -517,23 +520,23 @@ bool MergedDescriptorDatabase::FindFileContainingExtension( bool MergedDescriptorDatabase::FindAllExtensionNumbers( const string& extendee_type, - vector<int>* output) { - set<int> merged_results; - vector<int> results; + std::vector<int>* output) { + std::set<int> merged_results; + std::vector<int> results; bool success = false; for (int i = 0; i < sources_.size(); i++) { if (sources_[i]->FindAllExtensionNumbers(extendee_type, &results)) { - std::copy( - results.begin(), results.end(), - insert_iterator<set<int> >(merged_results, merged_results.begin())); + std::copy(results.begin(), results.end(), + std::insert_iterator<std::set<int> >(merged_results, + merged_results.begin())); success = true; } results.clear(); } std::copy(merged_results.begin(), merged_results.end(), - insert_iterator<vector<int> >(*output, output->end())); + std::insert_iterator<std::vector<int> >(*output, output->end())); return success; } |