ucommon
7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
![]() ![]() |
#include <memory.h>
Classes | |
class | member |
Public Types | |
typedef linked_pointer< StringPager::member > | iterator |
Public Member Functions | |
virtual bool | filter (char *text, size_t size) |
StringPager (size_t pagesize=256) | |
StringPager (char **list, size_t pagesize=256) | |
unsigned | count (void) const |
const char * | get (unsigned item) const |
void | set (unsigned item, const char *string) |
void | add (const char *text) |
void | push (const char *text) |
void | push (char **text) |
const char * | pull (void) |
const char * | pop (void) |
void | add (char **list) |
void | set (char **list) |
void | clear (void) |
const char * | operator[] (unsigned item) const |
const char * | at (unsigned item) const |
StringPager::member * | begin (void) const |
void | operator+= (const char *text) |
StringPager & | operator<< (const char *text) |
StringPager & | operator>> (const char *text) |
void | sort (void) |
char ** | list (void) |
unsigned | token (const char *text, const char *list, const char *quote=NULL, const char *end=NULL) |
unsigned | split (const char *text, const char *string, unsigned flags=0) |
unsigned | split (stringex_t &expr, const char *string, unsigned flags=0) |
String | join (const char *prefix=NULL, const char *middle=NULL, const char *suffix=NULL) |
operator bool () const | |
bool | operator! () const |
StringPager & | operator= (char **list) |
const char * | operator* () |
operator char ** () | |
size_t | size (void) const |
unsigned | pages (void) const |
void | assign (StringPager &source) |
Private Attributes | |
unsigned | members |
LinkedObject * | root |
member * | last |
char ** | index |
Additional Inherited Members | |
![]() | |
page_t * | pager (void) |
virtual void * | _alloc (size_t size) __OVERRIDE |
memalloc (size_t page=0) | |
memalloc (const memalloc ©) | |
virtual | ~memalloc () |
unsigned | pages (void) const |
unsigned | max (void) const |
size_t | size (void) const |
unsigned | utilization (void) const |
void | purge (void) |
void | assign (memalloc &source) |
![]() | |
unsigned | limit |
String pager for storing lists of NULL terminated strings. This is used for accumulating lists which can be destroyed all at once.
ucommon::StringPager::StringPager | ( | size_t | pagesize = 256 | ) |
ucommon::StringPager::StringPager | ( | char ** | list, |
size_t | pagesize = 256 |
||
) |
void ucommon::StringPager::add | ( | char ** | list | ) |
Add list to list. This is a list of string pointers terminated with NULL.
list | of text to add. |
Definition at line 763 of file memory.cpp.
void ucommon::StringPager::add | ( | const char * | text | ) |
Add text to list.
text | to add. |
Definition at line 719 of file memory.cpp.
References ucommon::memalloc::_alloc(), index, last, members, root, ucommon::StringPager::member::set(), size(), and ucommon::str().
Referenced by add(), filter(), ucommon::DirPager::filter(), set(), split(), StringPager(), and token().
void ucommon::StringPager::assign | ( | StringPager & | source | ) |
Assign foreign pager to us. This relocates the heap references to our object, clears the other object.
Definition at line 485 of file memory.cpp.
References ucommon::memalloc::assign(), index, last, members, and root.
Referenced by ucommon::DirPager::assign().
|
inline |
|
inline |
Get root of pager list. This is useful for externally enumerating the list of strings.
Definition at line 547 of file memory.h.
Referenced by ucommon::_stream_operators::print().
void ucommon::StringPager::clear | ( | void | ) |
Purge all members and release pager member. The list can then be added to again.
Definition at line 635 of file memory.cpp.
References index, last, members, ucommon::memalloc::purge(), and root.
Referenced by ucommon::DirPager::operator=(), and set().
|
inline |
|
virtual |
Filter text in a derived class. The base class filter removes newlines at end of text and filters out empty strings.
text | to filter. |
size | of text buffer for transforms. |
Reimplemented in ucommon::DirPager.
Definition at line 509 of file memory.cpp.
Referenced by ucommon::_stream_operators::input().
const char * ucommon::StringPager::get | ( | unsigned | item | ) | const |
Get string item from list. This is useful when StringPager is passed as a pointer and hence inconvenient for the [] operator.
item | to access. |
Definition at line 620 of file memory.cpp.
References __THROW_RANGE, list(), members, and root.
Referenced by ucommon::DirPager::at(), ucommon::DirPager::get(), and ucommon::DirPager::operator[]().
String ucommon::StringPager::join | ( | const char * | prefix = NULL , |
const char * | middle = NULL , |
||
const char * | suffix = NULL |
||
) |
Definition at line 532 of file memory.cpp.
References ucommon::is(), members, ucommon::LinkedObject::Next, ucommon::linked_pointer< T >::next(), prefix, root, suffix, and ucommon::StringPager::member::text.
Referenced by ucommon::str().
char ** ucommon::StringPager::list | ( | void | ) |
Gather index list.
Definition at line 799 of file memory.cpp.
References ucommon::memalloc::_alloc(), index, ucommon::is(), members, ucommon::linked_pointer< T >::next(), root, and ucommon::StringPager::member::text.
Referenced by add(), get(), push(), set(), sort(), StringPager(), and token().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 630 of file memory.h.
References ucommon::memalloc::pages().
const char * ucommon::StringPager::pop | ( | void | ) |
Remove element from back of list. Does not release memory.
Definition at line 687 of file memory.cpp.
References __THROW_RUNTIME, index, ucommon::is(), last, members, ucommon::LinkedObject::Next, ucommon::linked_pointer< T >::next(), out, root, and ucommon::StringPager::member::text.
const char * ucommon::StringPager::pull | ( | void | ) |
Remove element from front of list. Does not release memory.
Definition at line 644 of file memory.cpp.
References __THROW_RUNTIME, index, last, members, ucommon::LinkedObject::Next, result(), root, and ucommon::StringPager::member::text.
void ucommon::StringPager::push | ( | char ** | text | ) |
void ucommon::StringPager::push | ( | const char * | text | ) |
Add text to front of list.
text | to add. |
Definition at line 664 of file memory.cpp.
References ucommon::memalloc::_alloc(), index, last, members, root, size(), and ucommon::str().
Referenced by push().
void ucommon::StringPager::set | ( | char ** | list | ) |
Set list to list. This is a list of string pointers terminated with NULL.
list | of text to set. |
Definition at line 745 of file memory.cpp.
void ucommon::StringPager::set | ( | unsigned | item, |
const char * | string | ||
) |
Replace string item in list.
item | to replace. |
string | to replace with. |
Definition at line 601 of file memory.cpp.
References ucommon::memalloc::_alloc(), list(), members, root, size(), and ucommon::str().
|
inline |
Definition at line 626 of file memory.h.
References ucommon::memalloc::size().
Referenced by add(), ucommon::_stream_operators::input(), push(), and set().
void ucommon::StringPager::sort | ( | void | ) |
Sort members.
Definition at line 775 of file memory.cpp.
References count(), index, ucommon::is(), list(), members, ucommon::ncompare(), ucommon::linked_pointer< T >::next(), and root.
Referenced by ucommon::DirPager::load().
unsigned ucommon::StringPager::split | ( | const char * | text, |
const char * | string, | ||
unsigned | flags = 0 |
||
) |
Definition at line 555 of file memory.cpp.
References add(), count(), ucommon::String::dup(), and ucommon::String::INSENSITIVE.
unsigned ucommon::StringPager::split | ( | stringex_t & | expr, |
const char * | string, | ||
unsigned | flags = 0 |
||
) |
Definition at line 223 of file regex.cpp.
References ucommon::String::add(), ucommon::String::count(), ucommon::String::dup(), ucommon::String::regex::match(), ucommon::String::regex::members(), ucommon::String::regex::offset(), and ucommon::String::regex::size().
unsigned ucommon::StringPager::token | ( | const char * | text, |
const char * | list, | ||
const char * | quote = NULL , |
||
const char * | end = NULL |
||
) |
Tokenize a string and add each token to the StringPager.
text | to tokenize. |
list | of characters to use as token separators. |
quote | pairs of characters for quoted text or NULL if not used. |
end | of line marker characters or NULL if not used. |
Definition at line 515 of file memory.cpp.
References add(), count(), list(), quote, result(), and ucommon::String::token().
|
private |
|
private |
|
private |
|
private |