UCommon
Public Member Functions | Protected Member Functions | Protected Attributes
ucommon::DirPager Class Reference

Directory pager is a paged string list for directory file names. More...

#include <memory.h>

Inheritance diagram for ucommon::DirPager:
Inheritance graph
[legend]
Collaboration diagram for ucommon::DirPager:
Collaboration graph
[legend]

Public Member Functions

 DirPager (const char *path)
const char * get (unsigned item)
 Get string item from list.
 operator bool ()
bool operator! ()
const char * operator* ()
void operator= (const char *path)
const char * operator[] (unsigned item)
 Return specified filename from directory list.

Protected Member Functions

virtual bool filter (const char *filename)
 Filter filenames in a derived class.
bool load (const char *path)
 Load a directory path.
- Protected Member Functions inherited from ucommon::stringpager
void add (const char *text)
 Add text to list.
void add (char **list)
 Add list to list.
stringpager::memberbegin (void)
 Get root of pager list.
void clear (void)
 Purge all members and release pager member.
unsigned count (void)
 Get the number of items in the pager string list.
String join (const char *prefix=((void *) 0), const char *middle=((void *) 0), const char *suffix=((void *) 0))
char ** list (void)
 Gather index list.
 operator char ** ()
void operator+= (const char *text)
 Convenience operator to add to pager and auto-sort.
stringpageroperator<< (const char *text)
 Convenience operator to add to pager.
stringpageroperator= (char **list)
stringpageroperator>> (const char *text)
const char * pop (void)
 Remove element from back of list.
const char * pull (void)
 Remove element from front of list.
void push (const char *text)
 Add text to front of list.
void push (char **text)
 Add text list to front of list.
void set (unsigned item, const char *string)
 Replace string item in list.
void set (char **list)
 Set list to list.
void sort (void)
 Sort members.
unsigned split (const char *text, const char *string, unsigned flags=0)
unsigned split (stringex_t &expr, const char *string, unsigned flags=0)
 stringpager (size_t pagesize=256)
 Create a pager with a maximum page size.
 stringpager (char **list, size_t pagesize=256)
unsigned token (const char *text, const char *list, const char *quote=((void *) 0), const char *end=((void *) 0))
 Tokenize a string and add each token to the stringpager.

Protected Attributes

const char * dir

Detailed Description

Directory pager is a paged string list for directory file names.

This protocol is used to convert a directory into a list of filenames. As a protocol it offers a filtering method to select which files to include in the list.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 545 of file memory.h.

Member Function Documentation

virtual bool ucommon::DirPager::filter ( const char *  filename)
protectedvirtual

Filter filenames in a derived class.

Parameters
filenameto filter.
Returns
true if include in final list.
const char* ucommon::DirPager::get ( unsigned  item)
inline

Get string item from list.

This is useful when stringpager is passed as a pointer and hence inconvenient for the [] operator.

Parameters
itemto access.
Returns
pointer to text for item, or NULL if out of range.

Reimplemented from ucommon::stringpager.

Definition at line 589 of file memory.h.

bool ucommon::DirPager::load ( const char *  path)
protected

Load a directory path.

Parameters
pathto load.
Returns
true if valid.
const char* ucommon::DirPager::operator[] ( unsigned  item)
inline

Return specified filename from directory list.

This is a convenience operator.

Parameters
itemto access.
Returns
text of item or NULL if invalid.

Reimplemented from ucommon::stringpager.

Definition at line 586 of file memory.h.


The documentation for this class was generated from the following file: