36 #ifndef STRING_UTILITY_H 37 #define STRING_UTILITY_H 46 #include <boost/algorithm/string.hpp> 47 #include <boost/lexical_cast.hpp> 50 #include <lifev/core/LifeV.hpp> 62 std::istream&
eatLine ( std::istream& s );
66 std::istream& nextGoodLine ( std::istream& s, std::string& line );
72 std::string& setStringLength ( std::string& s,
unsigned int len,
char c );
76 int atoi (
const std::string& s );
78 std::string operator+ (
const std::string& str,
const int i );
79 std::string
operator+ (
const std::string& str,
const long int i );
80 std::string operator+ (
const std::string& str,
const unsigned int i );
82 template <
typename EntryType>
83 void parseList (
const std::string& slist, std::list<EntryType>& list )
85 std::string stringList = slist;
93 while ( commaPos != (
int) std::string::npos )
95 commaPos = stringList.find (
"," );
97 std::stringstream stream;
98 stream << stringList.substr ( 0, commaPos ).c_str();
102 list.push_back ( var );
104 stringList = stringList.substr ( commaPos + 1 );
110 inline Real string2number (
const std::string& s )
112 std::stringstream out;
126 template <
typename NumberType>
127 inline std::string number2string (
const NumberType& n )
129 return boost::lexical_cast< std::string > ( n );
135 template <
typename EnumeratorType >
136 inline std::string enum2String (
const EnumeratorType& Enum,
137 const std::map < std::string,
138 EnumeratorType > & Map )
140 for (
typename std::map<std::string, EnumeratorType>::const_iterator j = Map.begin(); j != Map.end() ; ++j )
141 if ( j->second == Enum )
146 return "NO_TYPE_FOUND";
151 template<
typename NumberType >
152 void string2numbersVector (
const std::string& string,
153 std::vector< NumberType >& numberVector )
156 std::vector< std::string > stringVector;
157 boost::split ( stringVector, string, boost::is_any_of (
"," ) );
160 for ( UInt i ( 0 ); i <
static_cast<UInt> ( stringVector.size() ); ++i )
162 numberVector.push_back (
static_cast<NumberType> ( std::atoi ( stringVector[i].c_str() ) ) );
std::istream & eatLine(std::istream &s)
std::string operator+(const std::string &str, const long i)
void updateInverseJacobian(const UInt &iQuadPt)
std::istream & eatComments(std::istream &s)
skip lines starting with '!%#;$'
double Real
Generic real data.