
#include <rutz/fstring.h>

Public Member Functions | |
| fstring () | |
| Construct an empty string. | |
| fstring (const fstring &other) throw () | |
| Copy constructor. | |
| ~fstring () throw () | |
| Destructory. | |
| fstring (const char *s) | |
| Construct by copying from a C-style null-terminated char array. | |
| fstring (char_range r) | |
| Construct from a character range (pointer plus length). | |
| void | swap (fstring &other) throw () |
| Swap contents with another fstring object. | |
| fstring & | operator= (const char *text) |
| Assign from a C-style null-terminated char array. | |
| fstring & | operator= (const fstring &other) throw () |
| Assignment operator. | |
| const char * | c_str () const throw () |
| Get a pointer to the const underlying data array. | |
| std::size_t | length () const throw () |
| Get the number of characters in the string (NOT INCLUDING the null terminator). | |
| bool | is_empty () const throw () |
| Query whether the length of the string is 0. | |
| bool | empty () const throw () |
| Same as is_empty(); for compatibility with std::string interface. | |
| char | operator[] (unsigned int i) const |
| Return the character at position i. | |
| void | clear () |
| Reset to an empty string. | |
| bool | ends_with (const fstring &ext) const throw () |
| Query whether the terminal substring matches the given string. | |
| bool | equals (const char *other) const throw () |
| Query for equality with a C-style string. | |
| bool | equals (const fstring &other) const throw () |
| Query for equality with another fstring object. | |
| bool | operator< (const char *other) const throw () |
| Query if string is lexicographically less-than another string. | |
| template<class string_type > | |
| bool | operator< (const string_type &other) const throw () |
| Query if string is lexicographically less-than another string. | |
| bool | operator> (const char *other) const throw () |
| Query if string is lexicographically greater-than another string. | |
| template<class string_type > | |
| bool | operator> (const string_type &other) const throw () |
| Query if string is lexicographically greater-than another string. | |
| void | read (std::istream &is) |
| Set the string by reading consecutive non-whitespace characters. | |
| void | readsome (std::istream &is, unsigned int count) |
| Set the string by reading exactly count characters. | |
| void | write (std::ostream &os) const |
| Write the string's contents to the ostream. | |
| void | readline (std::istream &is, char eol= '\n') |
| Set the string by reading characters up until newline or EOF. | |
| bool | operator== (const char *rhs) const throw () |
| Equality operator. | |
| bool | operator== (const fstring &rhs) const throw () |
| Equality operator. | |
| bool | operator!= (const char *rhs) const throw () |
| Inequality operator. | |
| bool | operator!= (const fstring &rhs) const throw () |
| Inequality operator. | |
| void | debug_dump () const throw () |
| Dump contents for debugging. | |
fstring is a simple string class that holds a pointer to a dynamically-allocated char array. The initializer does not have to reside in permanent storage, since a copy is made when the fstring is constructed. Assignment is allowed, with copy semantics. Also, a swap() operation is provided. The internal implementation uses reference counting to allow for efficient copies; however, to allow safe multi-threaded access to fstring, fstring's interface is read-only, except for a few functions (assignment operator, swap(), clear() read(), readline(), readsome()) which safely replace the entire string.
Definition at line 149 of file fstring.h.
| rutz::fstring::fstring | ( | ) |
Construct an empty string.
Definition at line 269 of file fstring.cc.
Referenced by clear(), read(), readline(), and readsome().
| rutz::fstring::fstring | ( | const fstring & | other | ) | throw () |
Copy constructor.
Definition at line 277 of file fstring.cc.
| rutz::fstring::~fstring | ( | ) | throw () |
Destructory.
Definition at line 284 of file fstring.cc.
| rutz::fstring::fstring | ( | const char * | s | ) | [inline] |
| rutz::fstring::fstring | ( | char_range | r | ) | [inline, explicit] |
| const char* rutz::fstring::c_str | ( | ) | const throw () [inline] |
Get a pointer to the const underlying data array.
Definition at line 185 of file fstring.h.
Referenced by rutz::unixcall::get_file_user_pid(), rutz::ibzip2open(), rutz::igzopen(), tcl::command_group::lookup_original(), rutz::obzip2open(), rutz::ogzopen(), operator<(), operator>(), rutz::error_context::prepend_to(), ColorbarsInput::readFrame(), nub::logging::remove_obj_scope(), nub::logging::set_log_filename(), rutz::value::set_string(), rutz::assoc_array_base::throw_for_key(), PluginFallback::try_fallback(), tcl::command::usage_string(), rutz::error::what(), and write().
| void rutz::fstring::clear | ( | void | ) |
| void rutz::fstring::debug_dump | ( | ) | const throw () |
Dump contents for debugging.
Definition at line 401 of file fstring.cc.
| bool rutz::fstring::empty | ( | ) | const throw () [inline] |
Same as is_empty(); for compatibility with std::string interface.
Definition at line 194 of file fstring.h.
References is_empty().
| bool rutz::fstring::ends_with | ( | const fstring & | ext | ) | const throw () |
Query whether the terminal substring matches the given string.
Definition at line 319 of file fstring.cc.
Referenced by rutz::ibzip2open(), rutz::obzip2open(), and rutz::ogzopen().
| bool rutz::fstring::equals | ( | const fstring & | other | ) | const throw () |
Query for equality with another fstring object.
Definition at line 344 of file fstring.cc.
| bool rutz::fstring::equals | ( | const char * | other | ) | const throw () |
Query for equality with a C-style string.
Definition at line 337 of file fstring.cc.
Referenced by operator!=(), and operator==().
| bool rutz::fstring::is_empty | ( | ) | const throw () [inline] |
| std::size_t rutz::fstring::length | ( | void | ) | const throw () [inline] |
Get the number of characters in the string (NOT INCLUDING the null terminator).
Definition at line 188 of file fstring.h.
Referenced by is_empty(), rutz::error_context::prepend_to(), rutz::error::what(), and write().
| bool rutz::fstring::operator!= | ( | const fstring & | rhs | ) | const throw () [inline] |
| bool rutz::fstring::operator!= | ( | const char * | rhs | ) | const throw () [inline] |
| bool rutz::fstring::operator< | ( | const string_type & | other | ) | const throw () [inline] |
Query if string is lexicographically less-than another string.
Definition at line 223 of file fstring.h.
References c_str(), and operator<().
| bool rutz::fstring::operator< | ( | const char * | other | ) | const throw () |
Query if string is lexicographically less-than another string.
Definition at line 353 of file fstring.cc.
Referenced by operator<().
| rutz::fstring & rutz::fstring::operator= | ( | const fstring & | other | ) | throw () |
Assignment operator.
Definition at line 310 of file fstring.cc.
| rutz::fstring & rutz::fstring::operator= | ( | const char * | text | ) |
Assign from a C-style null-terminated char array.
Definition at line 301 of file fstring.cc.
References swap().
| bool rutz::fstring::operator== | ( | const fstring & | rhs | ) | const throw () [inline] |
| bool rutz::fstring::operator== | ( | const char * | rhs | ) | const throw () [inline] |
| bool rutz::fstring::operator> | ( | const string_type & | other | ) | const throw () [inline] |
Query if string is lexicographically greater-than another string.
Definition at line 233 of file fstring.h.
References c_str(), and operator>().
| bool rutz::fstring::operator> | ( | const char * | other | ) | const throw () |
Query if string is lexicographically greater-than another string.
Definition at line 362 of file fstring.cc.
Referenced by operator>().
| char rutz::fstring::operator[] | ( | unsigned int | i | ) | const [inline] |
| void rutz::fstring::read | ( | std::istream & | is | ) |
Set the string by reading consecutive non-whitespace characters.
Definition at line 377 of file fstring.cc.
References fstring().
| void rutz::fstring::readline | ( | std::istream & | is, | |
| char | eol = '\n' | |||
| ) |
Set the string by reading characters up until newline or EOF.
Definition at line 395 of file fstring.cc.
References fstring().
| void rutz::fstring::readsome | ( | std::istream & | is, | |
| unsigned int | count | |||
| ) |
Set the string by reading exactly count characters.
Definition at line 383 of file fstring.cc.
References fstring().
| void rutz::fstring::swap | ( | rutz::fstring & | other | ) | throw () |
Swap contents with another fstring object.
Definition at line 294 of file fstring.cc.
Referenced by operator=().
| void rutz::fstring::write | ( | std::ostream & | os | ) | const |
Write the string's contents to the ostream.
Definition at line 389 of file fstring.cc.
1.6.3