UCommon
ucommon::DirPager Class Reference

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

#include <memory.h>

Inheritance diagram for ucommon::DirPager:
Collaboration diagram for ucommon::DirPager:

Public Member Functions

void assign (DirPager &source)
 Assign foreign pager to us.
 
const char * at (unsigned item) const
 
unsigned count (void) const
 
 DirPager (const char *path)
 
const char * get (unsigned item) const
 
 operator bool () const
 
bool operator! () const
 
const char * operator* () const
 
void operator= (const char *path)
 
const char * operator[] (unsigned item) const
 Return specified filename from directory list.
 
unsigned pages (void) const
 
size_t size (void) const
 

Protected Member Functions

virtual bool filter (char *filename, size_t size)
 Filter filenames in a derived class.
 
bool load (const char *path)
 Load a directory path.
 
- Protected Member Functions inherited from ucommon::StringPager
void add (char **list)
 Add list to list.
 
void add (const char *text)
 Add text to list.
 
void assign (StringPager &source)
 Assign foreign pager to us.
 
const char * at (unsigned item) const
 
StringPager::memberbegin (void) const
 Get root of pager list.
 
void clear (void)
 Purge all members and release pager member.
 
unsigned count (void) const
 Get the number of items in the pager string list.
 
const char * get (unsigned item) const
 Get string item from list.
 
String join (const char *prefix=NULL, const char *middle=NULL, const char *suffix=NULL)
 
char ** list (void)
 Gather index list.
 
 operator bool () const
 
 operator char ** ()
 
bool operator! () const
 
const char * operator* ()
 
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 * operator[] (unsigned item) const
 Return specified member from pager list.
 
unsigned pages (void) const
 
const char * pop (void)
 Remove element from back of list.
 
const char * pull (void)
 Remove element from front of list.
 
void push (char **text)
 Add text list to front of list.
 
void push (const char *text)
 Add text to front of list.
 
void set (char **list)
 Set list to list.
 
void set (unsigned item, const char *string)
 Replace string item in list.
 
size_t size (void) const
 
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 (char **list, size_t pagesize=256)
 
 StringPager (size_t pagesize=256)
 Create a pager with a maximum page size.
 
unsigned 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.
 
- Protected Member Functions inherited from ucommon::memalloc
virtual void * _alloc (size_t size)
 Allocate memory from the pager heap.
 
page_t * pager (void)
 Acquire a new page from the heap.
 
void assign (memalloc &source)
 Assign foreign pager to us.
 
unsigned max (void) const
 Get the maximum number of pages that are permitted.
 
 memalloc (const memalloc &copy)
 
 memalloc (size_t page=0)
 Construct a memory pager.
 
unsigned pages (void) const
 Get the number of pages that have been allocated from the real heap.
 
void purge (void)
 Purge all allocated memory and heap pages immediately.
 
size_t size (void) const
 Get the size of a memory page.
 
unsigned utilization (void) const
 Determine fragmentation level of acquired heap pages.
 
virtual ~memalloc ()
 Destroy a memory pager.
 

Protected Attributes

const char * dir
 
- Protected Attributes inherited from ucommon::memalloc
unsigned limit
 

Additional Inherited Members

- Protected Types inherited from ucommon::StringPager
typedef linked_pointer< StringPager::memberiterator
 Convenience typedef for iterative pointer.
 

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 653 of file memory.h.

Member Function Documentation

◆ assign()

void ucommon::DirPager::assign ( DirPager & source)

Assign foreign pager to us.

This relocates the heap references to our object, clears the other object.

◆ at()

const char * ucommon::DirPager::at ( unsigned item) const
inline

Definition at line 714 of file memory.h.

◆ count()

unsigned ucommon::DirPager::count ( void ) const
inline

Definition at line 696 of file memory.h.

◆ filter()

virtual bool ucommon::DirPager::filter ( char * filename,
size_t size )
protectedvirtual

Filter filenames in a derived class.

The default filter drops "." special files.

Parameters
filenameto filter.
sizeof filename buffer.
Returns
true if include in final list.

Reimplemented from ucommon::StringPager.

◆ get()

const char * ucommon::DirPager::get ( unsigned item) const
inline

Definition at line 710 of file memory.h.

◆ load()

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

Load a directory path.

Parameters
pathto load.
Returns
true if valid.

◆ operator bool()

ucommon::DirPager::operator bool ( ) const
inline

Definition at line 688 of file memory.h.

◆ operator!()

bool ucommon::DirPager::operator! ( ) const
inline

Definition at line 692 of file memory.h.

◆ operator*()

const char * ucommon::DirPager::operator* ( ) const
inline

Definition at line 684 of file memory.h.

◆ operator[]()

const char * ucommon::DirPager::operator[] ( unsigned item) const
inline

Return specified filename from directory list.

This is a convenience operator.

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

Definition at line 706 of file memory.h.

◆ pages()

unsigned ucommon::DirPager::pages ( void ) const
inline

Definition at line 722 of file memory.h.

◆ size()

size_t ucommon::DirPager::size ( void ) const
inline

Definition at line 718 of file memory.h.

Field Documentation

◆ dir

const char* ucommon::DirPager::dir
protected

Definition at line 659 of file memory.h.


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