commore  1.0.6-SNAPSHOT
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
commore::Directory Class Reference

#include <Directory.h>

+ Inheritance diagram for commore::Directory:

Public Member Functions

 Directory (const char *path)
 
 Directory (const AString &path)
 
 Directory (const AString &p0, const AString &p1, const AString &p2="", const AString &p3="", const AString &p4="", const AString &p5="", const AString &p6="", const AString &p7="")
 
bool exists () const
 
int get_files (ListPath &files, bool rec=false) const
 
int get_files (ListPath &files, const AString &pattern, bool rec=false) const
 
int get_files (ListPath &files, const AChar *pattern, bool rec=false) const
 
int get_files (ListPath &files, ListDirectory &dirs, bool rec=false) const
 
int get_directories (ListDirectory &dirs, bool rec=false) const
 
bool force_remove () const
 
bool force_empty () const
 
int delete_files (const AChar *pattern, bool rec=false) const
 
bool move_to (const AChar *dest) const
 
bool create () const
 
bool create (bool all_access) const
 
AString up ()
 
AString top () const
 
bool down (const AString &name)
 
void set_full_path ()
 
void set_current_dir ()
 
void set_temp_path (bool subdir=false)
 
DirectoryListener get_listener (bool all=false)
 
- Public Member Functions inherited from commore::AString
 AString (const AString &str)
 
 AString (const AString &str, size_t pos, size_t n=(size_t) npos)
 
 AString (const AChar *str, size_t n)
 
 AString (const AChar *str)
 
 AString (const Char *str)
 
 AString (size_t n, AChar c)
 
 AString (AChar c, size_t n)
 
 AString (const void *v, size_t n, size_t base=16)
 
AStringoperator= (const AString &str)
 
AStringoperator= (const AChar *str)
 
AStringoperator= (AChar c)
 
 operator const AChar * () const
 
bool operator== (const AString &str) const
 
bool operator== (const AChar *str) const
 
bool operator!= (const AString &str) const
 
bool operator!= (const AChar *str) const
 
bool operator< (const commore::AString &str) const
 
bool operator> (const commore::AString &str) const
 
AStringoperator+= (const AString &str)
 
AString operator+ (const AString &str) const
 
AStringoperator+= (const AChar *str)
 
AStringoperator+= (AChar c)
 
AStringappend (const AString &str)
 
AStringappend (const AString &str, size_t pos, size_t n)
 
AStringappend (const AChar *str, size_t n)
 
AStringappend (const AChar *str)
 
AStringappend (size_t n, AChar c)
 
bool validate_range (size_t pos, size_t *len) const
 
AStringassign (const AString &other)
 
AStringassign (const AString &str, size_t pos, size_t n)
 
AStringassign (const AChar *str, size_t n)
 
AStringassign (const AChar *str)
 
AStringassign (size_t n, AChar c)
 
void swap (AString &str)
 
void splice (AString &str)
 
AStringinsert (size_t pos1, const AString &str)
 
AStringinsert (size_t pos1, const AString &str, size_t pos2, size_t n)
 
AStringinsert (size_t pos, const AChar *str, size_t n)
 
AStringinsert (size_t pos, const AChar *str)
 
AStringinsert (size_t pos, size_t n, AChar c)
 
AStringclear ()
 
AStringerase (size_t pos=0, size_t n=(size_t) npos)
 
void Delete (size_t pos=0, size_t n=1)
 
AStringreplace (size_t pos1, size_t n, const AString &str)
 
AStringreplace (size_t pos1, size_t n1, const AString &str, size_t pos2, size_t n2)
 
AStringreplace (size_t pos1, size_t n1, const AChar *str, size_t n2)
 
AStringreplace (size_t pos, size_t n1, const AChar *str)
 
AStringreplace (size_t pos, size_t n1, size_t n2, AChar c)
 
AStringreplace (const AChar *s1, const AChar *s2, bool case_sensitive=true)
 
AStringReplace (const AChar *s1, const AChar *s2, bool case_sensitive=true)
 
AChar operator[] (size_t pos) const
 
AChar & operator[] (size_t pos)
 
AChar operator[] (int pos) const
 
AChar & operator[] (int pos)
 
AChar at (size_t pos) const
 
AChar & at (size_t pos)
 
const AChar * c_str () const
 
const AChar * data () const
 
size_t size () const
 
size_t length () const
 
size_t max_size () const
 
bool is_empty () const
 
void resize (size_t n, AChar c)
 
void resize (size_t n)
 
void resize ()
 
size_t capacity () const
 Return size of allocated storage. More...
 
void reserve (size_t size)
 Request a change in capacity Requests that the string capacity be adapted to a planned change in size to a length of up to n characters. If n is greater than the current string capacity, the function causes the container to increase its capacity to n characters (or greater). In all other cases, it is taken as a non-binding request to shrink the string capacity: the container implementation is free to optimize otherwise and leave the string with a capacity greater than n. This function has no effect on the string length and cannot alter its content. More...
 
char * set_buffer (size_t size)
 
size_t copy (AChar *str, size_t n, size_t pos=0) const
 Copy sequence of characters from string Copies a substring of the current value of the string object into the array pointed by s. This substring contains the len characters that start at position pos. The function does not append a null character at the end of the copied content. More...
 
size_t find (const AString &str, size_t pos=0) const
 Find content in string Searches the string for the first occurrence of the sequence specified by its arguments. When pos is specified, the search only includes characters at or after position pos, ignoring any possible occurrences that include characters before pos. Notice that unlike member find_first_of, whenever more than one character is being searched for, it is not enough that just one of these characters match, but the entire sequence must match. More...
 
size_t find (const AChar *s, size_t pos, size_t n) const
 
size_t find (const AChar *str, size_t pos=0) const
 
size_t find (AChar c, size_t pos=0) const
 
size_t find_first_of (const AString &str, size_t pos=0) const
 
size_t find_first_of (const AChar *s, size_t pos, size_t n) const
 
size_t find_first_of (const AChar *str, size_t pos=0) const
 
size_t find_first_of (AChar c, size_t pos=0) const
 
size_t find_first_not_of (const AString &str, size_t pos=0) const
 
size_t find_first_not_of (const AChar *s, size_t pos, size_t n) const
 
size_t find_first_not_of (AChar c, size_t pos=0) const
 
size_t find_first_not_of (const AChar *str, size_t pos=0) const
 
size_t rfind (const AChar *str, size_t pos, size_t n) const
 
size_t find_last_of (const AChar *s, size_t pos, size_t n) const
 
size_t find_last_not_of (const AChar *s, size_t pos, size_t n) const
 
size_t rfind (const AString &str, size_t pos=(size_t) npos) const
 
size_t rfind (const AChar *str, size_t pos=(size_t) npos) const
 
size_t rfind (AChar c, size_t pos=(size_t) npos) const
 
size_t find_last_of (const AString &str, size_t pos=(size_t) npos) const
 
size_t find_last_of (AChar c, size_t pos=(size_t) npos) const
 
size_t find_last_of (const AChar *str, size_t pos=(size_t) npos) const
 
size_t find_last_not_of (const AString &str, size_t pos=(size_t) npos) const
 
size_t find_last_not_of (const AChar &c, size_t pos=(size_t) npos) const
 
size_t find_last_not_of (const AChar *str, size_t pos=(size_t) npos) const
 
AString substr (size_t pos=0, size_t n=(size_t) npos) const
 Generate substring Returns a newly constructed string object with its value initialized to a copy of a substring of this object. The substring is the portion of the object that starts at character position pos and spans len characters (or until the end of the string, whichever comes first). More...
 
Int to_int () const
 
bool match (const AString &pattern) const
 
bool match (const AString &pattern, AString &a0) const
 
bool match (const AString &pattern, AString &a0, AString &a1) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2, AString &a3) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2, AString &a3, AString &a4) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2, AString &a3, AString &a4, AString &a5) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2, AString &a3, AString &a4, AString &a5, AString &a6) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2, AString &a3, AString &a4, AString &a5, AString &a6, AString &a7) const
 
long write_xml (OBStream &o) const
 
long read_xml (IBStream &i)
 
int compare (const AString &str) const
 Compare string. More...
 
int compare (size_t pos, size_t n, const AString &str) const
 
int compare (size_t pos1, size_t n1, const AString &str, size_t pos2, size_t n2) const
 
int compare (const AChar *s) const
 
int compare (size_t pos, size_t n1, const AChar *str, size_t n2=(size_t) npos) const
 
int icompare (const AString &str) const
 Compare string but do not care caracter case (acii charecter only)
 
int icompare (size_t pos, size_t n, const AString &str) const
 
int icompare (size_t pos1, size_t n1, const AString &str, size_t pos2, size_t n2) const
 
int icompare (const AChar *s) const
 
int icompare (size_t pos, size_t n1, const AChar *str, size_t n2=(size_t) npos) const
 
int CompareNoCase (const AChar *s) const
 
AStringmake_upper ()
 
AStringMakeUpper ()
 
AStringmake_lower ()
 
AStringMakeLower ()
 

Static Public Member Functions

static bool force_remove (const AString &path)
 
static bool force_empty (const AString &path)
 
static bool create (const AString &path)
 
static bool exists (const AString &path)
 
- Static Public Member Functions inherited from commore::AString
static AChar eos ()
 
static int compare (const AChar *s1, const AChar *s2, size_t n)
 
static int icompare (const AChar *s1, const AChar *s2, size_t n)
 
static const AChar * find (const AChar *s, int n, const AChar &a)
 
static size_t length (const AChar *s)
 
static AChar * copy (AChar *dest, const AChar *src, size_t n)
 
static AChar * move (AChar *dest, const AChar *src, size_t n)
 
static AChar * assign (AChar *dest, size_t n, const AChar &c)
 
static void assign (AChar &c1, const AChar &c2)
 
static bool eq (const AChar &c1, const AChar &c2)
 
static bool ne (const AChar &c1, const AChar &c2)
 
static bool lt (const AChar &c1, const AChar &c2)
 
static bool ieq (const AChar &c1, const AChar &c2)
 
static bool ine (const AChar &c1, const AChar &c2)
 
static bool ilt (const AChar &c1, const AChar &c2)
 

Friends

class Path
 

Additional Inherited Members

- Public Types inherited from commore::AString
enum  { STRING_INCREMENT_SIZE = 16 }
 
typedef AChar value_type
 
typedef size_t size_type
 
typedef AChar & reference
 
typedef const AChar & const_reference
 
typedef AChar * pointer
 
typedef const AChar * const_pointer
 

Detailed Description

The Directory class shares almost all of the same properties as the Path class, except that they operate on directories not files. The Directory object represents a physical directory on a disk. It also provides instance methods for the delete, create new directory and sub directories.

Constructor & Destructor Documentation

commore::Directory::Directory ( const char *  path)

Builld a directory path

Parameters
path
pNsubdirectory part of path

Member Function Documentation

bool commore::Directory::create ( ) const

Create a directory with specified path

Parameters
all_access(do not set any access restriction)
int commore::Directory::delete_files ( const AChar *  pattern,
bool  rec = false 
) const

Delete files in directory that match pattern

Parameters
pattern
recif true recursive
Returns
number of file deleted
bool commore::Directory::down ( const AString name)

Change directory path down one step in directory tree

Returns
true if succeed
bool commore::Directory::exists ( ) const
Returns
true if directory exists
bool commore::Directory::force_empty ( ) const

Force remove a directory content. Remove also sub directory.

Returns
true if succeed
bool commore::Directory::force_remove ( ) const

Force remove a directory and its content even if not empty. Remove also sub directory.

Returns
true if succeed
static bool commore::Directory::force_remove ( const AString path)
static

Static version

int commore::Directory::get_directories ( ListDirectory dirs,
bool  rec = false 
) const

Get paths of directories in the directory

Parameters
dirslist of directories to be filled
recif true recursive
int commore::Directory::get_files ( ListPath files,
bool  rec = false 
) const

Get paths of files in the directory

Parameters
files
recif true recursive
int commore::Directory::get_files ( ListPath files,
const AString pattern,
bool  rec = false 
) const

Get paths of files in the directory that match with pattern

Parameters
files
pattern
recif true recursive
int commore::Directory::get_files ( ListPath files,
ListDirectory dirs,
bool  rec = false 
) const

Get paths of files and directories in the directory

Parameters
files
dirs
recif true recursive
DirectoryListener commore::Directory::get_listener ( bool  all = false)

Create a listener on directory

Parameters
allListener argument
Returns
a DirectoryListener
bool commore::Directory::move_to ( const AChar *  dest) const

Move directory to new path

Returns
true if succeed
void commore::Directory::set_current_dir ( )

Set to current directory

void commore::Directory::set_full_path ( )

Retrieves the full path and filename of a specified file. merges the name of the current drive and directory with the specified filename to determine the full path and filename of the specified file. It also calculates the address of the filename portion of the full path and filename. This function does not verify that the resulting path and filename are valid or that they refer to an existing file on the associated volume.

void commore::Directory::set_temp_path ( bool  subdir = false)

Compute a temporary dir path Return the system user default temp dir subdir : if true force a unique subdir name

AString commore::Directory::top ( ) const
Returns
top directory
AString commore::Directory::up ( )

Change directory path up one step in directory tree

Returns
top directory

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