Gnash  0.8.10
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) const
 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.
void setHighestKnownLowercase (std::size_t k)
 Set the highest key value known to correspond to a lowercase name.

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

References ts, and 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_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 gnash::key::i, and already_locked_insert().

Referenced by gnash::abc::AbcBlock::locateClass(), gnash::abc::AbcBlock::update_global_name(), gnash::DisplayObject::pathElement(), gnash::abc::Machine::execute(), already_locked_insert(), and gnash::getURI().

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

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 gnash::key::i, gnash::key::s, gnash::string_table::svt::id, gnash::key::t, gnash::string_table::svt::value, and already_locked_insert().

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

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

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

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

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

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