A class for handling file names. More...
#include <OpenFOAM/fileName.H>
A class for handling file names.
A fileName can be
The string::expand() method expands environment variables, etc,
Definition at line 69 of file fileName.H.
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 &) |
enum Type |
Enumerations to handle file types and modes.
Definition at line 82 of file fileName.H.
fileName | ( | ) | [inline]
|
Construct null.
Definition at line 52 of file fileNameI.H.
Construct as copy.
Definition at line 57 of file fileNameI.H.
Construct as copy of word.
Definition at line 62 of file fileNameI.H.
Construct as copy of string.
Definition at line 68 of file fileNameI.H.
fileName | ( | const std::string & | str ) | [inline]
|
Construct as copy of std::string.
Definition at line 76 of file fileNameI.H.
fileName | ( | const char * | str ) | [inline]
|
Construct as copy of character array.
Definition at line 84 of file fileNameI.H.
Construct by concatenating elements of wordList separated by '/'.
Definition at line 40 of file fileName.C.
References forAll, and fileName::operator=().
Construct from Istream.
Definition at line 34 of file fileNameIO.C.
bool valid | ( | char | c ) | [inline, static]
|
Is this character valid for a fileName?
Definition at line 94 of file fileNameI.H.
References Foam::isspace().
bool clean | ( | ) |
Cleanup file name.
eg, remove repeated slashes, etc.
Definition at line 71 of file fileName.C.
Referenced by fileName::clean().
Foam::fileName clean | ( | ) | const |
Cleanup file name.
eg, remove repeated slashes, etc.
Definition at line 166 of file fileName.C.
References fileName::clean().
Foam::fileName::Type type | ( | ) | const |
Return the file type: FILE, DIRECTORY or UNDEFINED.
Definition at line 51 of file fileName.C.
References Foam::type().
Referenced by Foam::cp(), Foam::mv(), fvMeshDistribute::printFieldInfo(), and Foam::rmDir().
Foam::word name | ( | ) | const |
Return file name (part beyond last /)
Definition at line 186 of file fileName.C.
Referenced by argList::argList(), probes::checkFieldTypes(), timeVaryingMappedFixedValueFvPatchField< Type >::checkTable(), Foam::cp(), Foam::mv(), processorPolyPatch::order(), triSurface::triSurfInstance(), timeVaryingMappedFixedValueFvPatchField< Type >::updateCoeffs(), OBJsurfaceFormat< Face >::write(), partialWrite::write(), PatchPostProcessing< CloudType >::write(), and STARCDsurfaceFormatCore::writeCase().
Foam::fileName path | ( | ) | const |
Return directory path name (part before last /)
Definition at line 212 of file fileName.C.
Referenced by probes::checkFieldTypes(), chemkinReader::chemkinReader(), Foam::cp(), isoSurface::isoSurface(), forces::makeFile(), fieldValue::makeFile(), fieldMinMax::makeFile(), Foam::mkDir(), surfMesh::removeFiles(), polyMesh::removeFiles(), PatchPostProcessing< CloudType >::write(), and triSurfaceMesh::writeObject().
Foam::fileName lessExt | ( | ) | const |
Return file name without extension (part before last .)
Definition at line 232 of file fileName.C.
Referenced by UnsortedMeshedSurface< Face >::canRead(), MeshedSurface< Face >::canRead(), UnsortedMeshedSurface< Face >::New(), MeshedSurface< Face >::New(), dlLibraryTable::open(), UnsortedMeshedSurface< Face >::read(), STARCDsurfaceFormat< Face >::read(), MeshedSurface< Face >::read(), Foam::readDir(), STARCDsurfaceFormat< Face >::write(), OBJsurfaceFormat< Face >::write(), and STARCDsurfaceFormatCore::writeCase().
Foam::word ext | ( | ) | const |
Return file name extension (part after last .)
Definition at line 248 of file fileName.C.
References word::null.
Referenced by UnsortedMeshedSurface< Face >::canRead(), MeshedSurface< Face >::canRead(), UnsortedMeshedSurface< Face >::New(), MeshedSurface< Face >::New(), dlLibraryTable::open(), UnsortedMeshedSurface< Face >::read(), MeshedSurface< Face >::read(), Foam::readDir(), triSurface::triSurface(), triSurface::write(), UnsortedMeshedSurface< Face >::write(), STLsurfaceFormat< Face >::write(), and MeshedSurface< Face >::write().
Foam::wordList components | ( | const char | delimiter = '/'
) |
const |
Return path components as wordList.
Definition at line 276 of file fileName.C.
References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), and DynamicList< T, SizeInc, SizeMult, SizeDiv >::xfer().
Referenced by Foam::cp().
Foam::word component | ( | const size_type | cmpt, |
const char | delimiter = '/'
|
||
) | const |
Return a single component of the path.
Definition at line 305 of file fileName.C.
Referenced by Foam::cp().
const Foam::fileName & operator= | ( | const fileName & | str ) |
Definition at line 316 of file fileName.C.
Referenced by fileName::fileName().
const Foam::fileName & operator= | ( | const word & | str ) |
Definition at line 323 of file fileName.C.
const Foam::fileName & operator= | ( | const string & | str ) |
Definition at line 330 of file fileName.C.
const Foam::fileName & operator= | ( | const std::string & | str ) |
Definition at line 338 of file fileName.C.
const Foam::fileName & operator= | ( | const char * | str ) |
Definition at line 346 of file fileName.C.
const char *const typeName = "fileName" [static]
|
Reimplemented from string.
Definition at line 93 of file fileName.H.
int debug [static]
|
Reimplemented from string.
Definition at line 94 of file fileName.H.
const Foam::fileName null [static]
|
Reimplemented from string.
Definition at line 95 of file fileName.H.
Referenced by chemkinReader::chemkinReader(), Time::dbDir(), and IOobject::filePath().