#include <string.hpp>
Definition at line 60 of file string.hpp.
Various Useful Utilities | |
string | copy () |
Makes a deep copy of the string that is not shared. | |
string & | make_lower () |
string & | make_upper () |
data::list< string > | split (const string &separator) const |
data::list< string > | split (const wchar_t *separator) const |
bool | to_bool () const |
double | to_double () const |
int | to_int () const |
string & | trim () |
static string | format (const string &format,...) |
static string | format (const wchar_t *format,...) |
Public Member Functions | |
virtual bool | contains_index (const I &) const =0 |
virtual bool | is_empty () const |
Returns true if the collection is empty. | |
virtual T & | item (const I &index)=0 |
virtual const T & | item (const I &index) const =0 |
string & | operator= (const string &) |
string & | operator= (wchar_t *) |
string & | operator= (const wchar_t *) |
T & | operator[] (const I &index) |
const T & | operator[] (const I &index) const |
string (const char *) | |
string (wchar_t *) | |
Makes a copy of the given wide-character string. | |
string (const wchar_t *) | |
Does NOT make a copy of the given wide-character string, only keeps a reference to it. | |
string (const string &) | |
string () | |
virtual | ~string () |
Other Useful Functions | |
virtual void | append (const T &)=0 |
Add an item to the end of the collection. | |
virtual void | append (const iterable< T, IBase > &) |
Append all members of a collection to this one. | |
virtual iterator | find_value (const T &) |
virtual const_iterator | find_value (const T &) const |
A generic find function that iterates over the collection to find a particular value. | |
virtual void | insert (const iterator &, const T &)=0 |
Insert an item before the one specified by the iterator. | |
Iterable Implementation Etc. | |
void | append (const string &) |
void | append (const wchar_t *) |
virtual void | append (const wchar_t &) |
virtual void | insert (const iterator &, const wchar_t &) |
virtual void | remove (const iterator &) |
Remove the item specified by the iterator. | |
Pointer Access | |
const char * | c_string () const |
const unsigned char * | p_string () const |
const wchar_t * | w_string () const |
Countable Implementation | |
virtual void | clear () |
Clears the contents of the collection. | |
virtual gsgl::index_t | size () const |
A generic count function that iterates over the collection. | |
Comparable Implementation Etc. | |
int | compare (const wchar_t *) const |
virtual int | compare (const data::comparable &) const |
Compares two objects. Implementations should check the type of the given object. | |
bool | operator!= (const wchar_t *s) const |
bool | operator< (const wchar_t *s) const |
bool | operator<= (const wchar_t *s) const |
bool | operator== (const wchar_t *s) const |
bool | operator> (const wchar_t *s) const |
bool | operator>= (const wchar_t *s) const |
Indexable Implementation | |
virtual bool | contains_index (const gsgl::index_t &index) const |
virtual wchar_t & | item (const gsgl::index_t &index) |
virtual const wchar_t & | item (const gsgl::index_t &index) const |
Substrings | |
gsgl::index_t | find (const string &substr, const gsgl::index_t index=0) const |
gsgl::index_t | find (const wchar_t *substr, const gsgl::index_t index=0) const |
gsgl::index_t | find_reverse (const string &substr, const gsgl::index_t index=-1) const |
gsgl::index_t | find_reverse (const wchar_t *substr, const gsgl::index_t index=-1) const |
string | left_substring (const gsgl::index_t length) const |
string | right_substring (const gsgl::index_t length) const |
string | substring (const gsgl::index_t index, const gsgl::index_t length=-1) const |
Serializable Implementation | |
virtual void | from_stream (io::data_stream &) |
virtual void | to_stream (io::data_stream &) const |
Printable Implementation | |
virtual void | from_stream (io::text_stream &) |
virtual void | to_stream (io::text_stream &) const |
Iterators | |
iterator | iter () |
const_iterator | iter () const |
String Concatenation | |
string | operator+ (const string &) const |
string | operator+ (const wchar_t *) const |
string | operator+ (const wchar_t &) const |
string & | operator+= (const string &) |
string & | operator+= (const wchar_t *) |
string & | operator+= (const wchar_t &) |
Static Public Attributes | |
static const string | EMPTY_STRING = L"" |
Private Types | |
enum | string_mode { STRING_NULL = 0, STRING_CONST_REF = 1, STRING_SHARED_IMPL = 2, STRING_INVALID = 3 } |
Private Member Functions | |
void | make_null () |
void | unshare () const |
Private Attributes | |
union { | |
string_impl * impl | |
const wchar_t * ref | |
}; | |
string_mode | mode |
enum string_mode [private] |
Definition at line 70 of file string.hpp.
string | ( | ) |
Definition at line 201 of file string.cpp.
References ASSIGN_DEBUG_PTR.
Referenced by string::format(), and string::right_substring().
string | ( | const wchar_t * | str | ) |
Does NOT make a copy of the given wide-character string, only keeps a reference to it.
Definition at line 247 of file string.cpp.
References ASSIGN_DEBUG_PTR.
string | ( | wchar_t * | str | ) |
Makes a copy of the given wide-character string.
Definition at line 231 of file string.cpp.
References ASSIGN_DEBUG_PTR, and string::unshare().
string | ( | const char * | str | ) | [explicit] |
Definition at line 262 of file string.cpp.
References simple_array::append(), ASSIGN_DEBUG_PTR, shared_object::attach(), string::impl, string::mode, simple_array::ptr(), and string::STRING_SHARED_IMPL.
~string | ( | ) | [virtual] |
Definition at line 346 of file string.cpp.
References ASSIGN_DEBUG_PTR, string::make_null(), string::mode, and string::STRING_INVALID.
virtual void append | ( | const T & | ) | [pure virtual, inherited] |
Add an item to the end of the collection.
Implemented in simple_array, dictionary, list, and pqueue.
void append | ( | const string & | str | ) |
void append | ( | const wchar_t * | str | ) |
Definition at line 408 of file string.cpp.
References ASSIGN_DEBUG_PTR, string::impl, simple_array::ptr(), string_impl::set_modified(), string::size(), string::unshare(), and string_impl::w_data.
void append | ( | const wchar_t & | ch | ) | [virtual] |
Definition at line 398 of file string.cpp.
References simple_array::append(), ASSIGN_DEBUG_PTR, string::impl, string_impl::set_modified(), simple_array::size(), string::unshare(), and string_impl::w_data.
Referenced by string::append(), file_stream::file_stream(), string::from_stream(), config_record::from_stream(), string::operator+(), and string::operator+=().
const char * c_string | ( | ) | const |
Definition at line 608 of file string.cpp.
References string_impl::get_c_string(), string::impl, and string::unshare().
Referenced by application::application(), font_impl::calc_height(), font_impl::calc_width(), file::copy(), directory::create(), file::exists(), directory::exists(), file_stream::file_stream(), font_impl::font_impl(), heightmap::init(), pkg_library::pkg_library(), file::remove(), and texture_impl::texture_impl().
void clear | ( | ) | [virtual] |
Clears the contents of the collection.
Implements countable.
Definition at line 374 of file string.cpp.
References simple_array::append(), ASSIGN_DEBUG_PTR, simple_array::clear(), string::impl, string::make_null(), string::mode, string_impl::set_modified(), string::STRING_CONST_REF, string::STRING_NULL, string::STRING_SHARED_IMPL, string::unshare(), and string_impl::w_data.
Referenced by string::from_stream().
int compare | ( | const wchar_t * | str | ) | const |
int compare | ( | const data::comparable & | ) | const [virtual] |
Compares two objects. Implementations should check the type of the given object.
Implements comparable.
Definition at line 497 of file string.cpp.
References string::w_string().
Referenced by directory::compare().
virtual bool contains_index | ( | const I & | ) | const [pure virtual, inherited] |
Implemented in dictionary.
bool contains_index | ( | const gsgl::index_t & | index | ) | const [virtual] |
string copy | ( | ) |
Makes a deep copy of the string that is not shared.
Definition at line 758 of file string.cpp.
References string::unshare().
Referenced by string::unshare().
gsgl::index_t find | ( | const string & | substr, | |
const gsgl::index_t | index = 0 | |||
) | const |
gsgl::index_t find | ( | const wchar_t * | substr, | |
const gsgl::index_t | index = 0 | |||
) | const |
Definition at line 711 of file string.cpp.
References string::w_string().
Referenced by string::find().
gsgl::index_t find_reverse | ( | const string & | substr, | |
const gsgl::index_t | index = -1 | |||
) | const |
Definition at line 750 of file string.cpp.
References string::find_reverse(), and string::w_string().
gsgl::index_t find_reverse | ( | const wchar_t * | substr, | |
const gsgl::index_t | index = -1 | |||
) | const |
Definition at line 725 of file string.cpp.
References string::w_string().
Referenced by string::find_reverse(), and application::get_program_dir().
iterable< T, IBase >::const_iterator find_value | ( | const T & | item | ) | const [inline, virtual, inherited] |
A generic find function that iterates over the collection to find a particular value.
Definition at line 153 of file iterable.hpp.
References iterable::const_iterator::is_valid().
Referenced by gsgl::data::global_unregister_resource_aux().
Definition at line 899 of file string.cpp.
References string::size(), string::string(), and string::w_string().
string format | ( | const wchar_t * | format, | |
... | ||||
) | [static] |
Definition at line 914 of file string.cpp.
References string::string().
Referenced by simulation::draw(), application::draw_budget(), file_log_target::file_log_target(), font::font(), font_impl::get_glyph(), node::get_name(), config_variable::get_string(), application::load_objects(), mapped_file::mapped_file(), model::model(), texture::texture(), julian_day::to_gregorian_string(), vehicle::vehicle(), vehicle_module::vehicle_module(), and file_log_target::~file_log_target().
void from_stream | ( | io::data_stream & | s | ) | [virtual] |
Implements serializable.
Definition at line 573 of file string.cpp.
References ASSIGN_DEBUG_PTR, smart_pointer::ptr(), and data_stream::read().
void from_stream | ( | io::text_stream & | s | ) | [virtual] |
Implements printable.
Definition at line 540 of file string.cpp.
References string::append(), ASSIGN_DEBUG_PTR, string::clear(), text_stream::get(), and text_stream::peek().
virtual void insert | ( | const iterator & | , | |
const T & | ||||
) | [pure virtual, inherited] |
Insert an item before the one specified by the iterator.
Implemented in simple_array, dictionary, list, and pqueue.
void insert | ( | const iterator & | i, | |
const wchar_t & | ch | |||
) | [virtual] |
Definition at line 430 of file string.cpp.
References assert, string::impl, simple_array::insert(), string_impl::set_modified(), string::unshare(), and string_impl::w_data.
virtual bool is_empty | ( | ) | const [inline, virtual, inherited] |
Returns true if the collection is empty.
Definition at line 59 of file countable.hpp.
Referenced by application::application(), broker_creator::broker_creator(), config_variable< gsgl::platform::color >::config_variable(), file::file(), font_impl::font_impl(), config_record::from_stream(), application::get_config_overrides(), node::get_name(), brokered_object::get_type_name(), event_map::load_keyboard_events(), application::load_scenery(), model_part::model_part(), package::package(), physics_frame::physics_frame(), solar_system::solar_system(), stellar_db::stellar_db(), and vehicle::vehicle().
virtual T& item | ( | const I & | index | ) | [pure virtual, inherited] |
Implemented in dictionary.
virtual const T& item | ( | const I & | index | ) | const [pure virtual, inherited] |
Implemented in dictionary.
Referenced by indexable< gsgl::data::log_target *, unsigned int >::operator[]().
wchar_t & item | ( | const gsgl::index_t & | index | ) | [virtual] |
Definition at line 478 of file string.cpp.
References string::impl, simple_array::item(), string::size(), string::unshare(), and string_impl::w_data.
const wchar_t & item | ( | const gsgl::index_t & | index | ) | const [virtual] |
Definition at line 452 of file string.cpp.
References assert, string::impl, simple_array::item(), string::mode, string::ref, string::STRING_CONST_REF, string::STRING_NULL, and string_impl::w_data.
iterator iter | ( | ) | [inline, inherited] |
Definition at line 101 of file iterable.hpp.
const_iterator iter | ( | ) | const [inline, inherited] |
Definition at line 100 of file iterable.hpp.
Referenced by config_variable::assign_from_string(), treebox::clear_tree_nodes(), keplerian_element_propagator::get_array(), config_record::get_child(), satellite_element_propagator::get_elements(), application::load_scenery(), list::operator==(), dictionary::operator==(), config_record::override_with(), vector::parse(), transform::parse(), application::remove_viewpoint_nodes(), config_record::to_stream(), vector::vector(), application::~application(), and cache::~cache().
string left_substring | ( | const gsgl::index_t | length | ) | const |
Definition at line 691 of file string.cpp.
References string::substring().
Referenced by event_map::load_keyboard_events().
string & make_lower | ( | ) |
Definition at line 810 of file string.cpp.
References ASSIGN_DEBUG_PTR, string::impl, simple_array::ptr(), string::unshare(), and string_impl::w_data.
Referenced by material_file::material_file(), and mesh_file::mesh_file().
void make_null | ( | ) | [private] |
Definition at line 931 of file string.cpp.
References assert, ASSIGN_DEBUG_PTR, shared_object::detach(), string::impl, string::mode, string::ref, string::STRING_NULL, and string::STRING_SHARED_IMPL.
Referenced by string::clear(), string::operator=(), and string::~string().
string & make_upper | ( | ) |
Definition at line 794 of file string.cpp.
References ASSIGN_DEBUG_PTR, string::impl, simple_array::ptr(), string::unshare(), and string_impl::w_data.
bool operator!= | ( | const wchar_t * | s | ) | const [inline] |
Definition at line 139 of file string.hpp.
string operator+ | ( | const wchar_t * | str | ) | const |
string operator+ | ( | const wchar_t & | ch | ) | const |
string & operator+= | ( | const wchar_t * | str | ) |
string & operator+= | ( | const wchar_t & | ch | ) |
bool operator< | ( | const wchar_t * | s | ) | const [inline] |
Definition at line 140 of file string.hpp.
bool operator<= | ( | const wchar_t * | s | ) | const [inline] |
Definition at line 141 of file string.hpp.
Definition at line 317 of file string.cpp.
References assert, ASSIGN_DEBUG_PTR, shared_object::attach(), string::impl, string::make_null(), string::mode, string::ref, string::STRING_CONST_REF, string::STRING_NULL, and string::STRING_SHARED_IMPL.
string & operator= | ( | wchar_t * | str | ) |
Definition at line 289 of file string.cpp.
References ASSIGN_DEBUG_PTR, string::make_null(), string::mode, string::ref, string::STRING_CONST_REF, string::STRING_NULL, and string::unshare().
string & operator= | ( | const wchar_t * | str | ) |
Definition at line 304 of file string.cpp.
References ASSIGN_DEBUG_PTR, string::make_null(), string::mode, string::ref, string::STRING_CONST_REF, and string::STRING_NULL.
bool operator== | ( | const wchar_t * | s | ) | const [inline] |
Definition at line 138 of file string.hpp.
bool operator> | ( | const wchar_t * | s | ) | const [inline] |
Definition at line 142 of file string.hpp.
bool operator>= | ( | const wchar_t * | s | ) | const [inline] |
Definition at line 143 of file string.hpp.
T& operator[] | ( | const I & | index | ) | [inline, inherited] |
Definition at line 58 of file indexable.hpp.
const T& operator[] | ( | const I & | index | ) | const [inline, inherited] |
Definition at line 57 of file indexable.hpp.
const unsigned char * p_string | ( | ) | const |
Definition at line 615 of file string.cpp.
References string_impl::get_p_string(), string::impl, and string::unshare().
void remove | ( | const iterator & | ) | [virtual] |
Remove the item specified by the iterator.
Implements iterable.
Definition at line 440 of file string.cpp.
References assert, string::impl, simple_array::remove(), string_impl::set_modified(), string::unshare(), and string_impl::w_data.
string right_substring | ( | const gsgl::index_t | length | ) | const |
Definition at line 697 of file string.cpp.
References string::size(), string::string(), and string::substring().
Referenced by file::file(), material_file::material_file(), and mesh_file::mesh_file().
gsgl::index_t size | ( | ) | const [virtual] |
A generic count function that iterates over the collection.
Reimplemented from iterable.
Definition at line 357 of file string.cpp.
References assert, string::impl, string::mode, string::ref, simple_array::size(), string::STRING_CONST_REF, string::STRING_NULL, string::STRING_SHARED_IMPL, and string_impl::w_data.
Referenced by string::append(), string::contains_index(), font_impl::draw(), string::format(), config_record::from_stream(), string::item(), event_map::load_keyboard_events(), material_file::load_mtl_file(), mesh_file::load_obj_file(), string::right_substring(), string::split(), string::substring(), string::to_double(), string::to_int(), string::to_stream(), config_record::to_stream(), and string::trim().
data::list< string > split | ( | const string & | separator | ) | const |
data::list< string > split | ( | const wchar_t * | separator | ) | const |
Definition at line 860 of file string.cpp.
References list::append(), string::size(), and string::w_string().
Referenced by config_variable::assign_from_string(), keplerian_element_propagator::get_array(), config_record::get_child(), satellite_element_propagator::get_elements(), material_file::load_mtl_file(), mesh_file::load_obj_file(), vector::parse(), transform::parse(), string::split(), and vector::vector().
string substring | ( | const gsgl::index_t | index, | |
const gsgl::index_t | length = -1 | |||
) | const |
Definition at line 671 of file string.cpp.
References string::impl, simple_array::ptr(), string_impl::set_modified(), string::size(), string::unshare(), string_impl::w_data, and string::w_string().
Referenced by application::get_program_dir(), string::left_substring(), event_map::load_keyboard_events(), and string::right_substring().
bool to_bool | ( | ) | const |
Definition at line 826 of file string.cpp.
References string::impl, simple_array::ptr(), and string_impl::w_data.
double to_double | ( | ) | const |
Definition at line 845 of file string.cpp.
References string::size(), and string::w_string().
Referenced by config_variable::assign_from_string(), and datetime_box::recalc_text().
int to_int | ( | ) | const |
Definition at line 836 of file string.cpp.
References string::size(), and string::w_string().
Referenced by config_variable::assign_from_string().
void to_stream | ( | io::data_stream & | s | ) | const [virtual] |
Implements serializable.
Definition at line 565 of file string.cpp.
References string::size(), string::w_string(), and data_stream::write().
void to_stream | ( | io::text_stream & | s | ) | const [virtual] |
string & trim | ( | ) |
Definition at line 766 of file string.cpp.
References ASSIGN_DEBUG_PTR, string::size(), and string::w_string().
Referenced by config_record::find_child(), config_record::from_stream(), event_map::load_keyboard_events(), material_file::load_mtl_file(), and mesh_file::load_obj_file().
void unshare | ( | ) | const [private] |
Definition at line 946 of file string.cpp.
References assert, ASSIGN_DEBUG_PTR, shared_object::attach(), string::copy(), shared_object::detach(), shared_object::get_ref_count(), string::impl, string::mode, string::ref, string::STRING_CONST_REF, string::STRING_NULL, and string::STRING_SHARED_IMPL.
Referenced by string::append(), string::c_string(), string::clear(), string::copy(), string::insert(), string::item(), string::make_lower(), string::make_upper(), string::operator=(), string::p_string(), string::remove(), string::string(), and string::substring().
const wchar_t * w_string | ( | ) | const |
Definition at line 591 of file string.cpp.
References assert, string_impl::get_w_string(), string::impl, string::mode, string::ref, string::STRING_CONST_REF, string::STRING_NULL, and string::STRING_SHARED_IMPL.
Referenced by string::append(), texture_impl::bind(), string::compare(), shader_base::compile(), config_record::config_record(), fragment_shader::create(), vertex_shader::create(), directory::create(), broker::create_object(), main_window::draw(), file::file(), file_log_target::file_log_target(), file_stream::file_stream(), string::find(), string::find_reverse(), font::font(), font_impl::font_impl(), string::format(), julian_day::from_gregorian_string(), keplerian_element_propagator::get_array(), config_record::get_child(), application::get_cmdline_dir(), application::get_config_overrides(), directory::get_dirs(), directory::get_files(), font_impl::get_glyph(), directory::get_paths(), gsgl::data::global_register_resource_aux(), heightmap::init(), stellar_db::load_db(), event_map::load_keyboard_events(), material_file::load_mtl_file(), mesh_file::load_obj_file(), application::load_objects(), application::load_package(), application::load_scenery(), mapped_file::mapped_file(), material::material(), material_file::material_file(), mesh_file::mesh_file(), model::model(), model_part::model_part(), string::operator+(), string::operator+=(), config_record::override_with(), package::package(), ft_stream::peek(), pkg_library::pkg_library(), pkg_scenery::pkg_scenery(), pkg_vehicle::pkg_vehicle(), debug_log_target::print_line(), file::remove(), rgba_buffer::rgba_buffer(), simulation::simulation(), solar_system::solar_system(), string::split(), string::substring(), texture::texture(), texture_impl::texture_impl(), string::to_double(), string::to_int(), string::to_stream(), string::trim(), vehicle::vehicle(), vehicle_module::vehicle_module(), and file_log_target::~file_log_target().
union { ... } [private] |
const string EMPTY_STRING = L"" [static] |
Definition at line 214 of file string.hpp.
string_impl* impl [mutable] |
Definition at line 84 of file string.hpp.
Referenced by string::append(), string::c_string(), string::clear(), string::insert(), string::item(), string::make_lower(), string::make_null(), string::make_upper(), string::operator=(), string::p_string(), string::remove(), string::size(), string::string(), string::substring(), string::to_bool(), string::unshare(), and string::w_string().
string_mode mode [mutable, private] |
Definition at line 78 of file string.hpp.
Referenced by string::clear(), string::item(), string::make_null(), string::operator=(), string::size(), string::string(), string::unshare(), string::w_string(), and string::~string().
const wchar_t* ref |
Definition at line 85 of file string.hpp.
Referenced by string::item(), string::make_null(), string::operator=(), string::size(), string::unshare(), and string::w_string().