1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #include <cctype> // for toupper
13 #include <anna/core/util/String.hpp>
14 #include <anna/core/functions.hpp>
15 #include <anna/core//DataBlock.hpp>
20 void String::toUpper()
22 std::transform(begin(), end(), begin(), (int(*)(int)) toupper);
25 void String::toLower()
27 std::transform(begin(), end(), begin(), (int(*)(int)) tolower);
30 String& String::operator<< (const char* vv)
33 if(a_flags & Flag::ShowNull)
34 string::operator+= ("<null>");
36 string::operator+= (vv);
41 String& String::operator<< (const int vv)
44 sprintf(aux, "%d", vv);
45 string::operator+= (aux);
49 String& String::operator<< (const unsigned int vv)
52 sprintf(aux, "%u", vv);
53 string::operator+= (aux);
57 String& String::operator<< (const S64 vv)
60 //sprintf(aux, "%lld", vv);
62 sprintf (aux, "%ld", vv);
64 sprintf (aux, "%lld", vv);
66 string::operator+= (aux);
70 String& String::operator<< (const U64 vv)
73 //sprintf(aux, "%llu", vv);
75 sprintf (aux, "%lu", vv);
77 sprintf (aux, "%llu", vv);
79 string::operator+= (aux);
83 String& String::operator<< (const float vv)
86 sprintf(aux, "%f", vv);
87 string::operator+= (aux);
91 String& String::operator<< (const double vv)
94 sprintf(aux, "%e", vv);
95 string::operator+= (aux);
99 String& String::operator<< (const DataBlock& vv)
101 return *this += vv.asString();
105 String String::format(const DataBlock& vv, const int characterByLine)
107 return String(vv.asString(characterByLine));