Classes | Public Types | Public Member Functions

gnash::string_table Class Reference

A general use string table. More...

#include <string_table.h>

List of all members.

Classes

struct  StringID
 A tag to identify the key index. More...
struct  StringValue
 A tag to identify the string index. More...
struct  svt
 A little helper for indexing. More...

Public Types

typedef
boost::multi_index_container
< svt,
boost::multi_index::indexed_by
< boost::multi_index::hashed_unique
< boost::multi_index::tag
< StringValue >
, boost::multi_index::member
< svt, std::string,&svt::value >
>, boost::multi_index::hashed_unique
< boost::multi_index::tag
< StringID >
, boost::multi_index::member
< svt, std::size_t,&svt::id > > > > 
table
 The container for indexing the strings.
typedef std::size_t key

Public Member Functions

key find (const std::string &to_find, bool insert_unfound=true)
 Find a key for a string.
const std::string & value (key to_find)
 Find a string by its key.
key insert (const std::string &to_insert)
 Insert a string with auto-assigned id.
void insert_group (const svt *pList, std::size_t size)
 Insert a group of strings with their ids preset.
key already_locked_insert (const std::string &to_insert)
 Insert a string when you will handle the locking yourself.
 string_table ()
 Construct the empty string_table.
key noCase (key a) const
 Return a caseless equivalent of the passed key.

Detailed Description

A general use string table.


Member Typedef Documentation

typedef std::size_t gnash::string_table::key
typedef boost::multi_index_container<svt, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag<StringValue>, boost::multi_index::member<svt, std::string, &svt::value> >, boost::multi_index::hashed_unique< boost::multi_index::tag<StringID>, boost::multi_index::member<svt, std::size_t, &svt::id> > > > gnash::string_table::table

The container for indexing the strings.

This contains two indices with no duplicate values: 1. An index of unique, case-sensitive strings. 2. An index of unique numeric keys.


Constructor & Destructor Documentation

gnash::string_table::string_table (  )  [inline]

Construct the empty string_table.


Member Function Documentation

string_table::key gnash::string_table::already_locked_insert ( const std::string &  to_insert  ) 

Insert a string when you will handle the locking yourself.

Parameters:
to_insert The string to insert
Returns:
The assigned key

References find().

Referenced by find(), insert(), and insert_group().

string_table::key gnash::string_table::find ( const std::string &  to_find,
bool  insert_unfound = true 
)

Find a key for a string.

By default a key will be created for a string that isn't present.

Parameters:
to_find The string to be found.
insert_unfound If this is set to false, a search is performed, but no update.
Returns:
A key which can be used in value or 0 if the string is not yet in the table and insert_unfound was false.

References already_locked_insert(), and gnash::key::i.

Referenced by gnash::as_object::addInterface(), already_locked_insert(), gnash::as_environment::as_environment(), gnash::Function2::call(), gnash::ActionExec::delObjectMember(), gnash::MovieTester::findDisplayItemByName(), gnash::DisplayObject::getNextUnnamedInstanceName(), gnash_view_call(), gnash::as_object::init_destructive_property(), gnash::as_object::init_property(), gnash::abc::AbcBlock::locateClass(), main(), gnash::DisplayObject::pathElement(), gnash::XMLNode_as::setAttribute(), gnash::ActionExec::setLocalVariable(), and gnash::Button::trackAsMenu().

string_table::key gnash::string_table::insert ( const std::string &  to_insert  ) 

Insert a string with auto-assigned id.

Returns:
The assigned key

References already_locked_insert().

Referenced by main().

void gnash::string_table::insert_group ( const svt pList,
std::size_t  size 
)

Insert a group of strings with their ids preset.

Parameters:
pList An array of svt objects, these should be fully constructed, including their ids. If any id is duplicated, the insertion will fail.
size Number of elements in the svt objects array

References already_locked_insert(), gnash::key::i, gnash::string_table::svt::id, s, gnash::key::t, and gnash::string_table::svt::value.

string_table::key gnash::string_table::noCase ( key  a  )  const

Return a caseless equivalent of the passed key.

Parameters:
a The key to find a caseless equivalent for. The key may be its own caseless equivalent, in which case the same key will be returned.

References gnash::key::i.

Referenced by gnash::PropertyList::addDestructiveGetter(), gnash::PropertyList::addGetterSetter(), and gnash::PropertyList::setValue().

const std::string& gnash::string_table::value ( key  to_find  )  [inline]

Find a string by its key.

Parameters:
key The key of the string to return.
Returns:
The string which matches key or "" if an invalid key is given.

References _table, and gnash::key::r.

Referenced by gnash::PropertyList::addGetterSetter(), gnash::abc::Namespace::dump(), gnash::PropertyList::enumerateKeys(), gnash::abc::Trait::finalize(), gnash::DisplayObject::getTarget(), gnash::DisplayObject::getTargetPath(), and gnash::ObjectURI::Logger::operator()().


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