From b61d4ab488ed9fa27ee60ef46c653e87d9ac08c4 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 13 Dec 2019 11:08:12 +0100 Subject: [PATCH] STYLE: adjust deprecations for OSspecific - skip processing OSspecific/MSwindows since this can cause duplicate doxygen entries STYLE: adjust formatting in code templates STYLE: use std::string methods without extra qualifications --- doc/Doxygen/Doxyfile | 3 +- etc/codeTemplates/source/_Template.H | 24 ++++++++++---- .../template/_TemplateTemplate.H | 15 +++++++-- src/OSspecific/MSwindows/fileStat/fileStat.H | 8 ----- src/OSspecific/POSIX/fileStat/fileStat.H | 8 ----- src/OSspecific/POSIX/regExp/regExpPosix.H | 29 ++++++++-------- .../primitives/strings/regex/regExpCxx.H | 5 ++- .../primitives/strings/stringOps/stringOps.C | 33 ++++--------------- 8 files changed, 57 insertions(+), 68 deletions(-) diff --git a/doc/Doxygen/Doxyfile b/doc/Doxygen/Doxyfile index 1a3ceffdd3..f8079abb13 100644 --- a/doc/Doxygen/Doxyfile +++ b/doc/Doxygen/Doxyfile @@ -816,7 +816,8 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = +# Avoid duplicate entries that would arise from OSspecific/MSwindows +EXCLUDE = $(WM_PROJECT_DIR)/src/OSspecific/MSwindows # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded diff --git a/etc/codeTemplates/source/_Template.H b/etc/codeTemplates/source/_Template.H index a9c19e50f7..4cbc6bb3af 100644 --- a/etc/codeTemplates/source/_Template.H +++ b/etc/codeTemplates/source/_Template.H @@ -62,7 +62,7 @@ class CLASSNAME : public baseClassName { - // Private data + // Private Data //- Description of data_ dataType data_; @@ -79,12 +79,24 @@ class CLASSNAME public: - // Static data members + // Static Data Members //- Static data staticData static const dataType staticData; + // Generated Methods + +// //- Construct null +// CLASSNAME() = default; +// +// //- Copy construct +// CLASSNAME(const CLASSNAME&) = default; +// +// //- Copy assignment +// CLASSNAME& operator=(const CLASSNAME&) = default; + + // Constructors //- Construct null @@ -112,13 +124,13 @@ public: // Member Functions - // Access + // Access - // Check + // Check - // Edit + // Edit - // Write + // Write // Member Operators diff --git a/etc/codeTemplates/template/_TemplateTemplate.H b/etc/codeTemplates/template/_TemplateTemplate.H index 43b63c3c40..7d6500b666 100644 --- a/etc/codeTemplates/template/_TemplateTemplate.H +++ b/etc/codeTemplates/template/_TemplateTemplate.H @@ -67,7 +67,7 @@ class CLASSNAME : public baseClassName { - // Private data + // Private Data dataType data_; @@ -83,11 +83,22 @@ class CLASSNAME public: - // Static data members + // Static Data Members //- Static data someStaticData static const dataType staticData; + // Generated Methods + +// //- Construct null +// CLASSNAME() = default; +// +// //- Copy construct +// CLASSNAME(const CLASSNAME&) = default; +// +// //- Copy assignment +// CLASSNAME& operator=(const CLASSNAME&) = default; + // Constructors diff --git a/src/OSspecific/MSwindows/fileStat/fileStat.H b/src/OSspecific/MSwindows/fileStat/fileStat.H index c8e3ea550f..9912155211 100644 --- a/src/OSspecific/MSwindows/fileStat/fileStat.H +++ b/src/OSspecific/MSwindows/fileStat/fileStat.H @@ -159,14 +159,6 @@ public: friend Istream& operator>>(Istream& is, fileStat& fs); friend Ostream& operator<<(Ostream& os, const fileStat& fs); - - - // Housekeeping - - //- Deprecated(2019-04) Was file-stat successful? - // \deprecated(2019-04) - use valid() method - bool isValid() const { return valid_; } - }; diff --git a/src/OSspecific/POSIX/fileStat/fileStat.H b/src/OSspecific/POSIX/fileStat/fileStat.H index c8e3ea550f..9912155211 100644 --- a/src/OSspecific/POSIX/fileStat/fileStat.H +++ b/src/OSspecific/POSIX/fileStat/fileStat.H @@ -159,14 +159,6 @@ public: friend Istream& operator>>(Istream& is, fileStat& fs); friend Ostream& operator<<(Ostream& os, const fileStat& fs); - - - // Housekeeping - - //- Deprecated(2019-04) Was file-stat successful? - // \deprecated(2019-04) - use valid() method - bool isValid() const { return valid_; } - }; diff --git a/src/OSspecific/POSIX/regExp/regExpPosix.H b/src/OSspecific/POSIX/regExp/regExpPosix.H index 09074d5fda..ea34fa8b8c 100644 --- a/src/OSspecific/POSIX/regExp/regExpPosix.H +++ b/src/OSspecific/POSIX/regExp/regExpPosix.H @@ -33,10 +33,21 @@ Description The PCRE '(?i)' extension is provided to compile the regular expression as being case-insensitive. -See also +SeeAlso The manpage regex(7) for more information about POSIX regular expressions. These differ somewhat from \c Perl and \c sed regular expressions. +SeeAlso + Foam::regExp and Foam::regExpCxx + +Warning + This class should not be used directly. + Use the Foam::regExp typedef instead. + +\deprecated + This class will be superseded by Foam::regExpCxx as compiler support + for regular expressions continues to improve. + SourceFiles regExpPosixI.H regExpPosix.C @@ -49,13 +60,6 @@ SourceFiles #include #include -// Transitional feature - support std::smatch as per C++11 regex -#undef Foam_regExpPosix_cxx - -#ifdef Foam_regExpPosix_cxx -#include -#endif - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -80,18 +84,13 @@ public: // Public Types - #ifdef Foam_regExpPosix_cxx - //- Type for matches, as per C++11 regex - typedef std::smatch results_type; - #else - //- Type for matches, use OpenFOAM SubStrings container + //- Type for matches - similar to std::smatch typedef SubStrings results_type; - #endif // Static Member Data - //- The default grammar (unused) - for future-compatibility + //- Grammar (unused) - for compatibility with Foam::regExpCxx static int grammar; diff --git a/src/OpenFOAM/primitives/strings/regex/regExpCxx.H b/src/OpenFOAM/primitives/strings/regex/regExpCxx.H index 0522912347..6bc3735a23 100644 --- a/src/OpenFOAM/primitives/strings/regex/regExpCxx.H +++ b/src/OpenFOAM/primitives/strings/regex/regExpCxx.H @@ -45,6 +45,10 @@ Note For example, gcc 4.8 is known to fail. For these systems the POSIX implementation or alternative must be used. +Warning + This class should not be used directly. + Use the Foam::regExp typedef instead. + SourceFiles regExpCxxI.H regExpCxx.C @@ -209,7 +213,6 @@ public: //- Assign and compile pattern from string. // Matching is case sensitive. inline void operator=(const std::string& pattern); - }; diff --git a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C index 08b762a575..0f9d181c2e 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C +++ b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C @@ -203,7 +203,7 @@ static void expandLeading(std::string& s) } else if (s[1] == '/') { - s.std::string::replace(0, 1, cwd()); + s.replace(0, 1, cwd()); } break; } @@ -651,13 +651,7 @@ static void expandString ) ); - s.std::string::replace - ( - replaceBeg, - varBeg - replaceBeg, - varValue - ); - + s.replace(replaceBeg, varBeg - replaceBeg, varValue); varBeg = replaceBeg+varValue.size(); } else @@ -677,12 +671,7 @@ static void expandString ) ); - s.std::string::replace - ( - varBeg, - varName.size()+1, - varValue - ); + s.replace(varBeg, varName.size()+1, varValue); varBeg += varValue.size(); } } @@ -842,29 +831,19 @@ void Foam::stringOps::inplaceExpand // Found and ":+" alternative // Not-found and ":-" alternative - s.std::string::replace - ( - varBeg, - varEnd - varBeg + 1, - altValue - ); + s.replace(varBeg, varEnd - varBeg + 1, altValue); varBeg += altValue.size(); } else if (fnd.found()) { // Found: use value - s.std::string::replace - ( - varBeg, - varEnd - varBeg + 1, - *fnd - ); + s.replace(varBeg, varEnd - varBeg + 1, *fnd); varBeg += (*fnd).size(); } else { // Not-found: empty value - s.std::string::erase(varBeg, varEnd - varBeg + 1); + s.erase(varBeg, varEnd - varBeg + 1); } } }