Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: third_party/protobuf/src/google/protobuf/map_field_lite.h

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 20 matching lines...) Expand all
31 #ifndef GOOGLE_PROTOBUF_MAP_FIELD_LITE_H__ 31 #ifndef GOOGLE_PROTOBUF_MAP_FIELD_LITE_H__
32 #define GOOGLE_PROTOBUF_MAP_FIELD_LITE_H__ 32 #define GOOGLE_PROTOBUF_MAP_FIELD_LITE_H__
33 33
34 #include <google/protobuf/map.h> 34 #include <google/protobuf/map.h>
35 #include <google/protobuf/map_entry_lite.h> 35 #include <google/protobuf/map_entry_lite.h>
36 36
37 namespace google { 37 namespace google {
38 namespace protobuf { 38 namespace protobuf {
39 namespace internal { 39 namespace internal {
40 40
41 // This class provides accesss to map field using generated api. It is used for 41 // This class provides access to map field using generated api. It is used for
42 // internal generated message implentation only. Users should never use this 42 // internal generated message implentation only. Users should never use this
43 // directly. 43 // directly.
44 template <typename Key, typename T, 44 template <typename Key, typename T,
45 WireFormatLite::FieldType key_wire_type, 45 WireFormatLite::FieldType key_wire_type,
46 WireFormatLite::FieldType value_wire_type, 46 WireFormatLite::FieldType value_wire_type,
47 int default_enum_value = 0> 47 int default_enum_value = 0>
48 class MapFieldLite { 48 class MapFieldLite {
49 // Define message type for internal repeated field. 49 // Define message type for internal repeated field.
50 typedef MapEntryLite<Key, T, key_wire_type, value_wire_type, 50 typedef MapEntryLite<Key, T, key_wire_type, value_wire_type,
51 default_enum_value> EntryType; 51 default_enum_value> EntryType;
52 52
53 public: 53 public:
54 MapFieldLite(); 54 MapFieldLite();
55 explicit MapFieldLite(Arena* arena); 55 explicit MapFieldLite(Arena* arena);
56 virtual ~MapFieldLite(); 56 virtual ~MapFieldLite();
57 57
58 // Accessors 58 // Accessors
59 virtual const Map<Key, T>& GetMap() const; 59 virtual const Map<Key, T>& GetMap() const;
60 virtual Map<Key, T>* MutableMap(); 60 virtual Map<Key, T>* MutableMap();
61 61
62 // Convenient methods for generated message implementation. 62 // Convenient methods for generated message implementation.
63 virtual int size() const; 63 virtual int size() const;
64 virtual void Clear(); 64 virtual void Clear();
65 virtual void MergeFrom(const MapFieldLite& other); 65 virtual void MergeFrom(const MapFieldLite& other);
66 virtual void Swap(MapFieldLite* other); 66 virtual void Swap(MapFieldLite* other);
67 67
68 // Set default enum value only for proto2 map field whose value is enum type. 68 // Set default enum value only for proto2 map field whose value is enum type.
69 void SetDefaultEnumValue(); 69 void SetDefaultEnumValue();
70 70
71 // Used in the implementation of parsing. Caller should take the ownership. 71 // Used in the implementation of parsing. Caller should take the ownership iff
72 // arena_ is NULL.
72 EntryType* NewEntry() const; 73 EntryType* NewEntry() const;
73 // Used in the implementation of serializing enum value type. Caller should 74 // Used in the implementation of serializing enum value type. Caller should
74 // take the ownership. 75 // take the ownership iff arena_ is NULL.
75 EntryType* NewEnumEntryWrapper(const Key& key, const T t) const; 76 EntryType* NewEnumEntryWrapper(const Key& key, const T t) const;
76 // Used in the implementation of serializing other value types. Caller should 77 // Used in the implementation of serializing other value types. Caller should
77 // take the ownership. 78 // take the ownership iff arena_ is NULL.
78 EntryType* NewEntryWrapper(const Key& key, const T& t) const; 79 EntryType* NewEntryWrapper(const Key& key, const T& t) const;
79 80
80 protected: 81 protected:
81 // Convenient methods to get internal google::protobuf::Map 82 // Convenient methods to get internal google::protobuf::Map
82 virtual const Map<Key, T>& GetInternalMap() const; 83 virtual const Map<Key, T>& GetInternalMap() const;
83 virtual Map<Key, T>* MutableInternalMap(); 84 virtual Map<Key, T>* MutableInternalMap();
84 85
85 private: 86 private:
86 typedef void DestructorSkippable_; 87 typedef void DestructorSkippable_;
87 88
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (!it->second.IsInitialized()) return false; 270 if (!it->second.IsInitialized()) return false;
270 } 271 }
271 return true; 272 return true;
272 } 273 }
273 274
274 } // namespace internal 275 } // namespace internal
275 } // namespace protobuf 276 } // namespace protobuf
276 277
277 } // namespace google 278 } // namespace google
278 #endif // GOOGLE_PROTOBUF_MAP_FIELD_LITE_H__ 279 #endif // GOOGLE_PROTOBUF_MAP_FIELD_LITE_H__
OLDNEW
« no previous file with comments | « third_party/protobuf/src/google/protobuf/map_field.h ('k') | third_party/protobuf/src/google/protobuf/map_field_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698