quick start:g++ [flags ...] file ... #include <Filename.h> Filename(const Filename& arg); boolean transformUniquely(); boolean getBase(String& base) const; boolean getExt(String& ext) const; boolean makeTemp(); boolean makeTemp(const String& basename);
description:String extension; // declare the filename // Filename filename; filename.assign(L"image.jpg"); // get the extension of the filename // filename.getExt(extension);
static const String CLASS_NAME = L"Filename";
enum OS { UNIX = 0, WINDOWS, MACINTOSH, DEF_OS = UNIX };
const String Filename::SLASH(L"/");
const String Filename::DOT(L".");
const String Filename::UNDERSCORE(L"_");
the DEF_CAPACITY and DEF_VALUE are inherited from the SysString class
DEF_PARAM is inherited from the String class
const String Filename::DEF_EXTENSION(L"sof");
const String Filename::DEF_EXTENSION(L"sof");
const String Filename::DEF_SUFFIX(L"");
static const long DEF_DIR_PRES = 0;
static const long ERR = 45200;
OS os_d;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~Filename();
Filename(long arg = DEF_CAPACITY);
Filename(const Filename& arg);
boolean assign(const Filename& arg);
Filename& operator=(const Filename& arg);
boolean read(Sof& sof, long tag, const String& name);
boolean write(Sof& sof, long tag, const String& name) const;
this method is inherited from the SysString class
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
Filename(const unichar* arg, OS os = DEF_OS);
Filename(const String& arg, OS os = DEF_OS);
boolean assign(const String& arg);
boolean assign(const unichar* arg);
boolean setOS(OS os);
OS getOS() const;
boolean transform(const String& new_dir, const String& new_ext, const String& new_suffix, long dir_preserve = DEF_DIR_PRES)
boolean transform(const String& new_ext, const String& new_suffix)
boolean transform(const String& old_name, const String& new_dir, const String& new_ext, const String& new_suffix, long dir_preserve = DEF_DIR_PRES)
boolean transformUniquely();
boolean transformUniquely(const String& old_name);
boolean getDir(String& dir) const;
boolean getBase(String& base) const;
boolean getExt(String& ext) const;
boolean getSuffix(String& suffix) const;
boolean getName(String& filename) const;
boolean makeTemp();
boolean makeTemp(const String& basename);
static boolean buildPath(const String& pathname);
static boolean preserveDirName(String& mod_dir, const String& new_dir, const String& old_dir, long dir_preserve);
boolean getDirDelim(String& arg) const;
boolean getFileDelim(String& arg) const;
boolean getDirUnix(String& dir) const;
boolean getBaseUnix(String& base) const;
boolean getExtUnix(String& ext) const;
boolean getNameUnix(String& name) const;
boolean getDirDelimUnix(String& arg) const;
boolean getFileDelimUnix(String& arg) const;
boolean getDirWin(String& dir) const;
boolean getBaseWin(String& base) const;
boolean getExtWin(String& ext) const;
boolean getNameWin(String& name) const;
boolean getDirDelimWin(String& arg) const;
boolean getFileDelimWin(String& arg) const;
boolean getDirMac(String& dir) const;
boolean getBaseMac(String& base) const;
boolean getExtMac(String& ext) const;
boolean getNameMac(String& name) const;
boolean getDirDelimMac(String& arg) const;
boolean getFileDelimMac(String& arg) const;
// declare the filename // Filename filename; // we use strings to replace the name of the file // String old_name; String new_name; filename.assign(L"/examples/example.cc"); old_name.assign(L"example"); new_name.assign(L"example_02"); // replace the old_name with the new_name // filename.replace(old_name, new_name);The result in this case is "/examples/example_02.cc".
// declare the filename // Filename tran_filename; // declare the required string(s) // String filename; filename.assign(L"example.cc"); // transform the filename uniquely // tran_filename.transformUniquely(filename);If the file "example.cc" exists in the current directory, the result in this case is "example_0.cc".