Page Speed Optimization Libraries  1.5.27.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
net_instaweb::StringMultiMap< StringCompare > Class Template Reference

#include "string_multi_map.h"

List of all members.

Public Member Functions

bool empty ()
void Clear ()
int num_names () const
 Returns the number of distinct names.
int num_values () const
bool Lookup (const StringPiece &name, ConstStringStarVector *values) const
const GoogleString * Lookup1 (const StringPiece &name) const
bool Has (const StringPiece &name) const
bool RemoveAll (const StringPiece &var_name)
 Remove all variables by name. Returns true if anything was removed.
const char * name (int index) const
const GoogleString * value (int index) const
 Note that the value can be NULL.
void Add (const StringPiece &var_name, const StringPiece &value)
 Add a new variable. The value can be null.
void AddFromNameValuePairs (const StringPiece &name_value_list, const StringPiece &separators, char value_separator, bool omit_if_no_value)
void CopyFrom (const StringMultiMap &string_multi_map)

Detailed Description

template<class StringCompare>
class net_instaweb::StringMultiMap< StringCompare >

Implements an ordered string map, providing case-sensitive and case insensitive versions. The order of insertion is retained and names/value pairs can be accessed by index or looked up by name.


Member Function Documentation

template<class StringCompare>
void net_instaweb::StringMultiMap< StringCompare >::AddFromNameValuePairs ( const StringPiece &  name_value_list,
const StringPiece &  separators,
char  value_separator,
bool  omit_if_no_value 
) [inline]

Parse and add from a string of name-value pairs. For example, "name1=value1,name2=value2,name3=" where separators is "," and value_separator is '='. If omit_if_no_value is true, a name-value pair with an empty value will not be added.

template<class StringCompare>
bool net_instaweb::StringMultiMap< StringCompare >::Lookup ( const StringPiece &  name,
ConstStringStarVector *  values 
) const [inline]

Find the value(s) associated with a variable. Note that you may specify a variable multiple times by calling Add multiple times with the same variable, and each of these values will be returned in the vector.

template<class StringCompare>
const GoogleString* net_instaweb::StringMultiMap< StringCompare >::Lookup1 ( const StringPiece &  name) const [inline]

Looks up a single value. Returns NULL if the name is not found or more than one value is found.

template<class StringCompare>
int net_instaweb::StringMultiMap< StringCompare >::num_values ( ) const [inline]

Returns the number of distinct values, which can be larger than num_names if Add is called twice with the same name.

template<class StringCompare>
bool net_instaweb::StringMultiMap< StringCompare >::RemoveAll ( const StringPiece &  var_name) [inline]

Remove all variables by name. Returns true if anything was removed.

< Temp variable for new vector.

Note: we have to erase from the map second, because map owns the name.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines