OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

fileName Class Reference

A class for handling file names. More...

Inheritance diagram for fileName:
Collaboration diagram for fileName:

List of all members.


Public Types

enum  Type { UNDEFINED, FILE, DIRECTORY, LINK }
 Enumerations to handle file types and modes. More...

Public Member Functions

 fileName ()
 Construct null.
 fileName (const fileName &)
 Construct as copy.
 fileName (const word &)
 Construct as copy of word.
 fileName (const string &)
 Construct as copy of string.
 fileName (const std::string &)
 Construct as copy of std::string.
 fileName (const char *)
 Construct as copy of character array.
 fileName (const wordList &)
 Construct by concatenating elements of wordList separated by '/'.
 fileName (Istream &)
 Construct from Istream.
bool clean ()
 Cleanup file name.
fileName clean () const
 Cleanup file name.
Type type () const
 Return the file type: FILE, DIRECTORY or UNDEFINED.
word name () const
 Return file name (part beyond last /).
fileName path () const
 Return directory path name (part before last /).
fileName lessExt () const
 Return file name without extension (part before last .).
word ext () const
 Return file name extension (part after last .).
wordList components (const char delimiter='/') const
 Return path components as wordList.
word component (const size_type, const char delimiter='/') const
 Return a single component of the path.
const fileName & operator= (const fileName &)
const fileName & operator= (const word &)
const fileName & operator= (const string &)
const fileName & operator= (const std::string &)
const fileName & operator= (const char *)

Static Public Member Functions

static bool valid (char)
 Is this character valid for a fileName?

Static Public Attributes

static const char *const typeName = "fileName"
static int debug
static const fileName null

Friends

Istream & operator>> (Istream &, fileName &)
Ostream & operator<< (Ostream &, const fileName &)

Detailed Description

A class for handling file names.

A fileName can be

  • constructed from a char*, a string or a word
  • concatenated by adding a '/' separator
  • decomposed into the path, name or component list
  • interrogated for type and access mode

The string::expand() method expands environment variables, etc,

Source files

Definition at line 64 of file fileName.H.


Member Enumeration Documentation

enum Type

Enumerations to handle file types and modes.

Enumerator:
UNDEFINED 
FILE 
DIRECTORY 
LINK 

Definition at line 77 of file fileName.H.


Constructor & Destructor Documentation

fileName (  )  [inline]

Construct null.

Definition at line 44 of file fileNameI.H.

fileName ( const fileName &  fn  )  [inline]

Construct as copy.

Definition at line 49 of file fileNameI.H.

fileName ( const word &  w  )  [inline]

Construct as copy of word.

Definition at line 54 of file fileNameI.H.

fileName ( const string &  str  )  [inline]

Construct as copy of string.

Definition at line 60 of file fileNameI.H.

fileName ( const std::string &  str  )  [inline]

Construct as copy of std::string.

Definition at line 68 of file fileNameI.H.

fileName ( const char *  str  )  [inline]

Construct as copy of character array.

Definition at line 76 of file fileNameI.H.

fileName ( const wordList &  lst  )  [explicit]

Construct by concatenating elements of wordList separated by '/'.

Definition at line 32 of file fileName.C.

fileName ( Istream &  is  ) 

Construct from Istream.

Definition at line 27 of file fileNameIO.C.


Member Function Documentation

bool valid ( char  c  )  [inline, static]

Is this character valid for a fileName?

Definition at line 86 of file fileNameI.H.

bool clean (  ) 

Cleanup file name.

eg, remove repeated slashes, etc.

Definition at line 49 of file fileName.C.

References fileName::type().

Here is the call graph for this function:

Foam::fileName clean (  )  const

Cleanup file name.

eg, remove repeated slashes, etc.

Definition at line 61 of file fileName.C.

Foam::fileName::Type type (  )  const

Return the file type: FILE, DIRECTORY or UNDEFINED.

Definition at line 43 of file fileName.C.

References fileName::operator=().

Referenced by fileName::clean(), and fvMeshDistribute::printFieldInfo().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::word name (  )  const

Return file name (part beyond last /).

Definition at line 81 of file fileName.C.

Foam::fileName path (  )  const

Return directory path name (part before last /).

Definition at line 107 of file fileName.C.

Foam::fileName lessExt (  )  const

Return file name without extension (part before last .).

Definition at line 127 of file fileName.C.

Referenced by UnsortedMeshedSurface< Face >::write(), and MeshedSurface< Face >::write().

Here is the caller graph for this function:

Foam::word ext (  )  const

Return file name extension (part after last .).

Definition at line 143 of file fileName.C.

Referenced by triSurface::triSurface(), UnsortedMeshedSurface< Face >::write(), triSurface::write(), and MeshedSurface< Face >::write().

Here is the caller graph for this function:

Foam::wordList components ( const char  delimiter = '/'  )  const

Return path components as wordList.

Definition at line 171 of file fileName.C.

References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append().

Referenced by fileName::operator=().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::word component ( const size_type  cmpt,
const char  delimiter = '/' 
) const

Return a single component of the path.

Definition at line 200 of file fileName.C.

const Foam::fileName & operator= ( const fileName &  str  ) 

Definition at line 211 of file fileName.C.

References fileName::components().

Referenced by Foam::operator/(), fileName::operator=(), and fileName::type().

Here is the call graph for this function:

Here is the caller graph for this function:

const Foam::fileName & operator= ( const word &  str  ) 

Definition at line 218 of file fileName.C.

References fileName::operator=().

Here is the call graph for this function:

const Foam::fileName & operator= ( const string &  str  ) 

Definition at line 225 of file fileName.C.

References fileName::operator=().

Here is the call graph for this function:

const Foam::fileName & operator= ( const std::string &  str  ) 

Definition at line 233 of file fileName.C.

References fileName::operator=().

Here is the call graph for this function:

const Foam::fileName & operator= ( const char *  str  ) 

Definition at line 241 of file fileName.C.

References fileName::operator=().

Here is the call graph for this function:


Friends And Related Function Documentation

Istream& operator>> ( Istream &  ,
fileName &   
) [friend]

Ostream& operator<< ( Ostream &  ,
const fileName &   
) [friend]


Member Data Documentation

const char *const typeName = "fileName" [static]

Reimplemented from string.

Definition at line 88 of file fileName.H.

int debug [static]

Reimplemented from string.

Definition at line 89 of file fileName.H.

const Foam::fileName null [static]

Reimplemented from string.

Definition at line 90 of file fileName.H.

Referenced by Foam::home(), and Time::timePath().


The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd