Wrapper class around STL string class.
More...
#include <JString.hh>
|
template<class T , class... Args> |
void | __set__ (const T &value, const Args &...args) |
| Recursive method for formatting string. More...
|
|
void | __set__ () const |
| Termination method for formatting string. More...
|
|
Wrapper class around STL string class.
Definition at line 27 of file JString.hh.
JLANG::JString::JString |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 39 of file JString.hh.
JLANG::JString::JString |
( |
const std::string & |
buffer | ) |
|
|
inlineexplicit |
Constructor.
- Parameters
-
Definition at line 49 of file JString.hh.
JLANG::JString::JString |
( |
const char |
c | ) |
|
|
inlineexplicit |
Constructor.
- Parameters
-
Definition at line 59 of file JString.hh.
JLANG::JString::JString |
( |
const char * |
buffer, |
|
|
const std::string::size_type |
length |
|
) |
| |
|
inlineexplicit |
Constructor.
- Parameters
-
buffer | string |
length | length |
Definition at line 70 of file JString.hh.
71 std::string(buffer, length)
template<class T >
JLANG::JString::JString |
( |
const T & |
value | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 81 of file JString.hh.
static JString valueOf(const int input)
Convert enumeration type to string.
template<class... Args>
JLANG::JString::JString |
( |
const char * |
format, |
|
|
const Args &... |
args |
|
) |
| |
|
inline |
Constructor.
Each '' in the format string will be replaced by the corresponding argument.
- Parameters
-
Definition at line 94 of file JString.hh.
void __set__() const
Termination method for formatting string.
Constructor.
This constructor compiles (see below) the input string.
- Parameters
-
buffer | input string |
facet | facet |
Definition at line 108 of file JString.hh.
JString & compile(const JStringFacet &facet)
Compile token with given facet.
Compile token with given facet.
This method uses the given facet to parse the input string. The result is then compatible with the definition of a token and may be empty.
- Parameters
-
- Returns
- this string
Definition at line 123 of file JString.hh.
127 istringstream
is(*
this);
129 ios_base::iostate state;
131 facet.
get(
is, istreambuf_iterator<char>(),
is, state, *
this);
istreambuf_iterator get(const istreambuf_iterator __begin, const istreambuf_iterator __end, const std::ios_base &format, std::ios_base::iostate &result, std::string &buffer) const
Get string.
bool JLANG::JString::startsWith |
( |
const std::string & |
prefix | ) |
const |
|
inline |
Test if this string starts with the specified prefix.
- Parameters
-
- Returns
- true if this string starts with prefix; else false
Definition at line 144 of file JString.hh.
146 return this->size() >= prefix.size() && this->substr(0, prefix.size()) == prefix;
bool JLANG::JString::endsWith |
( |
const std::string & |
suffix | ) |
const |
|
inline |
Test if this string ends with the specified suffix.
- Parameters
-
- Returns
- true if this string ends with suffix; else false
Definition at line 156 of file JString.hh.
158 return this->size() >= suffix.size() && this->substr(this->size() - suffix.size()) == suffix;
JString& JLANG::JString::replace |
( |
const char |
target, |
|
|
const char |
replacement, |
|
|
const std::size_t |
max = std::numeric_limits<std::size_t>::max() |
|
) |
| |
|
inline |
Replace characters.
- Parameters
-
target | target character |
replacement | replacement character |
max | maximum number of replacements |
- Returns
- this string
Definition at line 170 of file JString.hh.
174 for (std::size_t i = this->find(target),
n = max; i != std::string::npos &&
n != 0; i = find(target,i), --
n) {
175 (*this)[i] = replacement;
alias put_queue eval echo n
JString& JLANG::JString::replace |
( |
const std::string & |
target, |
|
|
const std::string & |
replacement, |
|
|
const std::size_t |
max = std::numeric_limits<std::size_t>::max() |
|
) |
| |
|
inline |
Replace character sequences.
- Parameters
-
target | target string |
replacement | replacement string |
max | maximum number of replacements |
- Returns
- this string
Definition at line 190 of file JString.hh.
194 for (std::size_t i = this->find(target),
n = max; i != std::string::npos &&
n != 0; i = this->find(target,i), --
n) {
195 replace(this->begin() + i, this->begin() + i + target.length(), replacement);
alias put_queue eval echo n
JString & replace(const char target, const char replacement, const std::size_t max=std::numeric_limits< std::size_t >::max())
Replace characters.
template<class T >
JString& JLANG::JString::replace |
( |
const std::string & |
target, |
|
|
const T & |
value, |
|
|
const std::size_t |
max = std::numeric_limits<std::size_t>::max() |
|
) |
| |
|
inline |
Replace character sequence.
- Parameters
-
target | target string |
value | value |
max | maximum number of replacements |
- Returns
- this string
Definition at line 211 of file JString.hh.
215 for (std::size_t i = this->find(target),
n = max; i != std::string::npos &&
n != 0; i = this->find(target,i), --
n) {
216 replace(this->begin() + i, this->begin() + i + target.length(),
JString(value));
JString()
Default constructor.
alias put_queue eval echo n
JString & replace(const char target, const char replacement, const std::size_t max=std::numeric_limits< std::size_t >::max())
Replace characters.
Trim string.
Returns the modified string, with leading and trailing white spaces omitted.
- Returns
- this string
Definition at line 229 of file JString.hh.
std::string trim(const std::string &buffer)
Trim string.
JString& JLANG::JString::trim |
( |
const char |
c | ) |
|
|
inline |
Trim string.
Returns the modified string, with leading and trailing target characters omitted.
- Parameters
-
- Returns
- this string
Definition at line 244 of file JString.hh.
std::string trim(const std::string &buffer)
Trim string.
JString JLANG::JString::trim |
( |
const std::string & |
target | ) |
|
|
inline |
Trim string.
Returns the modified string, with leading and trailing target characters omitted.
- Parameters
-
target | character(s) to strip |
- Returns
- this string
Definition at line 259 of file JString.hh.
std::string trim(const std::string &buffer)
Trim string.
JString& JLANG::JString::toUpper |
( |
| ) |
|
|
inline |
Convert all character to upper case.
- Returns
- this string
Definition at line 272 of file JString.hh.
274 for (
iterator i = begin(); i != end(); ++i) {
JString& JLANG::JString::toLower |
( |
| ) |
|
|
inline |
Convert all character to lower case.
- Returns
- this string
Definition at line 287 of file JString.hh.
289 for (
iterator i = begin(); i != end(); ++i) {
static JString JLANG::JString::valueOf |
( |
const int |
input | ) |
|
|
inlinestatic |
Convert enumeration type to string.
- Parameters
-
- Returns
- string
Definition at line 303 of file JString.hh.
305 std::ostringstream os;
JString()
Default constructor.
template<class T >
static JString JLANG::JString::valueOf |
( |
const T & |
input | ) |
|
|
inlinestatic |
Convert value to string.
- Parameters
-
- Returns
- string
Definition at line 321 of file JString.hh.
323 std::ostringstream os;
JString()
Default constructor.
template<class T >
static const T& JLANG::JString::toValue |
( |
const JString & |
input | ) |
|
|
inlinestatic |
Convert string to value.
- Parameters
-
- Returns
- value
Definition at line 339 of file JString.hh.
343 std::istringstream
is(input);
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T >
JString& JLANG::JString::assign |
( |
T & |
output | ) |
|
|
inline |
Assign (part of) string to value.
- Parameters
-
- Returns
- remaining string
Definition at line 359 of file JString.hh.
363 istringstream
is(*
this);
371 this->
assign(istreambuf_iterator<char>(
is),
372 istreambuf_iterator<char>());
JString & assign(T &output)
Assign (part of) string to value.
template<class T , class... Args>
void JLANG::JString::__set__ |
( |
const T & |
value, |
|
|
const Args &... |
args |
|
) |
| |
|
inlineprivate |
Recursive method for formatting string.
- Parameters
-
value | next value |
args | remaining values |
Definition at line 448 of file JString.hh.
452 const size_t pos = this->find(
'%');
454 if (pos != string::npos) {
void __set__() const
Termination method for formatting string.
static JString valueOf(const int input)
Convert enumeration type to string.
JString & replace(const char target, const char replacement, const std::size_t max=std::numeric_limits< std::size_t >::max())
Replace characters.
void JLANG::JString::__set__ |
( |
| ) |
const |
|
inlineprivate |
Termination method for formatting string.
Definition at line 466 of file JString.hh.
std::istream& operator>> |
( |
std::istream & |
in, |
|
|
JString & |
object |
|
) |
| |
|
friend |
Read string from input stream.
- Parameters
-
in | input stream |
object | string |
- Returns
- input stream
Definition at line 385 of file JString.hh.
389 istream::sentry sentry(
in);
393 const locale&
loc =
in.getloc();
395 if (has_facet<JStringFacet>(loc)) {
397 ios_base::iostate state;
399 use_facet<JStringFacet>(
loc).
get(
in, istreambuf_iterator<char>(),
in, state, object);
401 if (state != ios_base::goodbit && state != ios_base::eofbit) {
407 in >>
static_cast<string&
>(object);
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const JString & |
object |
|
) |
| |
|
friend |
Write string to output stream.
- Parameters
-
out | output stream |
object | string |
- Returns
- output stream
Definition at line 422 of file JString.hh.
426 const locale&
loc = out.getloc();
428 if (has_facet<JStringFacet>(
loc)) {
430 use_facet<JStringFacet>(
loc).put(out, out, out.fill(), object);
434 out << static_cast<const string&>(object);
The documentation for this class was generated from the following file: