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

#include <Path.h>

+ Inheritance diagram for commore::FileLock:

Public Member Functions

 FileLock ()
 
 FileLock (const AChar *file_path)
 
FileLockoperator= (const AChar *file_path)
 
 ~FileLock ()
 
bool lock ()
 
bool wait_lock ()
 
void unlock ()
 
- Public Member Functions inherited from commore::Path
 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

File lock helper

Constructor & Destructor Documentation

FileLock::FileLock ( )
FileLock::FileLock ( const AChar file_path)
Parameters
file_path
FileLock::~FileLock ( )
Remarks
lock is released

Member Function Documentation

bool FileLock::lock ( )

Lock file

Returns
true if succeed
Remarks
does not wait if the lock is already taken
FileLock & FileLock::operator= ( const AChar file_path)
void FileLock::unlock ( )

Release lock

bool FileLock::wait_lock ( )

Lock file, wait until lock is free

Returns
true if succeed

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