Gnash  0.8.11dev
Classes | Public Types | Public Member Functions | List of all members
gnash::string_table Class Reference

A general use string table. More...

#include <string_table.h>

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. More...
 
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. More...
 
const std::string & value (key to_find) const
 Find a string by its key. More...
 
key insert (const std::string &to_insert)
 Insert a string with auto-assigned id. More...
 
void insert_group (const svt *pList, std::size_t size)
 Insert a group of strings with their ids preset. More...
 
key already_locked_insert (const std::string &to_insert)
 Insert a string when you will handle the locking yourself. More...
 
 string_table ()
 Construct the empty string_table. More...
 
key noCase (key a) const
 Return a caseless equivalent of the passed key. More...
 
void setHighestKnownLowercase (std::size_t k)
 Set the highest key value known to correspond to a lowercase name. More...
 

Detailed Description

A general use string table.

Member Typedef Documentation

§ key

typedef std::size_t gnash::string_table::key

§ table

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

§ string_table()

gnash::string_table::string_table ( )
inline

Construct the empty string_table.

References gnash::key::a, and gnash::key::k.

Member Function Documentation

§ already_locked_insert()

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_insertThe string to insert
Returns
The assigned key

References find(), and ts.

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

§ find()

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_findThe string to be found.
insert_unfoundIf 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 already_locked_insert(), gnash::abc::Machine::execute(), gnash::getURI(), gnash::abc::AbcBlock::locateClass(), gnash::DisplayObject::pathElement(), gnash::abc::AbcBlock::prepare(), and gnash::abc::AbcBlock::update_global_name().

§ insert()

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().

§ insert_group()

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

Insert a group of strings with their ids preset.

Parameters
pListAn array of svt objects, these should be fully constructed, including their ids. If any id is duplicated, the insertion will fail.
sizeNumber of elements in the svt objects array

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

Referenced by gnash::NSV::loadStrings().

§ noCase()

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

Return a caseless equivalent of the passed key.

Parameters
aThe 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::a, gnash::stats::KeyLookup::check(), and gnash::key::i.

Referenced by gnash::equal(), and gnash::ObjectURI::noCase().

§ setHighestKnownLowercase()

void gnash::string_table::setHighestKnownLowercase ( std::size_t  k)

Set the highest key value known to correspond to a lowercase name.

References gnash::key::k.

Referenced by gnash::NSV::loadStrings().

§ value()

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

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