STYLE: avoid ":<>" in EnSight file names (#902)

This commit is contained in:
Mark Olesen
2020-04-28 14:37:32 +02:00
parent 14e2dbfb2a
commit 119796b6cb
4 changed files with 31 additions and 26 deletions

View File

@ -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

View File

@ -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<FileName>(*this);
// Avoid characters that upset Windows or others
string::replaceAny(":<>[]", '_');
removeRepeated('/');
removeEnd('/');

View File

@ -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;
};

View File

@ -28,15 +28,8 @@ License
#include "error.H"
#include <cctype>
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::ensight::VarName::VarName(const VarName& vn)
:
word(vn, false)
{}
inline Foam::ensight::VarName::VarName(const char* s)
:
word(s, false)