71 template<
class T>
struct Hash;
94 template<
class PrimitiveType>
99 const PrimitiveType& val
103 template<
class PrimitiveType>
107 const std::string& fmt,
108 const PrimitiveType& val
126 inline bool has_ext(
const char* ending)
const;
129 inline bool has_ext(
const std::string& ending)
const;
148 unsigned operator()(
const std::string& str,
unsigned seed=0)
const 168 static const string null;
177 inline string(
const std::string& str);
180 inline string(std::string&& str);
183 inline string(
const char* str);
189 inline explicit string(
const char c);
201 template<
class StringType>
202 static inline bool valid(
const std::string& str);
205 template<
class StringType>
209 template<
class StringType>
210 static inline StringType
validate(
const std::string& str);
217 inline bool match(
const std::string& text)
const;
220 using std::string::replace;
226 const std::string& s1,
227 const std::string& s2,
236 const std::string& s1,
237 const std::string& s2,
246 const std::string& s1,
257 string&
expand(
const bool allowEmpty =
false);
283 inline void swap(std::string& str);
290 inline bool operator()(
const std::string& text)
const;
298 return (
find(
c) != std::string::npos);
304 return (
find(
s) != std::string::npos);
310 return (
find(
s) != std::string::npos);
316 return (!empty() && front() ==
c);
322 return (size() >=
s.size() && !compare(0,
s.size(),
s));
328 const auto len = strlen(
s);
329 return (size() >= len && !compare(0, len,
s, len));
335 return (!empty() && back() ==
c);
341 return (size() >=
s.size() && !compare(size()-
s.size(), npos,
s));
347 const auto len = strlen(
s);
348 return (size() >= len && !compare(size()-len, npos,
s, len));
373 template<>
struct Hash<string> : string::hasher {};
376 template<>
struct Hash<
std::string> : string::hasher {};
384 Istream&
operator>>(Istream& is,
string& val);
string & replace(const std::string &s1, const std::string &s2, size_type pos=0)
Replace first occurrence of sub-string s1 with s2, beginning at pos.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as ListOps::find_if.
std::string::size_type find_ext() const
Find position of a file extension dot, return npos on failure.
bool contains(char c) const noexcept
True if string contains given character (cf. C++23)
Deprecated hashing functor - use hasher.
bool operator()(const std::string &text) const
Test for equality. Allows use as a predicate.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
static std::string::size_type string_printf(std::string &output, const char *fmt, const PrimitiveType &val)
A printf-style formatter for a primitive.
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
bool endsWith(const std::string &s) const
Deprecated(2019-11)
unsigned operator()(const std::string &str, unsigned seed=0) const
bool match(const std::string &text) const
Test for equality.
A character and a pointer to a character string.
static const char *const typeName
The type name "string".
dimensionedScalar pos(const dimensionedScalar &ds)
bool ends_with(char c) const
True if string ends with given character (cf. C++20)
bool has_ext() const
Return true if it has an extension or simply ends with a '.'.
static bool valid(const std::string &str)
Does the string contain valid characters only?
static int debug
The debug flag.
A class for handling words, derived from Foam::string.
word ext() const
Return file name extension (part after last .)
Istream & operator>>(Istream &, directionInfo &)
bool removeTrailing(const char c)
Deprecated(2019-11)
string & replaceAny(const std::string &s1, const char c2, size_type pos=0)
Replace any occurrence of s1 characters with c2, beginning at pos in the string.
graph_traits< Graph >::vertices_size_type size_type
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
bool removeRepeated(const char character)
Remove repeated characters.
bool startsWith(const std::string &s) const
Deprecated(2019-11)
static const string null
An empty string.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
static bool stripInvalid(std::string &str)
Strip invalid characters from the given string.
Hashing functor for string and derived string classes.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
bool remove_path()
Remove leading path, return true if string changed.
bool starts_with(char c) const
True if string starts with given character (cf. C++20)
string & replaceAll(const std::string &s1, const std::string &s2, size_type pos=0)
Replace all occurrences of sub-string s1 with s2, beginning at pos in the string. ...
unsigned Hasher(const void *data, size_t len, unsigned seed=0)
Bob Jenkins's 96-bit mixer hashing function (lookup3)
size_type count(const char c) const
Count the number of occurrences of the specified character in the string.
string & expand(const bool allowEmpty=false)
Inplace expand initial tags, tildes, and all occurrences of environment variables as per stringOps::e...
Miscellaneous hashing functions, mostly from Bob Jenkins.
const dimensionedScalar c
Speed of light in a vacuum.
bool removeStart(const std::string &text)
Remove the given text from the start of the string.
static Ostream & output(Ostream &os, const IntRange< T > &range)
void swap(std::string &str)
Swap contents. Self-swapping is a no-op.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A class for handling character strings derived from std::string.
string()=default
Default construct.
bool removeEnd(const std::string &text)
Remove the given text from the end of the string.
static StringType validate(const std::string &str)
Return a valid String from the given string.
bool remove_ext()
Remove extension, return true if string changed.