mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: optional flag to suppress stripping in fileName constructor
- increases flexibility and adds consistency with the word class.
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -110,13 +110,13 @@ public:
|
||||
inline fileName(const word&);
|
||||
|
||||
//- Construct as copy of string
|
||||
inline fileName(const string&);
|
||||
inline fileName(const string&, const bool doStripInvalid=true);
|
||||
|
||||
//- Construct as copy of std::string
|
||||
inline fileName(const std::string&);
|
||||
inline fileName(const std::string&, const bool doStripInvalid=true);
|
||||
|
||||
//- Construct as copy of character array
|
||||
inline fileName(const char*);
|
||||
inline fileName(const char*, const bool doStripInvalid=true);
|
||||
|
||||
//- Construct by concatenating elements of wordList separated by '/'
|
||||
explicit fileName(const wordList&);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,6 +27,8 @@ License
|
||||
|
||||
inline void Foam::fileName::stripInvalid()
|
||||
{
|
||||
// skip stripping unless debug is active to avoid
|
||||
// costly operations
|
||||
if (debug && string::stripInvalid<fileName>(*this))
|
||||
{
|
||||
std::cerr
|
||||
@ -54,38 +56,49 @@ inline Foam::fileName::fileName()
|
||||
string()
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::fileName::fileName(const fileName& fn)
|
||||
:
|
||||
string(fn)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::fileName::fileName(const word& w)
|
||||
:
|
||||
string(w)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::fileName::fileName(const string& str)
|
||||
inline Foam::fileName::fileName(const string& s, const bool doStripInvalid)
|
||||
:
|
||||
string(str)
|
||||
string(s)
|
||||
{
|
||||
stripInvalid();
|
||||
if (doStripInvalid)
|
||||
{
|
||||
stripInvalid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName::fileName(const std::string& str)
|
||||
inline Foam::fileName::fileName(const std::string& s, const bool doStripInvalid)
|
||||
:
|
||||
string(str)
|
||||
string(s)
|
||||
{
|
||||
stripInvalid();
|
||||
if (doStripInvalid)
|
||||
{
|
||||
stripInvalid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName::fileName(const char* str)
|
||||
inline Foam::fileName::fileName(const char* s, const bool doStripInvalid)
|
||||
:
|
||||
string(str)
|
||||
string(s)
|
||||
{
|
||||
stripInvalid();
|
||||
if (doStripInvalid)
|
||||
{
|
||||
stripInvalid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -52,18 +52,18 @@ inline void Foam::word::stripInvalid()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::word::word(const word& w)
|
||||
:
|
||||
string(w)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::word::word()
|
||||
:
|
||||
string()
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::word::word(const word& w)
|
||||
:
|
||||
string(w)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::word::word(const string& s, const bool doStripInvalid)
|
||||
:
|
||||
string(s)
|
||||
@ -96,6 +96,7 @@ inline Foam::word::word(const char* s, const bool doStripInvalid)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline Foam::word::word
|
||||
(
|
||||
const char* s,
|
||||
|
||||
Reference in New Issue
Block a user