diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.H b/src/OpenFOAM/primitives/strings/fileName/fileName.H index ee0d751fae6167cdd5552cc83eac45af21107a3a..288da061b87715a3fd4c5d652ff571d3467fa5ce 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileName.H +++ b/src/OpenFOAM/primitives/strings/fileName/fileName.H @@ -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&); diff --git a/src/OpenFOAM/primitives/strings/fileName/fileNameI.H b/src/OpenFOAM/primitives/strings/fileName/fileNameI.H index a015e971bdf69a9f4c94f3df4abab0c5946fcb87..6c2bb37f9ac16e402f3fee80a27b8c41087fb37a 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileNameI.H +++ b/src/OpenFOAM/primitives/strings/fileName/fileNameI.H @@ -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(); + } } diff --git a/src/OpenFOAM/primitives/strings/word/wordI.H b/src/OpenFOAM/primitives/strings/word/wordI.H index 587adfac99b3d8378e3c1768e1d52f06012d0ae1..a4d15df4e78639e28364d19dbe1ddc9790e4b082 100644 --- a/src/OpenFOAM/primitives/strings/word/wordI.H +++ b/src/OpenFOAM/primitives/strings/word/wordI.H @@ -52,15 +52,15 @@ inline void Foam::word::stripInvalid() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -inline Foam::word::word(const word& w) +inline Foam::word::word() : - string(w) + string() {} -inline Foam::word::word() +inline Foam::word::word(const word& w) : - string() + string(w) {} @@ -96,6 +96,7 @@ inline Foam::word::word(const char* s, const bool doStripInvalid) } } + inline Foam::word::word ( const char* s,