1 #ifndef __DIADES__UTILS__STRINGTOOLS__HH 2 #define __DIADES__UTILS__STRINGTOOLS__HH 37 for(
unsigned i = 0; i < std::string::npos; ++i)
40 hash = ((hash << 5) + hash) + c;
55 template<
class CharType,
class CharTraits,
class InputIterator>
58 InputIterator begin, InputIterator end)
60 typedef std::basic_string<CharType, CharTraits> String;
62 idx = fileName.find_last_of(
'.');
63 if(idx != String::npos)
65 String suffix = fileName.substr(idx + 1);
67 while((!found) && (begin != end))
69 found = (suffix == *begin);
90 template<
class CharType,
class CharTraits>
93 typename std::basic_string<CharType, CharTraits>::size_type & index)
96 bool foundSomething =
false;
97 while(!foundSomething && index != sequence.size())
99 foundSomething = (sequence.at(index) !=
' ')
101 (sequence.at(index) !=
'\t');
109 index = std::basic_string<CharType, CharTraits>::npos;
111 return !foundSomething;
128 template<
typename CharT,
135 typedef std::basic_string<CharT, Traits, Alloc>
String;
142 return std::move(str1) + separator + str2;
158 template<
typename CharT,
167 typedef std::basic_string<CharT, Traits, Alloc>
String;
174 return left + std::move(str) + right;
184 template<
typename CharT,
191 typedef std::basic_string<CharT, Traits, Alloc>
String;
198 return std::move(str);
216 template<
typename _Property,
typename BinaryDisjunction,
typename Delimiter>
222 template<
typename PropertyIterator>
228 result = std::accumulate(++begin, end, *begin, BinaryDisjunction());
230 return Delimiter()(result);
248 template<
typename _Property,
typename BinaryConjunction,
typename Delimiter>
254 template<
typename PropertyIterator>
260 result = std::accumulate(++begin, end, *begin, BinaryConjunction());
262 return Delimiter()(result);
std::basic_string< CharT, Traits, Alloc > String
InputIterator getFileExtension(const std::basic_string< CharType, CharTraits > &fileName, InputIterator begin, InputIterator end)
std::basic_string< CharT, Traits, Alloc > String
Property operator()(PropertyIterator begin, PropertyIterator end)
String operator()(String str1, const String &str2) const
size_t operator()(const std::string &s) const
String operator()(String str) const
std::basic_string< CharT, Traits, Alloc > String
Property operator()(PropertyIterator begin, PropertyIterator end) const
Namespace of the Diades project.
String operator()(String str) const
bool hasOnlyWhiteSpaces(const std::basic_string< CharType, CharTraits > &sequence, typename std::basic_string< CharType, CharTraits >::size_type &index)