commore  1.0.6-SNAPSHOT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
commore::Path Class Reference

#include <Path.h>

+ Inheritance diagram for commore::Path:

Public Member Functions

 Path ()
 
 Path (const AChar *path)
 
 Path (const AChar *p0, const AChar *p1, const AChar *p2="", const AChar *p3="", const AChar *p4="", const AChar *p5="", const AChar *p6="", const AChar *p7="")
 
 operator const AChar * () const
 
void set (const AChar *unc_host_name, const AChar *drive_name, const AChar *dir, const AChar *base, const AChar *ext)
 
void get (AString &unc_host_name, AString &drive_name, AString &dir, AString &base, AString &ext)
 
AString get_extension () const
 
AString get_base () const
 
AString get_file_name () const
 
AString get_directory () const
 
AString get_path () const
 
AString get_unc_host () const
 
AString get_drive () const
 
AString up ()
 
AString top () const
 
AString get_relative_path (const AString &path) const
 
bool down (const AString &name)
 
void set_full_path ()
 
bool is_valid () const
 
bool is_unc () const
 
bool has_drive () const
 
bool has_extension (const AString &ext) const
 
bool check_extension (const AChar *ext) const
 
bool check_base (const AChar *ext) const
 
bool check_file_name (const AChar *ext) const
 
bool check_directory (const AChar *ext) const
 
bool check_path (const AChar *ext) const
 
bool check_unc (const AChar *ext) const
 
bool check_drive (const AChar *ext) const
 
void set_extension (const AString &extension)
 
void set_base (const AString &base)
 
void set_file_name (const AString &fileName)
 
void set_directory (const AString &directory)
 
void set_path (const AString &path)
 
void set_unc_host (const AString &hostName)
 
void set_drive (const AString &drive)
 
void set_temp_path (const AChar *extension="tmp")
 
bool exists () const
 
bool delete_file (bool force=true) const
 
bool move_file (const Path &new_path) const
 
bool move_file (const Path &new_path, bool silent) const
 
bool copy_to_file (const Path &dest_path) const
 
bool set_read_only (bool read_only) const
 
bool is_read_only () const
 
bool is_directory () const
 
bool lock_file (bool lock=true) const
 
size_t get_size () const
 
TimeDate get_last_modif_time () const
 
- Public Member Functions inherited from commore::AString
 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
 
 ~AString ()
 
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
 
ACharoperator[] (size_t pos)
 
AChar operator[] (int pos) const
 
ACharoperator[] (int pos)
 
AChar at (size_t pos) const
 
ACharat (size_t pos)
 
const ACharc_str () const
 
const AChardata () 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) More...
 
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 ()
 

Additional Inherited Members

- Public Types inherited from commore::AString
enum  { STRING_INCREMENT_SIZE = 16 }
 
typedef AChar value_type
 
typedef size_t size_type
 
typedef ACharreference
 
typedef const ACharconst_reference
 
typedef ACharpointer
 
typedef const ACharconst_pointer
 
- 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 ACharfind (const AChar *s, int n, const AChar &a)
 
static size_t length (const AChar *s)
 
static ACharcopy (AChar *dest, const AChar *src, size_t n)
 
static ACharmove (AChar *dest, const AChar *src, size_t n)
 
static ACharassign (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)
 

Detailed Description

Manage file path

Constructor & Destructor Documentation

commore::Path::Path ( )
inline
commore::Path::Path ( const AChar path)
inline
Parameters
pathof a file
Path::Path ( const AChar p0,
const AChar p1,
const AChar p2 = "",
const AChar p3 = "",
const AChar p4 = "",
const AChar p5 = "",
const AChar p6 = "",
const AChar p7 = "" 
)
Parameters
pNa directory part of the path

Member Function Documentation

bool commore::Path::check_base ( const AChar ext) const
Returns
true if base match with ext
bool commore::Path::check_directory ( const AChar ext) const
Returns
true if directory match with ext
bool commore::Path::check_drive ( const AChar ext) const
Returns
true if drive match with ext
bool commore::Path::check_extension ( const AChar ext) const
Returns
true if extension match with ext
bool commore::Path::check_file_name ( const AChar ext) const
Returns
true if file name match with ext
bool commore::Path::check_path ( const AChar ext) const
Returns
true if path match with ext
bool commore::Path::check_unc ( const AChar ext) const
Returns
true if unc match with ext
bool commore::Path::copy_to_file ( const Path dest_path) const

Copy file (if exists) to dest path

Returns
true if succeed
bool commore::Path::delete_file ( bool  force = true) const

Delete the file force : force read only attribute

Returns
true if succeed
bool commore::Path::down ( const AString name)

Change directory path down one step in directory tree

Returns
true if ok
bool commore::Path::exists ( ) const
Returns
true if file exists and it is not a directory
void commore::Path::get ( AString unc_host_name,
AString drive_name,
AString dir,
AString base,
AString ext 
)

Decompose the path components

Parameters
unc_host_name
drive_name
dir
base
ext
AString commore::Path::get_base ( ) const
Returns
base file name (no extension)
AString commore::Path::get_directory ( ) const
Returns
directory path (no unc host no drive)
AString commore::Path::get_drive ( ) const
Returns
drive name
AString commore::Path::get_extension ( ) const
Returns
file extension
AString commore::Path::get_file_name ( ) const
Returns
file name (no directory path, base_name + extension)
TimeDate Path::get_last_modif_time ( ) const
Returns
file last modif time
Remarks
return undetermined if file does not exist
AString commore::Path::get_path ( ) const
Returns
unc host or drive + directory path
AString commore::Path::get_relative_path ( const AString path) const
Returns
the relative path
size_t Path::get_size ( ) const
Returns
file size
Remarks
return 0 if file does not exist
AString commore::Path::get_unc_host ( ) const
Returns
unc host name
bool commore::Path::has_drive ( ) const
Returns
true if path has an drive spec
bool commore::Path::has_extension ( const AString ext) const
Returns
true if extension match with ext
bool commore::Path::is_directory ( ) const
Returns
true if path is a directory path
bool commore::Path::is_read_only ( ) const
Returns
true if attribute read only is set
bool commore::Path::is_unc ( ) const
Returns
true if path has an unc format
bool commore::Path::is_valid ( ) const
Returns
true if the syntax file name is ok
Remarks
Does not check if file exists!
bool commore::Path::lock_file ( bool  lock = true) const

Set or release file lock

Parameters
lock
Returns
true if succeed
bool commore::Path::move_file ( const Path new_path) const

Move file (if exists) to new path

Parameters
new_pathnew path of current file
Returns
true if succeed
bool commore::Path::move_file ( const Path new_path,
bool  silent 
) const

Move file (if exists) to new path

Parameters
new_pathnew path of current file
silentif true does not emit error log message
Returns
true if succeed
commore::Path::operator const AChar * ( ) const
inline
Returns
null terminated string that represent the path
void commore::Path::set ( const AChar unc_host_name,
const AChar drive_name,
const AChar dir,
const AChar base,
const AChar ext 
)

Build path with its component

Parameters
unc_host_name
drive_name
dir
base
ext
void commore::Path::set_base ( const AString base)

Set path extension

void commore::Path::set_directory ( const AString directory)

Set path file name

void commore::Path::set_drive ( const AString drive)

Set path drive

void commore::Path::set_extension ( const AString extension)

Set path extension

void commore::Path::set_file_name ( const AString fileName)

Set path file base name

void commore::Path::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::Path::set_path ( const AString path)

Set path directory

bool commore::Path::set_read_only ( bool  read_only) const

Set file attribute (if exists) to read only

void commore::Path::set_temp_path ( const AChar extension = "tmp")

Compute a temporary file path with spcified extension Use the system user default temp dir

void commore::Path::set_unc_host ( const AString hostName)

Set path unc host name

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

Change directory path up one step in directory tree

Returns
top directory

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