Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends

UT_GenericStringMap< T > Class Template Reference

#include <ut_hash.h>

List of all members.

Classes

class  UT_Cursor

Public Member Functions

 UT_GenericStringMap (size_t expected_cardinality=11)
virtual ~UT_GenericStringMap ()
bool insert (const char *key, T value)
bool insert (const UT_String &key, T value)
void set (const char *key, T val)
void set (const UT_String &key, T val)
pick (const char *key) const
pick (const UT_String &key) const
bool contains (const char *key, T val) const
bool contains (const UT_String &key, T val) const
void remove (const char *key, T)
void remove (const UT_String &key, T)
void clear ()
const gchar ** list ()
UT_GenericVector< T > * enumerate (bool strip_null_values=true) const
UT_GenericVector< const
UT_String * > * 
keys (bool strip_null_values=true) const
size_t size () const
void purgeData (void)
void freeData (void)

Private Types

enum  SM_search_type { SM_INSERT, SM_LOOKUP, SM_REORG }

Private Member Functions

 UT_GenericStringMap (const UT_GenericStringMap< T > &)
void operator= (const UT_GenericStringMap< T > &)
void reorg (size_t slots_to_allocate)
void grow ()
void assign_slots (hash_slot< T > *p, size_t old_num_slots)
bool too_full () const
bool too_many_deleted () const
bool exceeds_n_delete_threshold () const
hash_slot< T > * find_slot (const UT_String &k, SM_search_type search_type, size_t &slot, bool &key_found, size_t &hashval, const void *v, bool *v_found, void *vi, size_t hashval_in) const
hash_slot< T > * find_slot (const char *k, SM_search_type search_type, size_t &slot, bool &key_found, size_t &hashval, const void *v, bool *v_found, void *vi, size_t hashval_in) const
const T _first (UT_Cursor &c) const
const T _next (UT_Cursor &c) const
const T _prev (UT_Cursor &c) const
const UT_String_key (UT_Cursor &c) const
void _make_deleted (UT_Cursor &c) const

Static Private Member Functions

static size_t compute_reorg_threshold (size_t nslots)

Private Attributes

hash_slot< T > * m_pMapping
size_t n_keys
size_t n_deleted
size_t m_nSlots
size_t reorg_threshold
size_t flags
gchar ** m_list

Friends

class UT_Cursor

template<class T>
class UT_GenericStringMap< T >


Member Enumeration Documentation

template<class T>
enum UT_GenericStringMap::SM_search_type [private]
Enumerator:
SM_INSERT 
SM_LOOKUP 
SM_REORG 

Constructor & Destructor Documentation

template<class T >
UT_GenericStringMap< T >::UT_GenericStringMap ( size_t  expected_cardinality = 11  ) 

This class represents a mapping between key/value pairs where the keys are represented by UT_String (a wrapper around char*) and the values may be of any pointer type (void*)

References UT_GenericStringMap< T >::m_nSlots, and UT_GenericStringMap< T >::m_pMapping.

template<class T >
UT_GenericStringMap< T >::~UT_GenericStringMap (  )  [virtual]
template<class T>
UT_GenericStringMap< T >::UT_GenericStringMap ( const UT_GenericStringMap< T > &   )  [private]

Member Function Documentation

template<class T >
const T UT_GenericStringMap< T >::_first ( UT_Cursor c  )  const [private]
template<class T >
const UT_String & UT_GenericStringMap< T >::_key ( UT_Cursor c  )  const [private]
template<class T >
void UT_GenericStringMap< T >::_make_deleted ( UT_Cursor c  )  const [private]
template<class T >
const T UT_GenericStringMap< T >::_next ( UT_Cursor c  )  const [private]
template<class T >
const T UT_GenericStringMap< T >::_prev ( UT_Cursor c  )  const [private]
template<class T>
void UT_GenericStringMap< T >::assign_slots ( hash_slot< T > *  p,
size_t  old_num_slots 
) [private]
template<class T >
void UT_GenericStringMap< T >::clear ( void   ) 
template<class T >
size_t UT_GenericStringMap< T >::compute_reorg_threshold ( size_t  nslots  )  [static, private]
template<class T>
bool UT_GenericStringMap< T >::contains ( const UT_String key,
val 
) const
template<class T>
bool UT_GenericStringMap< T >::contains ( const char *  k,
v 
) const

See if the map contains the (key, value) pair represented by (, ) If is null, just see if the key exists

Returns:
truth

Referenced by ODe_FontFaceDecls::addFont(), PD_Document::areDocumentFormatsEqual(), PD_Document::areDocumentStylesheetsEqual(), XAP_Dictionary::isWord(), PD_Document::purgeRevisionTable(), and SpellManager::requestDictionary().

template<class T >
UT_GenericVector< T > * UT_GenericStringMap< T >::enumerate ( bool  strip_null_values = true  )  const
template<class T>
bool UT_GenericStringMap< T >::exceeds_n_delete_threshold (  )  const [inline, private]
template<class T >
hash_slot< T > * UT_GenericStringMap< T >::find_slot ( const char *  k,
SM_search_type  search_type,
size_t &  slot,
bool &  key_found,
size_t &  hashval,
const void *  v,
bool *  v_found,
void *  vi,
size_t  hashval_in 
) const [private]
template<class T >
hash_slot< T > * UT_GenericStringMap< T >::find_slot ( const UT_String k,
SM_search_type  search_type,
size_t &  slot,
bool &  key_found,
size_t &  hashval,
const void *  v,
bool *  v_found,
void *  vi,
size_t  hashval_in 
) const [private]
template<class T>
void UT_GenericStringMap< T >::freeData ( void   )  [inline]
template<class T >
void UT_GenericStringMap< T >::grow (  )  [private]
template<class T>
bool UT_GenericStringMap< T >::insert ( const UT_String key,
value 
)
template<class T>
bool UT_GenericStringMap< T >::insert ( const char *  key,
value 
)
template<class T >
UT_GenericVector< const UT_String * > * UT_GenericStringMap< T >::keys ( bool  strip_null_values = true  )  const
template<class T >
const gchar ** UT_GenericStringMap< T >::list (  ) 
template<class T>
void UT_GenericStringMap< T >::operator= ( const UT_GenericStringMap< T > &   )  [private]
template<class T >
T UT_GenericStringMap< T >::pick ( const char *  k  )  const
template<class T >
T UT_GenericStringMap< T >::pick ( const UT_String key  )  const
template<class T>
void UT_GenericStringMap< T >::purgeData ( void   )  [inline]
template<class T>
void UT_GenericStringMap< T >::remove ( const char *  key,
 
)

Remove the item referenced by in the map

template<class T>
void UT_GenericStringMap< T >::remove ( const UT_String key,
 
)
template<class T >
void UT_GenericStringMap< T >::reorg ( size_t  slots_to_allocate  )  [private]
template<class T>
void UT_GenericStringMap< T >::set ( const UT_String key,
val 
)
template<class T>
void UT_GenericStringMap< T >::set ( const char *  key,
value 
)

Set the item determined by to the value If item() does not exist, insert it into the map

Referenced by XAP_PrefsScheme::setValue().

template<class T>
size_t UT_GenericStringMap< T >::size (  )  const [inline]
template<class T>
bool UT_GenericStringMap< T >::too_full (  )  const [inline, private]
template<class T>
bool UT_GenericStringMap< T >::too_many_deleted (  )  const [inline, private]

Friends And Related Function Documentation

template<class T>
friend class UT_Cursor [friend]

Member Data Documentation

template<class T>
size_t UT_GenericStringMap< T >::flags [private]
template<class T>
gchar** UT_GenericStringMap< T >::m_list [private]
template<class T>
size_t UT_GenericStringMap< T >::m_nSlots [private]
template<class T>
hash_slot<T>* UT_GenericStringMap< T >::m_pMapping [private]
template<class T>
size_t UT_GenericStringMap< T >::n_deleted [private]
template<class T>
size_t UT_GenericStringMap< T >::n_keys [private]
template<class T>
size_t UT_GenericStringMap< T >::reorg_threshold [private]

The documentation for this class was generated from the following file: