20 #ifndef GNASH_STRING_TABLE_H 21 #define GNASH_STRING_TABLE_H 27 #include <boost/multi_index_container.hpp> 28 #include <boost/multi_index/hashed_index.hpp> 29 #include <boost/multi_index/identity.hpp> 30 #include <boost/multi_index/member.hpp> 48 svt(std::string val, std::size_t
i)
50 value(
std::move(val)),
69 typedef boost::multi_index_container<
svt,
70 boost::multi_index::indexed_by<
72 boost::multi_index::hashed_unique<
73 boost::multi_index::tag<StringValue>,
74 boost::multi_index::member<svt, std::string, &svt::value> >,
76 boost::multi_index::hashed_unique<
77 boost::multi_index::tag<StringID>,
78 boost::multi_index::member<svt, std::size_t, &svt::id>
83 typedef std::size_t
key;
95 key find(
const std::string& to_find,
bool insert_unfound =
true);
102 const std::string&
value(key to_find)
const 104 if (_table.empty() || !to_find)
return _empty;
106 table::index<StringID>::type::iterator
r =
107 _table.get<
StringID>().find(to_find);
108 return (r == _table.get<
StringID>().end()) ? _empty : r->value;
114 key insert(
const std::string& to_insert);
122 void insert_group(
const svt* pList, std::size_t size);
128 key already_locked_insert(
const std::string& to_insert);
134 _highestKnownLowercase(0)
142 key noCase(key
a)
const;
146 void setHighestKnownLowercase(std::size_t
k);
151 static const std::string _empty;
153 std::size_t _highestKey;
155 std::map<key, key> _caseTable;
156 key _highestKnownLowercase;
Definition: GnashKey.h:147
svt(std::string val, std::size_t i)
Definition: string_table.h:48
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.
Definition: string_table.h:81
const std::string & value(key to_find) const
Find a string by its key.
Definition: string_table.h:102
Definition: GnashKey.h:157
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
A general use string table.
Definition: string_table.h:41
Definition: GnashKey.h:164
string_table()
Construct the empty string_table.
Definition: string_table.h:131
std::size_t id
Definition: string_table.h:55
bool equal(string_table &st, string_table::key a, string_table::key b, bool caseless)
Check whether two keys are equivalent.
Definition: string_table.cpp:174
A tag to identify the key index.
Definition: string_table.h:59
Definition: GnashKey.h:148
#define DSOEXPORT
Definition: dsodefs.h:55
A tag to identify the string index.
Definition: string_table.h:62
bool caseless(const as_object &o)
Return whether property matching is caseless.
Definition: as_object.h:924
Definition: GnashKey.h:155
std::string value
Definition: string_table.h:54
std::size_t key
Definition: string_table.h:83
A little helper for indexing.
Definition: string_table.h:46