diff --git a/src/fileFormats/ensight/name/ensightFileName.H b/src/fileFormats/ensight/name/ensightFileName.H index 0f16a4cf84..6fadf388d8 100644 --- a/src/fileFormats/ensight/name/ensightFileName.H +++ b/src/fileFormats/ensight/name/ensightFileName.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,6 +35,10 @@ Description Overall line length within case file is limited to 1024, but this is not yet addresssed. +Note + To assist windows usage, a colon (':') in the name is replaced with + by an underscore. + \*---------------------------------------------------------------------------*/ #ifndef ensightFileName_H @@ -60,19 +64,25 @@ class FileName { public: - // Constructors + // Generated Methods //- Copy construct - inline FileName(const FileName& fn); + FileName(const FileName&) = default; + + //- Move construct + FileName(FileName&&) = default; + + + // Constructors //- Construct as copy of character array inline explicit FileName(const char* s); - //- Construct as copy of std::string + //- Copy construct from std::string inline explicit FileName(const std::string& s); - // Member functions + // Member Functions //- Is this character valid for an ensight file-name inline static bool valid(char c); @@ -90,9 +100,9 @@ public: void operator=(const string&) = delete; void operator=(const std::string&) = delete; void operator=(const char*) = delete; - }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace ensight diff --git a/src/fileFormats/ensight/name/ensightFileNameI.H b/src/fileFormats/ensight/name/ensightFileNameI.H index 41d57d4143..6cf6f48135 100644 --- a/src/fileFormats/ensight/name/ensightFileNameI.H +++ b/src/fileFormats/ensight/name/ensightFileNameI.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,12 +30,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -inline Foam::ensight::FileName::FileName(const FileName& fn) -: - fileName(fn, false) -{} - - inline Foam::ensight::FileName::FileName(const char* s) : fileName(s, false) @@ -52,7 +46,6 @@ inline Foam::ensight::FileName::FileName(const std::string& s) } - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // inline bool Foam::ensight::FileName::valid(char c) @@ -70,6 +63,9 @@ inline void Foam::ensight::FileName::stripInvalid() { string::stripInvalid(*this); + // Avoid characters that upset Windows or others + string::replaceAny(":<>[]", '_'); + removeRepeated('/'); removeEnd('/'); diff --git a/src/fileFormats/ensight/name/ensightVarName.H b/src/fileFormats/ensight/name/ensightVarName.H index ab659fba21..0ddd13bb41 100644 --- a/src/fileFormats/ensight/name/ensightVarName.H +++ b/src/fileFormats/ensight/name/ensightVarName.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,6 +29,7 @@ Class Description Specification of a valid Ensight variable-name. + Illegal characters \code space !#%()*+,-./;@[]^ \endcode @@ -62,15 +63,21 @@ class VarName { public: - // Constructors + // Generated Methods //- Copy construct - inline VarName(const VarName& vn); + VarName(const VarName&) = default; + + //- Move construct + VarName(VarName&&) = default; + + + // Constructors //- Construct as copy of character array inline explicit VarName(const char* s); - //- Construct as copy of std::string + //- Copy construct from std::string inline explicit VarName(const std::string& s); @@ -91,7 +98,6 @@ public: void operator=(const string&) = delete; void operator=(const std::string&) = delete; void operator=(const char*) = delete; - }; diff --git a/src/fileFormats/ensight/name/ensightVarNameI.H b/src/fileFormats/ensight/name/ensightVarNameI.H index 80b5f8137c..49ffb145a2 100644 --- a/src/fileFormats/ensight/name/ensightVarNameI.H +++ b/src/fileFormats/ensight/name/ensightVarNameI.H @@ -28,15 +28,8 @@ License #include "error.H" #include - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -inline Foam::ensight::VarName::VarName(const VarName& vn) -: - word(vn, false) -{} - - inline Foam::ensight::VarName::VarName(const char* s) : word(s, false)