Celartem::Path Class Reference

#include <cel_filepath.h>

List of all members.

Public Member Functions

 Path ()
 Path (const Path &inFilePath)
 Path (const String &inFilePath)
 Path (const char *inFilePath)
 Path (const utf8s &inFilePath)
 Path (const UChar2 *inFilePath)
 Path (const UChar4 *inFilePath)
Pathoperator= (const Path &inFilePath)
Pathoperator= (const String &inFilePath)
Pathoperator= (const utf8s &inFilePath)
Pathoperator= (const UChar2 *inFilePath)
Pathoperator= (const UChar4 *inFilePath)
 operator String () const
String getPath () const
void assign (const String &inFilePath)
String getBodyFileName () const
String removeFileNameFromPath () const
String removeTrailingPathSeparator () const
String getExtension () const
String removeExtension () const
bool doesExist () const
bool isDirectory () const
bool deleteFile () const
bool overwriteWith (const Path &inSrc, bool forceOverwrite=false) const
bool replaceWith (const Path &inReplacer) const


Detailed Description

This class ensures the file path is normalized and reduces the risk of inproper file path validation. The codes that deals with any file paths had better use the class instead of the real file path.
Almost all the member functions provided in the class uses the functions provided in FileUtils namespace.
See also:
FileUtils, FileUtils::normalizePath

Definition at line 26 of file cel_filepath.h.


Constructor & Destructor Documentation

Celartem::Path::Path (  )  [inline]

Default constructor.

Definition at line 32 of file cel_filepath.h.

Celartem::Path::Path ( const Path inFilePath  )  [inline]

This constructor is for duplicating the Path instance.

Parameters:
inFilePath The file path to be stored.

Definition at line 39 of file cel_filepath.h.

Celartem::Path::Path ( const String inFilePath  )  [inline]

This constructor initializes the instance with the specified file path.

Parameters:
inFilePath The file path to be stored.

Definition at line 47 of file cel_filepath.h.

Celartem::Path::Path ( const char *  inFilePath  )  [inline]

This constructor initializes the instance with the specified file path.

Parameters:
inFilePath The file path to be stored.

Definition at line 55 of file cel_filepath.h.

Celartem::Path::Path ( const utf8s inFilePath  )  [inline]

This constructor initializes the instance with the specified file path.

Parameters:
inFilePath The file path to be stored.

Definition at line 63 of file cel_filepath.h.

Celartem::Path::Path ( const UChar2 inFilePath  )  [inline]

This constructor initializes the instance with the specified file path.

Parameters:
inFilePath The file path to be stored.

Definition at line 71 of file cel_filepath.h.

Celartem::Path::Path ( const UChar4 inFilePath  )  [inline]

This constructor initializes the instance with the specified file path.

Parameters:
inFilePath The file path to be stored.

Definition at line 79 of file cel_filepath.h.


Member Function Documentation

Path& Celartem::Path::operator= ( const Path inFilePath  )  [inline]

This function duplicates the specified Path instance.

Parameters:
inFilePath The file path to be stored.
Returns:
Reference to this instance.

Definition at line 88 of file cel_filepath.h.

Path& Celartem::Path::operator= ( const String inFilePath  )  [inline]

This function set the specified file path to this instance.

Parameters:
inFilePath The file path to be stored.
Returns:
Reference to this instance.
See also:
assign

Definition at line 102 of file cel_filepath.h.

Path& Celartem::Path::operator= ( const utf8s inFilePath  )  [inline]

This function set the specified file path to this instance.

Parameters:
inFilePath The file path to be stored.
Returns:
Reference to this instance.
See also:
assign

Definition at line 116 of file cel_filepath.h.

Path& Celartem::Path::operator= ( const UChar2 inFilePath  )  [inline]

This function set the specified file path to this instance.

Parameters:
inFilePath The file path to be stored.
Returns:
Reference to this instance.
See also:
assign

Definition at line 130 of file cel_filepath.h.

Path& Celartem::Path::operator= ( const UChar4 inFilePath  )  [inline]

This function set the specified file path to this instance.

Parameters:
inFilePath The file path to be stored.
Returns:
Reference to this instance.
See also:
assign

Definition at line 144 of file cel_filepath.h.

Celartem::Path::operator String (  )  const [inline]

This function implicitly convert the instance into String. You can assume the file path returned is normalized.

Returns:
The normalized file path.
See also:
assign

Definition at line 157 of file cel_filepath.h.

String Celartem::Path::getPath (  )  const [inline]

This function explicitly convert the instance into String. You can assume the file path returned is normalized.

Returns:
The normalized file path.
See also:
assign

Definition at line 166 of file cel_filepath.h.

void Celartem::Path::assign ( const String inFilePath  )  [inline]

This function set the specified file path to this instance. It internally calls FileUtils::normalizePath function.

Parameters:
inFilePath The file path to be stored.

Definition at line 174 of file cel_filepath.h.

Referenced by operator=(), and Path().

String Celartem::Path::getBodyFileName (  )  const [inline]

This function returns the body file name.
If you pass "C:\foo\bar\baz.txt" for the function, it returns "baz.txt". On Windows, this function also works with '/' path separator.

Returns:
The body file name.

Definition at line 187 of file cel_filepath.h.

String Celartem::Path::removeFileNameFromPath (  )  const [inline]

This function removes the body file name from the specified path. If you pass "C:\foo\bar\baz" for the function, it returns "C:\foo\bar\" and never removes the last '\' from the path. On Windows, this function also works with '/' path separator.

Returns:
The result path.

Definition at line 200 of file cel_filepath.h.

String Celartem::Path::removeTrailingPathSeparator (  )  const [inline]

This function removes the traling path separator from the specified path. If you pass "C:\foo\bar\baz\" for the function, it returns "C:\foo\bar\baz". On Windows, this function also works with '/' path separator.

Returns:
The result path.

Definition at line 213 of file cel_filepath.h.

String Celartem::Path::getExtension (  )  const [inline]

This function returns the extension ".XXX".

Returns:
The extension.

Definition at line 223 of file cel_filepath.h.

String Celartem::Path::removeExtension (  )  const [inline]

This function removes the extension (including '.').

Returns:
The result path.

Definition at line 233 of file cel_filepath.h.

bool Celartem::Path::doesExist (  )  const [inline]

This function checks whether the file exists or not.

Returns:
true if the file exists, otherwise false.

Definition at line 243 of file cel_filepath.h.

bool Celartem::Path::isDirectory (  )  const [inline]

This function checks whether the specified path is a directory or not.

Returns:
true if the path is a directory, otherwise false.

Definition at line 254 of file cel_filepath.h.

bool Celartem::Path::deleteFile (  )  const [inline]

This function delete the file.

Returns:
true if success, otherwise false.

Definition at line 264 of file cel_filepath.h.

bool Celartem::Path::overwriteWith ( const Path inSrc,
bool  forceOverwrite = false 
) const [inline]

This function overwrite the file with the specified file; it actually does copy of the specified file.

Parameters:
inSrc The copy source file.
forceOverwrite if the parameter is true, then this function overwrites the existing file, otherwise the function fails.
Returns:
true if success, otherwise false.

Definition at line 280 of file cel_filepath.h.

bool Celartem::Path::replaceWith ( const Path inReplacer  )  const [inline]

This function replaces the file with another file.

Parameters:
inReplacer File name that specifies the file that overwrites the file.
Returns:
true if success, otherwise false.

Definition at line 296 of file cel_filepath.h.


The documentation for this class was generated from the following file:
This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:23:16 2008.