Gnash
0.8.10
|
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. | |
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. |
A general use string table.
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.
gnash::string_table::string_table | ( | ) | [inline] |
Construct the empty string_table.
string_table::key gnash::string_table::already_locked_insert | ( | const std::string & | to_insert | ) |
Insert a string when you will handle the locking yourself.
to_insert | The string to insert |
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.
to_find | The string to be found. |
insert_unfound | If this is set to false, a search is performed, but no update. |
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 | ) |
void gnash::string_table::insert_group | ( | const svt * | pList, |
std::size_t | size | ||
) |
Insert a group of strings with their ids preset.
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 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.
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 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] |
Find a string by its key.
key | The key of the string to return. |
References _table, and gnash::key::r.
Referenced by gnash::abc::Trait::finalize(), gnash::abc::Trait::read(), gnash::as_object::get_member(), gnash::as_object::set_member(), gnash::as_object::watch(), gnash::as_object::unwatch(), gnash::abc::Machine::execute(), gnash::abc::Namespace::dump(), gnash::ObjectURI::toString(), gnash::ObjectURI::Logger::operator()(), gnash::ObjectURI::Logger::debug(), gnash::PropertyList::addGetterSetter(), and gnash::stats::KeyLookup::dump().