Falcon::Path Class Reference

Falcon path representation. More...

#include <path.h>

Inheritance diagram for Falcon::Path:

Inheritance graph
[legend]

List of all members.

Public Member Functions

void copy (const Path &other)
 Copy another path.
void extendLocation (const String &npath)
 Add a path element at the end of a path.
const Stringget () const
 Retrurn the path in RFC 3986 format.
bool getExtension (String &str) const
 Stores the extension part in a given string.
String getExtension () const
 Get the extension part.
bool getFile (String &str) const
 Get the file part alone (without extension).
String getFile () const
 Get the file part alone (without extension).
bool getFilename (String &str) const
 Stores the filename part in a given string.
String getFilename () const
 Get the filename part.
bool getLocation (String &str) const
 Stores the resource part in a given string.
String getLocation () const
 Get the location part (path to file) in RFC3986 format.
bool getResource (String &str) const
 Stores the resource part in a given string.
String getResource () const
 Get the resource part (usually the disk specificator).
void getWinFormat (String &str) const
 Stores this path in windows format in a given string.
String getWinFormat () const
 Returns a path in MS-Windows format.
bool getWinLocation (String &str) const
 Stores the location part in a given string in MS-Windows format.
String getWinLocation () const
 Get the location part (path to file) in MS-Windows format.
bool isAbsolute () const
 Returns true if this path is an absolute path.
bool isLocation () const
 Returns true if this path defines a location without a file.
bool isValid () const
 Returns true if the path is valid.
void join (const String &res, const String &loc, const String &name, const String &ext)
 Joins a path divided into its constituents into this path.
void join (const String &loc, const String &name, const String &ext)
 Joins a path divided into its constituents into this path.
bool operator!= (const Path &other) const
bool operator< (const Path &other) const
Pathoperator= (const Path &other)
bool operator== (const Path &other) const
 Path (const Path &other)
 Copy constructor.
 Path (const String &path)
 Path constructor from strings.
 Path (URI *owner)
 Path-in-uri constructor.
 Path ()
 Empty constructor.
bool set (const String &p)
 Set a path from RFC 3986 format.
void setExtension (const String &extension)
 Sets the extension part.
void setFile (const String &file)
 Sets the file part.
void setFilename (const String &fname)
 Sets the filename part (both file and extension).
void setLocation (const String &loc)
 Sets the location part in RFC3986 format.
void setResource (const String &res)
 Sets the resource part.
void split (String &res, String &loc, String &name, String &ext)
 Splits the path into its constituents.
void split (String &loc, String &name, String &ext)
 Splits the path into its constituents.
void splitWinFormat (String &res, String &loc, String &name, String &ext)
 Splits the path into its constituents.


Detailed Description

Falcon path representation.

This class is actually a string wrapper which parses the path and builds it as necessary.

With respect to a string, 0 overhead is required.

However, notice that this class cannot be used as a garbage string, and must be wrapped into a UserData to be part of a falcon object.

Path must be provided in Falcon format (RFC 3986): path elements must be separated by forward slashes and resource identifiers must be preceded by a single "/"; in example:

      /C:/falcon/file.fal
With a resource identifier, the first "/" is optional when setting the path, but the internal representation will be normalized so that it is present.

Methods to transfrorm this representation to and from MS-Windows path are provided.

The path is not internally checked, by this class, so any string may be set, but it may get checked i.e. when insernted in a URI.


Constructor & Destructor Documentation

Falcon::Path::Path (  ) 

Empty constructor.

Falcon::Path::Path ( URI owner  ) 

Path-in-uri constructor.

Falcon::Path::Path ( const String path  )  [inline]

Path constructor from strings.

Falcon::Path::Path ( const Path other  )  [inline]

Copy constructor.

Copies the other path as-is.


Member Function Documentation

void Falcon::Path::copy ( const Path other  ) 

Copy another path.

Copies the other path as-is.

void Falcon::Path::extendLocation ( const String npath  ) 

Add a path element at the end of a path.

This extens the path adding some path element after the currently existing location portion. Leading "/" in npath, or trailing "/" in this path are ignored, and a traling "/" is forcefully added if there is a file element. In example, adding p1/p2 or /p1/p2 through this method:

/C:file.txt => /C:/p1/p2/file.txt /path/ => /path/p1/p2 /path/file.txt => /path/p1/p2/file.txt

const String& Falcon::Path::get (  )  const [inline]

Retrurn the path in RFC 3986 format.

bool Falcon::Path::getExtension ( String str  )  const

Stores the extension part in a given string.

If the path has not a extension part, the string is also cleaned.

Parameters:
str the string where to store the extension part.
Returns:
true if the path has a extension part.

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

Get the extension part.

References getExtension().

Referenced by getExtension().

bool Falcon::Path::getFile ( String str  )  const

Get the file part alone (without extension).

If the path has not a filename part, the string is also cleaned.

Parameters:
str the string where to store the filename part.
Returns:
true if the path has a filename part.

String Falcon::Path::getFile (  )  const [inline]

Get the file part alone (without extension).

References getFile().

Referenced by getFile().

bool Falcon::Path::getFilename ( String str  )  const

Stores the filename part in a given string.

If the path has not a filename part, the string is also cleaned.

Parameters:
str the string where to store the filename part.
Returns:
true if the path has a filename part.

String Falcon::Path::getFilename (  )  const [inline]

Get the filename part.

This returns the file and extension parts separated by a '.'

References getFilename().

Referenced by getFilename().

bool Falcon::Path::getLocation ( String str  )  const

Stores the resource part in a given string.

If the path has not a location part, the string is also cleaned.

Parameters:
str the string where to store the location part.
Returns:
true if the path has a location part.

String Falcon::Path::getLocation (  )  const [inline]

Get the location part (path to file) in RFC3986 format.

References getLocation().

Referenced by getLocation().

bool Falcon::Path::getResource ( String str  )  const

Stores the resource part in a given string.

If the path has not a resource part, the string is also cleaned.

Parameters:
str the string where to store the resource part.
Returns:
true if the path has a resource part.

String Falcon::Path::getResource (  )  const [inline]

Get the resource part (usually the disk specificator).

References getResource().

Referenced by getResource().

void Falcon::Path::getWinFormat ( String str  )  const

Stores this path in windows format in a given string.

String Falcon::Path::getWinFormat (  )  const [inline]

Returns a path in MS-Windows format.

References getWinFormat().

Referenced by getWinFormat().

bool Falcon::Path::getWinLocation ( String str  )  const

Stores the location part in a given string in MS-Windows format.

If the path has not a location part, the string is also cleaned.

Parameters:
str the string where to store the location part.
Returns:
true if the path has a location part.

String Falcon::Path::getWinLocation (  )  const [inline]

Get the location part (path to file) in MS-Windows format.

References getWinLocation().

Referenced by getWinLocation().

bool Falcon::Path::isAbsolute (  )  const

Returns true if this path is an absolute path.

bool Falcon::Path::isLocation (  )  const

Returns true if this path defines a location without a file.

bool Falcon::Path::isValid (  )  const [inline]

Returns true if the path is valid.

Notice that an empty path is still valid.

void Falcon::Path::join ( const String res,
const String loc,
const String name,
const String ext 
)

Joins a path divided into its constituents into this path.

Parameters:
res the resource locator (i.e. disk unit)
loc the path location of the file.
name the filename.
ext the file extension.
bWin true if the location may be in MS-Windows format (backslashes).

void Falcon::Path::join ( const String loc,
const String name,
const String ext 
)

Joins a path divided into its constituents into this path.

Using this version it is not possible to set a resource locator (i.e. a disk unit).

Parameters:
loc the path location of the file.
name the filename.
ext the file extension.

bool Falcon::Path::operator!= ( const Path other  )  const [inline]

References m_path.

bool Falcon::Path::operator< ( const Path other  )  const [inline]

References m_path.

Path& Falcon::Path::operator= ( const Path other  )  [inline]

bool Falcon::Path::operator== ( const Path other  )  const [inline]

References m_path.

bool Falcon::Path::set ( const String p  ) 

Set a path from RFC 3986 format.

void Falcon::Path::setExtension ( const String extension  ) 

Sets the extension part.

void Falcon::Path::setFile ( const String file  ) 

Sets the file part.

void Falcon::Path::setFilename ( const String fname  ) 

Sets the filename part (both file and extension).

void Falcon::Path::setLocation ( const String loc  ) 

Sets the location part in RFC3986 format.

void Falcon::Path::setResource ( const String res  ) 

Sets the resource part.

void Falcon::Path::split ( String res,
String loc,
String name,
String ext 
)

Splits the path into its constituents.

Parameters:
res a string where the resource locator will be placed.
loc a string where the location will be placed.
name a string where the filename in this path will be placed.
ext a string where the file extension will be placed.

void Falcon::Path::split ( String loc,
String name,
String ext 
)

Splits the path into its constituents.

This version would eventually put the resource part in the first parameter.

Parameters:
loc a string where the location will be placed.
name a string where the filename in this path will be placed.
ext a string where the file extension will be placed.

void Falcon::Path::splitWinFormat ( String res,
String loc,
String name,
String ext 
)

Splits the path into its constituents.

This version will convert the output loc parameter in MS-Windows path format (backslashes).

Parameters:
res a string where the resource locator will be placed.
loc a string where the location will be placed.
name a string where the filename in this path will be placed.
ext a string where the file extension will be placed.


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

Generated on Mon Oct 19 10:11:40 2009 for Falcon_Core by  doxygen 1.5.8