The Flyweight string set stores duplicate strings efficiently. More...
#include <FlyweightString.h>
Public Member Functions | |
FlyweightString () | |
~FlyweightString () | |
The destructor deletes all internal pointers and clears the set; pointers retrieved with. More... | |
const char * | get (const char *str) |
Returns a copy of the string; this string is valid till the FlyweightString set is destructed. More... | |
const char * | get (const std::string &str) |
Returns a copy of the string; this string is valid till the FlyweightString set is destructed. More... | |
const char * | get (const char *str, size_t len) |
Returns a copy of the string; this string is valid till the FlyweightString set is destructed. More... | |
void | clear () |
Clears and deallocates the set of strings. More... | |
Private Types | |
typedef PageArenaAllocator < const char * > | CstrSetAlloc |
typedef std::set< const char *, LtCstr, CstrSetAlloc > | CstrSet |
Private Attributes | |
CharArena | m_arena |
The page arena. More... | |
CstrSet | m_strings |
The std::set holding the strings. More... | |
The Flyweight string set stores duplicate strings efficiently.
Definition at line 43 of file FlyweightString.h.
|
private |
Definition at line 113 of file FlyweightString.h.
|
private |
Definition at line 112 of file FlyweightString.h.
|
inline |
Definition at line 46 of file FlyweightString.h.
|
inline |
The destructor deletes all internal pointers and clears the set; pointers retrieved with.
Definition at line 53 of file FlyweightString.h.
|
inline |
Clears and deallocates the set of strings.
This function walks through m_strings, deallocating each string it finds, and then clears m_strings.
Definition at line 105 of file FlyweightString.h.
|
inline |
Returns a copy of the string; this string is valid till the FlyweightString set is destructed.
Duplicate strings are not inserted twice.
str | The string to insert |
Definition at line 62 of file FlyweightString.h.
|
inline |
Returns a copy of the string; this string is valid till the FlyweightString set is destructed.
Duplicate strings are not inserted twice.
str | The string to insert |
Definition at line 78 of file FlyweightString.h.
|
inline |
Returns a copy of the string; this string is valid till the FlyweightString set is destructed.
Duplicate strings are not inserted twice.
str | The string to insert |
len | The length of the string |
Definition at line 93 of file FlyweightString.h.
|
private |
The page arena.
Definition at line 116 of file FlyweightString.h.
|
private |
The std::set holding the strings.
Definition at line 119 of file FlyweightString.h.