51bool G::format::isdigit(
char c )
54 return c >=
'0' && c <=
'9' ;
59 std::string s = m_fmt ;
60 const std::size_t npos = std::string::npos ;
61 for( std::size_t p = s.find(
'%') ; p != npos && (p+2U) < s.size() ; )
63 std::size_t q = s.find(
'%' , p+1 ) ;
64 if( q != npos && q == (p+2U) && isdigit(s.at(p+1U)) )
67 if( n && n <= m_values.size() )
69 s.replace( p , 3U , m_values.at(n-1U) ) ;
70 p += m_values.at(n-1U).size() ;
81 p = p < s.size() ? s.find(
'%',p) : npos ;
91void G::format::apply(
const std::string & value )
93 m_values.push_back( value ) ;
96std::ostream & G::operator<<( std::ostream & stream ,
const format & f )
98 return stream << f.str() ;
static unsigned int toUInt(const std::string &s)
Converts string 's' to an unsigned int.