thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Utilities
StringUtils.h
1
// -*- C++ -*-
2
//
3
// StringUtils.h is a part of ThePEG - Toolkit for HEP Event Generation
4
// Copyright (C) 1999-2019 Leif Lonnblad
5
//
6
// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8
//
9
#ifndef ThePEG_StringUtils_H
10
#define ThePEG_StringUtils_H
11
// This is the declaration of the StringUtils class.
12
13
#include "
ThePEG/Config/ThePEG.h
"
14
15
namespace
ThePEG
{
16
21
class
StringUtils
{
22
23
public
:
24
28
typedef
vector<string>
StringVector
;
29
35
static
StringVector
split
(
string
s,
string
ws =
" \t\r\n"
);
36
42
static
string
car
(
string
s,
string
ws =
" \t\r\n"
);
43
49
static
string
cdr
(
string
s,
string
ws =
" \t\r\n"
);
50
55
static
string
stripws
(
string
str);
56
62
static
string
dirname
(
string
file);
63
68
static
string
basename
(
string
file);
69
73
static
string
remsuf
(
string
file);
74
79
static
string
suffix
(
string
file);
80
87
static
map<string,string>
xmlAttributes
(
string
tag,
string
line,
88
string::size_type curr = 0);
89
94
static
string
typeName
(
const
type_info & t);
95
100
static
string
replace
(
string
original,
string
from,
string
to);
101
105
typedef
string::size_type
pos_t
;
106
110
static
const
pos_t
end
= string::npos;
111
112
113
};
114
115
}
116
117
#endif
/* ThePEG_StringUtils_H */
ThePEG.h
This is the main config header file for ThePEG.
ThePEG::StringUtils
The StringUtils class contains a few static utility functions for basic strings.
Definition:
StringUtils.h:21
ThePEG::StringUtils::replace
static string replace(string original, string from, string to)
Replace all occurences of the substring 'from' with the substring 'to' in the string 'original' and r...
ThePEG::StringUtils::end
static const pos_t end
Convenient alias for npos.
Definition:
StringUtils.h:110
ThePEG::StringUtils::cdr
static string cdr(string s, string ws=" \t\r\n")
Return s after removing the first substring, defined by the separating characters in ws (the ws chara...
ThePEG::StringUtils::pos_t
string::size_type pos_t
Convenient typdef.
Definition:
StringUtils.h:105
ThePEG::StringUtils::car
static string car(string s, string ws=" \t\r\n")
Return the first substring of s, defined by the separating characters in ws (the ws characters are no...
ThePEG::StringUtils::basename
static string basename(string file)
Return the base name of the given filename, removing the directory path if present.
ThePEG::StringUtils::xmlAttributes
static map< string, string > xmlAttributes(string tag, string line, string::size_type curr=0)
Assuming the line contains a valid XML tag, scan the line for attributes belonging to this tag and re...
ThePEG::StringUtils::remsuf
static string remsuf(string file)
Remove the trailing suffix from the given filename.
ThePEG::StringUtils::split
static StringVector split(string s, string ws=" \t\r\n")
Return a vector of string containing the substrings of s, defined by the separating characters in ws ...
ThePEG::StringUtils::dirname
static string dirname(string file)
Return the directory path part (excluding the trailing slash) of the given filename,...
ThePEG::StringUtils::suffix
static string suffix(string file)
Return the trailing suffix (without the dot) of the given filename.
ThePEG::StringUtils::stripws
static string stripws(string str)
Return the string str stripped from leading and trailing white space.
ThePEG::StringUtils::typeName
static string typeName(const type_info &t)
Try to return a human-readable class name given a type_info object.
ThePEG::StringUtils::StringVector
vector< string > StringVector
A vector of strings.
Definition:
StringUtils.h:28
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
Generated on Thu Jun 20 2024 14:47:02 for ThePEG by
1.9.6