Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXPath Namespace Reference


Enumerations

enum  {
  PathName = 1,
  NoEscape = 2,
  DotFile = 4,
  LeadDir = 8,
  CaseFold = 16
}

Functions

FXString root (const FXString &file)
FXString share (const FXString &file)
FXString directory (const FXString &file)
FXString name (const FXString &file)
FXString title (const FXString &file)
FXString extension (const FXString &file)
FXString stripExtension (const FXString &file)
FXString drive (const FXString &file)
FXString expand (const FXString &file)
FXString contract (const FXString &file, const FXString &user=FXString::null, const FXString &var=FXString::null)
FXString simplify (const FXString &file)
FXString absolute (const FXString &file)
FXString absolute (const FXString &base, const FXString &file)
FXString relative (const FXString &file)
FXString relative (const FXString &base, const FXString &file)
FXString convert (const FXString &file, FXchar septo=PATHSEP, FXchar sepfm='/')
FXString upLevel (const FXString &file)
FXbool isInside (const FXString &base, const FXString &file)
FXbool isAbsolute (const FXString &file)
FXbool isTopDirectory (const FXString &file)
FXbool isShare (const FXString &file)
FXString enquote (const FXString &file, FXbool forcequotes=false)
FXString dequote (const FXString &file)
FXbool match (const FXchar *string, const FXchar *pattern="*", FXuint flags=(NoEscape|PathName))
FXbool match (const FXString &file, const FXchar *pattern="*", FXuint flags=(NoEscape|PathName))
FXbool match (const FXString &file, const FXString &pattern, FXuint flags=(NoEscape|PathName))
FXString unique (const FXString &file)
FXString search (const FXString &pathlist, const FXString &file)


Enumeration Type Documentation

anonymous enum

Options for FXPath::match.

Enumerator:
PathName  No wildcard can ever match "/'.
NoEscape  Backslashes don't quote special chars.
DotFile  Leading "." is matched only explicitly.
LeadDir  Ignore "/..." after a match.
CaseFold  Compare without regard to case.


Function Documentation

FXString FX::FXPath::root ( const FXString &  file  ) 

Return root of absolute path; on Unix, this is just "/".

On Windows, this is "\", "\\Janes PC\" or "C:\". Returns the empty string if the given path is not absolute.

FXString FX::FXPath::share ( const FXString &  file  ) 

Return share name from Windows UNC filename, if any.

For example, share("\\Janes PC\Janes Documents\Document.doc") returns "Janes PC".

FXString FX::FXPath::directory ( const FXString &  file  ) 

Return the directory part of the path name.

Note that directory("/bla/bla/") is "/bla/bla" and NOT "/bla". However, directory("/bla/bla") is "/bla" as we expect!

FXString FX::FXPath::name ( const FXString &  file  ) 

Return name and extension part of the path name.

Note that name("/bla/bla/") is "" and NOT "bla". However, name("/bla/bla") is "bla" as we expect!

Referenced by FX::FXHash::value().

FXString FX::FXPath::title ( const FXString &  file  ) 

Return file title, i.e. document name only.

Referenced by FX::FXTopWindow::getPadTop().

FXString FX::FXPath::extension ( const FXString &  file  ) 

Return extension part of the file name.

FXString FX::FXPath::stripExtension ( const FXString &  file  ) 

Return file name less the extension.

FXString FX::FXPath::drive ( const FXString &  file  ) 

Return the drive letter prefixing this file name (if any).

FXString FX::FXPath::expand ( const FXString &  file  ) 

Perform tilde or environment variable expansion.

FXString FX::FXPath::contract ( const FXString &  file,
const FXString &  user = FXString::null,
const FXString &  var = FXString::null 
)

Contract path based on user name and environment variable.

FXString FX::FXPath::simplify ( const FXString &  file  ) 

Simplify a file path; the path will remain relative if it was relative, or absolute if it was absolute.

Also, a trailing "/" will be preserved as this is important in other functions. For example, simplify("..//aaa/./bbb//../c/") becomes "../aaa/c/".

FXString FX::FXPath::absolute ( const FXString &  file  ) 

Return absolute path from current directory and file name.

FXString FX::FXPath::absolute ( const FXString &  base,
const FXString &  file 
)

Return absolute path from base directory and file name.

FXString FX::FXPath::relative ( const FXString &  file  ) 

Return relative path of file to the current directory.

FXString FX::FXPath::relative ( const FXString &  base,
const FXString &  file 
)

Return relative path of file to given base directory.

FXString FX::FXPath::convert ( const FXString &  file,
FXchar  septo = PATHSEP,
FXchar  sepfm = '/' 
)

Convert path from using 'sepfm' or 'septo' to use only 'septo' path-separators.

FXString FX::FXPath::upLevel ( const FXString &  file  ) 

Return path to directory above input directory name.

FXbool FX::FXPath::isInside ( const FXString &  base,
const FXString &  file 
)

Return true if file positively inside base directory.

FXbool FX::FXPath::isAbsolute ( const FXString &  file  ) 

Return true if file name is absolute.

FXbool FX::FXPath::isTopDirectory ( const FXString &  file  ) 

Return true if input directory is a top-level directory.

FXbool FX::FXPath::isShare ( const FXString &  file  ) 

Return true if input path is a file share.

FXString FX::FXPath::enquote ( const FXString &  file,
FXbool  forcequotes = false 
)

Enquote filename to make safe for shell.

FXString FX::FXPath::dequote ( const FXString &  file  ) 

Dequote filename to get original again.

FXbool FX::FXPath::match ( const FXchar *  string,
const FXchar *  pattern = "*",
FXuint  flags = (NoEscape|PathName) 
)

Perform match of a filename against a wildcard pattern.

The wildcard pattern may comprise ordinary characters or special matching characters, as given below:

? Any single character. * Zero or more of any character. [abc] Any character from the set {a,b,c}. [^abc] Any character BUT the ones from the set {a,b,c}. [!abc] Ditto. [a-zA-Z] Matches single character, which must be one of a-z or A-Z. [^a-zA-Z] Matches single character, which must be anything other than a-z or A-Z. [!a-zA-Z] Ditto. pat1|pat2 Match sub-pattern pat1 or pat2. pat1,pat2 Ditto. (pat1|pat2) Match sub-pattern pat1 or pat2; patterns may be nested. (pat1,pat2) Ditto.

The special characters may be escaped to treat them as ordinary characters. Matching may be influenced by a number of flags:

PathName No wildcard can ever match / NoEscape Backslashes don't quote special chars DotFile Leading . is matched only explicitly LeadDir Ignore /... after a match CaseFold Compare without regard to case

FXbool FX::FXPath::match ( const FXString &  file,
const FXchar *  pattern = "*",
FXuint  flags = (NoEscape|PathName) 
)

Perform match of a filename against a wildcard pattern.

FXbool FX::FXPath::match ( const FXString &  file,
const FXString &  pattern,
FXuint  flags = (NoEscape|PathName) 
)

Perform match of a filename against a wildcard pattern.

FXString FX::FXPath::unique ( const FXString &  file  ) 

Generate unique filename of the form pathnameXXX.ext, where pathname.ext is the original input file, and XXX is a number, possibly empty, that makes the file unique.

FXString FX::FXPath::search ( const FXString &  pathlist,
const FXString &  file 
)

Search path list for this file, return full path name for first occurrence.

Copyright © 1997-2010 Jeroen van der Zijp