User Documentation
RAVL, Recognition And Vision Library
DEVELOP HOME PAGE CLASS LIST CONTENTS
Ravl - OS - File System - DirectoryC
 

  PUBLIC
DirectoryC::DirectoryC(const StringC &)
DirectoryC::DirectoryC(const DirectoryC &)
DirectoryC::Create(const FilePermissionC &) const
DirectoryC::IsValid(void) const
DirectoryC::List(void) const
DirectoryC::List(const StringC &,const StringC &) const
DirectoryC::FiltList(const StringC &) const
DirectoryC::Copy(const FilenameC &,bool,bool,bool,bool)
FilenameC::MakeDir(const FilePermissionC &) const
FilenameC::Exists(void) const
FilenameC::Rename(const StringC &) const
FilenameC::IsReadable(void) const
FilenameC::IsWritable(void) const
FilenameC::IsDirectory(void) const
FilenameC::IsFifo(void) const
FilenameC::IsRegular(void) const
FilenameC::Permissions(void) const
FilenameC::SetPermissions(const FilePermissionC &)
FilenameC::PathComponent(void) const
FilenameC::NameComponent(void) const
FilenameC::BaseNameComponent(void) const
FilenameC::MkTemp(IntT,IntT) const
FilenameC::LastAccessTime(void) const
FilenameC::LastModTime(void) const
FilenameC::LastStatusModTime(void) const
FilenameC::FileSize(void) const
FilenameC::Remove(void) const
FilenameC::OwnerInfo(void) const
FilenameC::CopyTo(const FilenameC &) const
FilenameC::BinCompare(const FilenameC &) const
FilenameC::Absolute(bool) const
FilenameC::SetAMDPrefix(StringC)
FilenameC::HasExtension(StringC,bool) const
FilenameC::Extension(void) const
FilenameC::Search(StringC) const
FilenameC::Search(const DListC &) const
FilenameC::operator =(const FilenameC &)
FilenameC::operator =(const StringC &)
FilenameC::operator =(const SubStringC &)
FilenameC::operator =(const char *)
StringC::Copy(void) const
StringC::Hash(void) const
StringC::operator =(const StringC &)
StringC::operator =(const char *)
StringC::operator =(char)
StringC::operator =(const SubStringC &)
StringC::operator +=(const StringC &)
StringC::operator +=(const SubStringC &)
StringC::operator +=(const char *)
StringC::operator +=(char)
StringC::prepend(const StringC &)
StringC::prepend(const SubStringC &)
StringC::prepend(const char *)
StringC::prepend(char)
StringC::index(char,int) const
StringC::index(const StringC &,int) const
StringC::index(const SubStringC &,int) const
StringC::index(const char *,int) const
StringC::index(const Regex &,int) const
StringC::contains(char) const
StringC::contains(const StringC &) const
StringC::contains(const SubStringC &) const
StringC::contains(const char *) const
StringC::contains(char,int) const
StringC::contains(const StringC &,int) const
StringC::contains(const SubStringC &,int) const
StringC::contains(const char *,int) const
StringC::contains(const Regex &) const
StringC::contains(const Regex &,int) const
StringC::matches(char,int) const
StringC::matches(const StringC &,int) const
StringC::matches(const SubStringC &,int) const
StringC::matches(const char *,int) const
StringC::matches(const Regex &,int) const
StringC::CaseCmp(const StringC &) const
StringC::freq(char) const
StringC::freq(const StringC &) const
StringC::freq(const SubStringC &) const
StringC::freq(const char *) const
StringC::at(int,int)
StringC::operator ()(int,int)
StringC::at(const StringC &,int)
StringC::at(const SubStringC &,int)
StringC::at(const char *,int)
StringC::at(char,int)
StringC::at(const Regex &,int)
StringC::before(int)
StringC::before(const StringC &,int)
StringC::before(const SubStringC &,int)
StringC::before(const char *,int)
StringC::before(char,int)
StringC::before(const Regex &,int)
StringC::through(int)
StringC::through(const StringC &,int)
StringC::through(const SubStringC &,int)
StringC::through(const char *,int)
StringC::through(char,int)
StringC::through(const Regex &,int)
StringC::from(int)
StringC::from(const StringC &,int)
StringC::from(const SubStringC &,int)
StringC::from(const char *,int)
StringC::from(char,int)
StringC::from(const Regex &,int)
StringC::after(int)
StringC::after(const StringC &,int)
StringC::after(const SubStringC &,int)
StringC::after(const char *,int)
StringC::after(char,int)
StringC::after(const Regex &,int)
StringC::del(int,int)
StringC::del(const StringC &,int)
StringC::del(const SubStringC &,int)
StringC::del(const char *,int)
StringC::del(char,int)
StringC::del(const Regex &,int)
StringC::gsub(const StringC &,const StringC &)
StringC::gsub(const SubStringC &,const StringC &)
StringC::gsub(const char *,const StringC &)
StringC::gsub(const char *,const char *)
StringC::gsub(const Regex &,const StringC &)
StringC::split(const StringC &,StringC,int,const StringC &)
StringC::split(const StringC &,StringC,int,const Regex &)
StringC::common_prefix(const StringC &,const StringC &,int)
StringC::common_suffix(const StringC &,const StringC &,int)
StringC::StrCreplicate(char,int)
StringC::StrCreplicate(const StringC &,int)
StringC::StrCreplicateStrC(const StringC &,int)
StringC::join(StringC,int,const StringC &)
StringC::reverse(const StringC &)
StringC::upcase(const StringC &)
StringC::downcase(const StringC &)
StringC::capitalize(const StringC &)
StringC::reverse(void)
StringC::upcase(void)
StringC::downcase(void)
StringC::capitalize(void)
StringC::operator [](UIntT)
StringC::operator [](UIntT) const
StringC::operator [](IndexC)
StringC::operator [](IndexC) const
StringC::operator [](int)
StringC::operator [](int) const
StringC::elem(int) const
StringC::firstchar(void) const
StringC::lastchar(void) const
StringC::operator const char *(void) const
StringC::chars(void) const
StringC::operator <<(ostream &,const StringC &)
StringC::operator <<(ostream &,const SubStringC &)
StringC::operator >>(istream &,StringC &)
StringC::operator >>(BinIStreamC &,StringC &)
StringC::readline(istream &,StringC &,char,int)
StringC::length(void) const
StringC::empty(void) const
StringC::IsEmpty(void) const
StringC::alloc(int)
StringC::allocation(void) const
StringC::Size(void) const
StringC::OK(void) const
StringC::TopAndTail(void) const
StringC::IntValue(void) const
StringC::RealValue(void) const
StringC::cat(const StringC &,const StringC &,StringC &)
StringC::cat(const StringC &,const SubStringC &,StringC &)
StringC::cat(const StringC &,const char *,StringC &)
StringC::cat(const StringC &,char,StringC &)
StringC::cat(const SubStringC &,const StringC &,StringC &)
StringC::cat(const SubStringC &,const SubStringC &,StringC &)
StringC::cat(const SubStringC &,const char *,StringC &)
StringC::cat(const SubStringC &,char,StringC &)
StringC::cat(const char *,const StringC &,StringC &)
StringC::cat(const char *,const SubStringC &,StringC &)
StringC::cat(const char *,const char *,StringC &)
StringC::cat(const char *,char,StringC &)
StringC::cat(const StringC &,const StringC &,const StringC &,StringC &)
StringC::cat(const StringC &,const StringC &,const SubStringC &,StringC &)
StringC::cat(const StringC &,const StringC &,const char *,StringC &)
StringC::cat(const StringC &,const StringC &,char,StringC &)
StringC::cat(const StringC &,const SubStringC &,const StringC &,StringC &)
StringC::cat(const StringC &,const SubStringC &,const SubStringC &,StringC &)
StringC::cat(const StringC &,const SubStringC &,const char *,StringC &)
StringC::cat(const StringC &,const SubStringC &,char,StringC &)
StringC::cat(const StringC &,const char *,const StringC &,StringC &)
StringC::cat(const StringC &,const char *,const SubStringC &,StringC &)
StringC::cat(const StringC &,const char *,const char *,StringC &)
StringC::cat(const StringC &,const char *,char,StringC &)
StringC::cat(const char *,const StringC &,const StringC &,StringC &)
StringC::cat(const char *,const StringC &,const SubStringC &,StringC &)
StringC::cat(const char *,const StringC &,const char *,StringC &)
StringC::cat(const char *,const StringC &,char,StringC &)
StringC::cat(const char *,const SubStringC &,const StringC &,StringC &)
StringC::cat(const char *,const SubStringC &,const SubStringC &,StringC &)
StringC::cat(const char *,const SubStringC &,const char *,StringC &)
StringC::cat(const char *,const SubStringC &,char,StringC &)
StringC::cat(const char *,const char *,const StringC &,StringC &)
StringC::cat(const char *,const char *,const SubStringC &,StringC &)
StringC::cat(const char *,const char *,const char *,StringC &)
StringC::cat(const char *,const char *,char,StringC &)

   DirectoryC   
 
Directory handling.
 
include "Ravl/OS/Directory.hh"
Created:07/05/98 
User Level:Normal
Library:RavlOS
In Scope:RavlN

Comments:
Used for querying and changing the contents of directories.

The class is designed to be thread safe where different instances of DirectoryC are used simulatiously and between 'const' methods of this class.

Parent Classes: Methods:
DirectoryC(const StringC & name = StringC ("."))
Construct from a string.

DirectoryC(const DirectoryC & name)
Copy constructor.

bool Create(const FilePermissionC & Acc = FilePermissionC ()) const
Create a directory by this name.

bool IsValid() const
Is this really a directory ?

DListC<StringC> List() const
List contents of directory.
Will return an empty list if anything goes wrong. Gives names of contents relative to this directory , without any leading or trailing "/"

'..' and '.' are not returned in the list.


DListC<StringC> List(const StringC & pre,const StringC & post) const
List contents of directory, returning only files with the given prefix and postfix.
Either (or both) pre and post maybe empty strings.. '..' and '.' are not returned in the list.

Will return an empty list if anything goes wrong.


DListC<StringC> FiltList(const StringC & filter) const
List contents of directory, returning only files matching the given filter.
'..' and '.' are not returned in the list.

bool Copy(const FilenameC & othDir,bool rec = true,bool lazy = false,bool sync = false,bool verb = false)
Copy all files in this directory into 'othDir'.
This will make 'othDir' if necessary. When 'rec' is true it will do so recursively, if false subdirectories will be ignored. If othDir is an empty string the currect directory is used.

if lazy is true, files are only updated if they have a later date than the target.

if sync is true, all files that are not in the source directory are removed.



#include "Ravl/OS/Filename.hh"
bool MakeDir(const FilePermissionC & Acc = FilePermissionC ()) const
Make a directory with this name.
Return: true = Directory created ok.

bool Exists() const
Test if the file/directory given in this path exists.
Return: true = File does exist.

bool Rename(const StringC & newname) const
Rename file.
This does NOT change the value of this filename. Ret true=Succeeded.

bool IsReadable() const
Test if the file/directory is readable by this process.
Return: true = It can be read.

bool IsWritable() const
Test if the file/directory is writable by this process.
Return: true = It can be written to.

bool IsDirectory() const
Test if the this is a directory.
Return: true = Yep.

bool IsFifo() const
Test if the this is a pipe
Return: true = Yep.

bool IsRegular() const
Test if the this is a regular file ?
Return: true = Yep.

FilePermissionC Permissions() const
Get the access permisions for this file.
Returns no-permisions if file is not found.

bool SetPermissions(const FilePermissionC & perm)
Set the access permisions for this file.
Returns false if failed.

FilenameC PathComponent() const
Return the path component of a Filename, ie. upto last /

FilenameC NameComponent() const
Return the name component of a Filename, ie. after last /

FilenameC BaseNameComponent() const
Return the base name component of a Filename,
ie. after last / and before the extention. (the last '.' in the NameComponent()).

FilenameC MkTemp(IntT Digits = 4,IntT maxretry = 100) const
Make this filename unique by appending a unique string and checking if it doesn't exist already.
If it does try another, if process failes more than maxretry times, then an ExceptionOperationFailedC is thrown If maxretry is negative infinite retries are alowed. Digits should be betwee 0 and 6.

DateC LastAccessTime() const
Get last file access.

DateC LastModTime() const
Get last modification time.

DateC LastStatusModTime() const
Get last status modification time.

StreamSizeT FileSize() const
Get size of file.
Return 0 if file's not found.

bool Remove() const
Remove this file.

UserInfoC OwnerInfo() const
Get information on owner of file.

bool CopyTo(const FilenameC & oth) const
Copy this file to somewhere else.

bool BinCompare(const FilenameC & oth) const
Are two files identical. byte wise comparison.

FilenameC Absolute(bool removeAMD = true) const
Make an absolute path.
If removeAMD is true, any automount prefix will also be remove from the path.

static void SetAMDPrefix(StringC prefix)
Set the AMD prefix.

bool HasExtension(StringC ext,bool caseSens = false) const
Test if filename has the given extention.
caseSens = false means case is ignored.

StringC Extension() const
Get the extention on the file name.
That is the text after the last '.' in the name component. Returns empty string if none found.

FilenameC Search(StringC pathList) const
Search through ':' seperated list pathList of deriectories for this filename.
Returns this filename if is not found on path.

FilenameC Search(const DListC<StringC> & pathList) const
Search through a list of paths for this file.
Returns this filename if is not found on path. Usefull for searching through the 'PATH' enviroment variable.

const FilenameC & operator =(const FilenameC & s)
Assign from filename

const FilenameC & operator =(const StringC & s)
Assign from string.

const FilenameC & operator =(const SubStringC & s)
Assign from sub string

const FilenameC & operator =(const char * s)
Assign from char string.

Constructors, copies, assignment, and destructor

#include "Ravl/String.hh"
StringC Copy(void) const
Make a copy of this string.

unsigned int Hash(void) const
Create a hash value that is "fairly unique" for string.

StringC & operator =(const StringC & y)
Copy handle of string 'y'.

StringC & operator =(const char * t)
Assign a 'c' string to this string.

StringC & operator =(char c)
Assign a character to this string.

StringC & operator =(const SubStringC & y)
Assign a substring to this string.

StringC & operator +=(const StringC & y)
Copy string 'y' to the end of this one.

StringC & operator +=(const SubStringC & y)
Copy sub string 'y' to the end of this string.

StringC & operator +=(const char * t)
Copy 'C' style string 'y' to the end of this one.

StringC & operator +=(char c)
Copy character 'c' to the end of this string.

void prepend(const StringC & y)
Prepend string 'y' before this one.

void prepend(const SubStringC & y)
Prepend string 'y' before this one.

void prepend(const char * t)
Prepend 'C' style string 'y' before this one

void prepend(char c)
Prepend character 'c' to this string.

int index(char c,int startpos = 0) const
Return the index of the first occurance of 'c' in this string.
returns -1 on failure. The search starts from index 'startpos'.

int index(const StringC & y,int startpos = 0) const
Return the index of the first occurance of 'y' in this string.
returns -1 on failure. The search starts from index 'startpos'.

int index(const SubStringC & y,int startpos = 0) const
Return the index of the first occurance of 'y' in this string.
returns -1 on failure. The search starts from index 'startpos'.

int index(const char * t,int startpos = 0) const
Return the index of the first occurance of 'y' in this string.
returns -1 on failure. The search starts from index 'startpos'.

int index(const Regex & r,int startpos = 0) const
Return the index of the first occurance of 'y' in this string.
returns -1 on failure. The search starts from index 'startpos'.

int contains(char c) const
Returns 1 if this string contains the character 'c'.

int contains(const StringC & y) const
Returns 1 if this string contains the sub-string 'y'.

int contains(const SubStringC & y) const
Returns 1 if this string contains the sub-string 'y'.

int contains(const char * t) const
Returns 1 if this string contains the sub-string 't'.

int contains(char c,int pos) const
return 1 if target appears anywhere after position pos
(or before, if pos is negative) in StringC; else 0

int contains(const StringC & y,int pos) const
return 1 if target appears anywhere after position pos
(or before, if pos is negative) in StringC; else 0

int contains(const SubStringC & y,int pos) const
return 1 if target appears anywhere after position pos
(or before, if pos is negative) in StringC; else 0

int contains(const char * t,int pos) const
return 1 if target appears anywhere after position pos
(or before, if pos is negative) in StringC; else 0

int contains(const Regex & r) const
Returns 1 if this string contains the sub-string 'r'.

int contains(const Regex & r,int pos) const
return 1 if target appears anywhere after position pos
(or before, if pos is negative) in StringC; else 0

int matches(char c,int pos = 0) const
return 1 if target appears at position pos in StringC; else 0

int matches(const StringC & y,int pos = 0) const
return 1 if target appears at position pos in StringC; else 0

int matches(const SubStringC & y,int pos = 0) const
return 1 if target appears at position pos in StringC; else 0

int matches(const char * t,int pos = 0) const
return 1 if target appears at position pos in StringC; else 0

int matches(const Regex & r,int pos = 0) const
return 1 if target appears at position pos in StringC; else 0

int CaseCmp(const StringC & str) const
case-insensitive comparison of strings
(c.f. strcasecmp (3)) i.e. returns 0 if =, -1 if <, +1 if >.

int freq(char c) const
return number of occurences of target in StringC

int freq(const StringC & y) const
return number of occurences of target in StringC

int freq(const SubStringC & y) const
return number of occurences of target in StringC

int freq(const char * t) const
return number of occurences of target in StringC
SubStringC extraction Note that you can't take a substring of a const StringC, since this leaves open the possiblility of indirectly modifying the StringC through the SubStringC

SubStringC at(int pos,int len)

SubStringC operator ()(int pos,int len)
synonym for at

SubStringC at(const StringC & x,int startpos = 0)

SubStringC at(const SubStringC & x,int startpos = 0)

SubStringC at(const char * t,int startpos = 0)

SubStringC at(char c,int startpos = 0)

SubStringC at(const Regex & r,int startpos = 0)

SubStringC before(int pos)

SubStringC before(const StringC & x,int startpos = 0)

SubStringC before(const SubStringC & x,int startpos = 0)

SubStringC before(const char * t,int startpos = 0)

SubStringC before(char c,int startpos = 0)

SubStringC before(const Regex & r,int startpos = 0)

SubStringC through(int pos)

SubStringC through(const StringC & x,int startpos = 0)

SubStringC through(const SubStringC & x,int startpos = 0)

SubStringC through(const char * t,int startpos = 0)

SubStringC through(char c,int startpos = 0)

SubStringC through(const Regex & r,int startpos = 0)

SubStringC from(int pos)

SubStringC from(const StringC & x,int startpos = 0)

SubStringC from(const SubStringC & x,int startpos = 0)

SubStringC from(const char * t,int startpos = 0)

SubStringC from(char c,int startpos = 0)

SubStringC from(const Regex & r,int startpos = 0)

SubStringC after(int pos)

SubStringC after(const StringC & x,int startpos = 0)

SubStringC after(const SubStringC & x,int startpos = 0)

SubStringC after(const char * t,int startpos = 0)

SubStringC after(char c,int startpos = 0)

SubStringC after(const Regex & r,int startpos = 0)

void del(int pos,int len)
delete len chars starting at pos

void del(const StringC & y,int startpos = 0)
delete the first occurrence of target after startpos

void del(const SubStringC & y,int startpos = 0)
delete the first occurrence of target after startpos

void del(const char * t,int startpos = 0)
delete the first occurrence of target after startpos

void del(char c,int startpos = 0)
delete the first occurrence of target after startpos

void del(const Regex & r,int startpos = 0)
delete the first occurrence of target after startpos

int gsub(const StringC & pat,const StringC & repl)
global substitution: substitute all occurrences of pat with repl

int gsub(const SubStringC & pat,const StringC & repl)
global substitution: substitute all occurrences of pat with repl

int gsub(const char * pat,const StringC & repl)
global substitution: substitute all occurrences of pat with repl

int gsub(const char * pat,const char * repl)
global substitution: substitute all occurrences of pat with repl

int gsub(const Regex & pat,const StringC & repl)
global substitution: substitute all occurrences of pat with repl
friends & utilities split string into array res at separators; return number of elements

int split(const StringC & x,StringC res[],int maxn,const StringC & sep)

int split(const StringC & x,StringC res[],int maxn,const Regex & sep)

StringC common_prefix(const StringC & x,const StringC & y,int startpos = 0)

StringC common_suffix(const StringC & x,const StringC & y,int startpos = - 1)

StringC StrCreplicate(char c,int n)

StringC StrCreplicate(const StringC & y,int n)

StringC StrCreplicateStrC(const StringC & y,int n)

StringC join(StringC src[],int n,const StringC & sep)
simple builtin transformations

StringC reverse(const StringC & x)

StringC upcase(const StringC & x)

StringC downcase(const StringC & x)

StringC capitalize(const StringC & x)

void reverse()
Reverse order of characters in string, in place.

void upcase()
Convert all characters to upper case, in place.

void downcase()
Convert all characters to lower case, in place.

void capitalize()
Convert all characters to upper case, in place.

char & operator [](UIntT i)

const char & operator [](UIntT i) const

char & operator [](IndexC i)

const char & operator [](IndexC i) const

char & operator [](int i)

const char & operator [](int i) const

char elem(int i) const

char firstchar() const
Get the first character in the string.

char lastchar() const
Get the last character in the string.

operator const char *() const
Access as a 'C' sytle string.

const char * chars() const
Access as a 'C' sytle string.
IO

ostream & operator <<(ostream & s,const StringC & x)

ostream & operator <<(ostream & s,const SubStringC & x)

istream & operator >>(istream & s,StringC & x)

BinIStreamC & operator >>(BinIStreamC & s,StringC & x)

int readline(istream & s,StringC & x,char terminator = '\n',int discard_terminator = 1)
status

unsigned int length() const
Get length of string.

int empty() const
Test if string is empty.

bool IsEmpty() const
Test if the string is empty.

void alloc(int newsize)
Preallocate some space for StringC

int allocation() const
report current allocation (not length!)

SizeT Size() const
Get the length of this string.

int OK() const
Check it valid.

SubStringC TopAndTail() const
Remove while space from begining and end of string.

IntT IntValue() const
Interpret string as an integer.

RealT RealValue() const
Interpret string as a floating point value.

void cat(const StringC &,const StringC &,StringC &)

void cat(const StringC &,const SubStringC &,StringC &)

void cat(const StringC &,const char *,StringC &)

void cat(const StringC &,char,StringC &)

void cat(const SubStringC &,const StringC &,StringC &)

void cat(const SubStringC &,const SubStringC &,StringC &)

void cat(const SubStringC &,const char *,StringC &)

void cat(const SubStringC &,char,StringC &)

void cat(const char *,const StringC &,StringC &)

void cat(const char *,const SubStringC &,StringC &)

void cat(const char *,const char *,StringC &)

void cat(const char *,char,StringC &)
double concatenation, by request. (yes, there are too many versions, but if one is supported, then the others should be too...) Concatenate first 3 args, store in last arg

void cat(const StringC &,const StringC &,const StringC &,StringC &)

void cat(const StringC &,const StringC &,const SubStringC &,StringC &)

void cat(const StringC &,const StringC &,const char *,StringC &)

void cat(const StringC &,const StringC &,char,StringC &)

void cat(const StringC &,const SubStringC &,const StringC &,StringC &)

void cat(const StringC &,const SubStringC &,const SubStringC &,StringC &)

void cat(const StringC &,const SubStringC &,const char *,StringC &)

void cat(const StringC &,const SubStringC &,char,StringC &)

void cat(const StringC &,const char *,const StringC &,StringC &)

void cat(const StringC &,const char *,const SubStringC &,StringC &)

void cat(const StringC &,const char *,const char *,StringC &)

void cat(const StringC &,const char *,char,StringC &)

void cat(const char *,const StringC &,const StringC &,StringC &)

void cat(const char *,const StringC &,const SubStringC &,StringC &)

void cat(const char *,const StringC &,const char *,StringC &)

void cat(const char *,const StringC &,char,StringC &)

void cat(const char *,const SubStringC &,const StringC &,StringC &)

void cat(const char *,const SubStringC &,const SubStringC &,StringC &)

void cat(const char *,const SubStringC &,const char *,StringC &)

void cat(const char *,const SubStringC &,char,StringC &)

void cat(const char *,const char *,const StringC &,StringC &)

void cat(const char *,const char *,const SubStringC &,StringC &)

void cat(const char *,const char *,const char *,StringC &)

void cat(const char *,const char *,char,StringC &)


Maintainer:Charles Galambos, Created: 07/05/98, Documentation by CxxDoc: Tue Aug 13 09:59:02 2002