Orcus
Public Member Functions | List of all members
orcus::string_pool Class Reference

#include <string_pool.hpp>

Public Member Functions

 string_pool (const string_pool &)=delete
 
string_pooloperator= (const string_pool &)=delete
 
std::pair< pstring, bool > intern (const char *str)
 
std::pair< pstring, bool > intern (const char *str, size_t n)
 
std::pair< pstring, bool > intern (const pstring &str)
 
void dump () const
 
void clear ()
 
size_t size () const
 
void swap (string_pool &other)
 

Detailed Description

Implements string hash map.

Member Function Documentation

std::pair<pstring, bool> orcus::string_pool::intern ( const char *  str)

Intern a string.

Parameters
strstring to intern. It must be null-terminated.
Returns
pair whose first value is the interned string, and the second value specifies whether it is a newly created instance (true) or a reuse of an existing instance (false).
std::pair<pstring, bool> orcus::string_pool::intern ( const char *  str,
size_t  n 
)

Intern a string.

Parameters
strstring to intern. It doesn't need to be null-terminated.
nlength of the string.
Returns
see above.
std::pair<pstring, bool> orcus::string_pool::intern ( const pstring str)

Intern a string.

Parameters
strstring to intern.
Returns
see above.