webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
|
Representation of a map field in a Protocol Buffer message. More...
Classes | |
class | Codec |
A codec for a specific map field. This contains all the information required to encode and decode the nested messages. More... | |
Public Member Functions | |
MapField< TKey, TValue > | Clone () |
Creates a deep clone of this object. More... | |
void | Add (TKey key, TValue value) |
Adds the specified key/value pair to the map. More... | |
bool | ContainsKey (TKey key) |
Determines whether the specified key is present in the map. More... | |
bool | Remove (TKey key) |
Removes the entry identified by the given key from the map. More... | |
bool | TryGetValue (TKey key, out TValue value) |
Gets the value associated with the specified key. More... | |
void | Add (IDictionary< TKey, TValue > entries) |
Adds the specified entries to the map. The keys and values are not automatically cloned. More... | |
IEnumerator< KeyValuePair< TKey, TValue > > | GetEnumerator () |
Returns an enumerator that iterates through the collection. More... | |
void | Clear () |
Removes all items from the map. More... | |
override bool | Equals (object other) |
Determines whether the specified System.Object, is equal to this instance. More... | |
override int | GetHashCode () |
Returns a hash code for this instance. More... | |
bool | Equals (MapField< TKey, TValue > other) |
Compares this map with another for equality. More... | |
void | AddEntriesFrom (CodedInputStream input, Codec codec) |
Adds entries to the map from the given stream. More... | |
void | WriteTo (CodedOutputStream output, Codec codec) |
Writes the contents of this map to the given coded output stream, using the specified codec to encode each entry. More... | |
int | CalculateSize (Codec codec) |
Calculates the size of this map based on the given entry codec. More... | |
override string | ToString () |
Returns a string representation of this repeated field, in the same way as it would be represented by the default JSON formatter. More... | |
Properties | |
TValue | this[TKey key] [get, set] |
Gets or sets the value associated with the specified key. More... | |
ICollection< TKey > | Keys [get] |
Gets a collection containing the keys in the map. More... | |
ICollection< TValue > | Values [get] |
Gets a collection containing the values in the map. More... | |
int | Count [get] |
Gets the number of elements contained in the map. More... | |
bool | IsReadOnly [get] |
Gets a value indicating whether the map is read-only. More... | |
Representation of a map field in a Protocol Buffer message.
TKey | Key type in the map. Must be a type supported by Protocol Buffer map keys. |
TValue | Value type in the map. Must be a type supported by Protocol Buffers. |
This implementation preserves insertion order for simplicity of testing code using maps fields. Overwriting an existing entry does not change the position of that entry within the map. Equality is not order-sensitive. For string keys, the equality comparison is provided by StringComparer.Ordinal.
Null values are not permitted in the map, either for wrapper types or regular messages. If a map is deserialized from a data stream and the value is missing from an entry, a default value is created instead. For primitive types, that is the regular default value (0, the empty string and so on); for message types, an empty instance of the message is created, as if the map entry contained a 0-length encoded value for the field.
This implementation does not generally prohibit the use of key/value types which are not supported by Protocol Buffers (e.g. using a key type of
) but nor does it guarantee that all operations will work in such cases.
|
inline |
|
inline |
|
inline |
Adds entries to the map from the given stream.
It is assumed that the stream is initially positioned after the tag specified by the codec. This method will continue reading entries from the stream until the end is reached, or a different tag is encountered.
input | Stream to read from |
codec | Codec describing how the key/value pairs are encoded |
|
inline |
Calculates the size of this map based on the given entry codec.
codec | The codec to use to encode each entry. |
|
inline |
Removes all items from the map.
|
inline |
Creates a deep clone of this object.
|
inline |
Determines whether the specified key is present in the map.
key | The key to check. |
true
if the map contains the given key; false
otherwise.
|
inline |
Determines whether the specified System.Object, is equal to this instance.
other | The System.Object to compare with this instance. |
true
if the specified System.Object is equal to this instance; otherwise, false
.
|
inline |
|
inline |
Returns an enumerator that iterates through the collection.
|
inline |
Returns a hash code for this instance.
|
inline |
Removes the entry identified by the given key from the map.
key | The key indicating the entry to remove from the map. |
true
if the map contained the given key before the entry was removed; false
otherwise.
|
inline |
Returns a string representation of this repeated field, in the same way as it would be represented by the default JSON formatter.
|
inline |
Gets the value associated with the specified key.
key | The key whose value to get. |
value | When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. |
true
if the map contains an element with the specified key; otherwise, false
.
|
inline |
|
get |
Gets the number of elements contained in the map.
|
get |
Gets a value indicating whether the map is read-only.
|
get |
Gets a collection containing the keys in the map.
|
getset |
Gets or sets the value associated with the specified key.
key | The key of the value to get or set. |
KeyNotFoundException | The property is retrieved and key does not exist in the collection. |
|
get |
Gets a collection containing the values in the map.