14 #ifndef BOOST_FORMAT_PARSING_HPP 15 #define BOOST_FORMAT_PARSING_HPP 28 #if defined(BOOST_NO_STD_LOCALE) 32 return const_cast<T&
> (
x);
41 template<
class Ch,
class Facet>
inline 46 template<
class Ch,
class Facet>
inline 48 #if ! defined( BOOST_NO_LOCALE_ISDIGIT ) 49 return fac.is(std::ctype<Ch>::digit, c);
57 template<
class Iter,
class Facet>
69 template<
class Res,
class Iter,
class Facet>
89 template<
class Iter,
class Facet>
95 if(start!=last && *start==
const_or_not(fac).widen(
'$') )
105 std::size_t
pos, std::size_t
size)
122 template<
class Ch,
class Tr,
class Alloc,
class Iter,
class Facet>
126 std::size_t
offset,
unsigned char exceptions)
130 fpar->
argN_ = format_item_t::argN_no_posit;
131 bool precision_set =
false;
132 bool in_brackets=
false;
134 std::size_t fstring_size = last-start0+
offset;
143 if( ++start >= last ) {
156 start =
str2int(start, last, n, fac);
157 if( start >= last ) {
180 fpar->
argN_ = format_item_t::argN_no_posit;
181 goto parse_precision;
187 while ( start != last) {
201 fpar->
fmtstate_.flags_ |= std::ios_base::internal;
207 fpar->
fmtstate_.flags_ |= std::ios_base::showpos;
215 fpar->
fmtstate_.flags_ |= std::ios_base::showpoint | std::ios_base::showbase;
243 if(start != last && *start ==
const_or_not(fac).widen(
'*') )
247 precision_set =
true;
254 while( start != last && ( *start==
const_or_not(fac).widen(
'l')
263 if( in_brackets && *start==
const_or_not(fac).widen(
'|') ) {
269 fpar->
fmtstate_.flags_ |= std::ios_base::uppercase;
273 fpar->
fmtstate_.flags_ |= std::ios_base::hex;
278 fpar->
fmtstate_.flags_ |= std::ios_base::oct;
282 fpar->
fmtstate_.flags_ |= std::ios_base::uppercase;
285 fpar->
fmtstate_.flags_ |= std::ios_base::scientific;
288 fpar->
fmtstate_.flags_ |= std::ios_base::dec;
293 fpar->
fmtstate_.flags_ |= std::ios_base::fixed;
298 fpar->
fmtstate_.flags_ |= std::ios_base::dec;
308 fpar->
argN_ = format_item_t::argN_tabulation;
313 fpar->
argN_ = format_item_t::argN_tabulation;
317 fpar->
fmtstate_.flags_ |= std::ios_base::uppercase;
321 fpar->
fmtstate_.flags_ |= std::ios_base::dec;
338 fpar->
argN_ = format_item_t::argN_ignored;
346 if( start != last && *start==
const_or_not(fac).widen(
'|') ) {
356 template<
class String,
class Facet>
358 const typename String::value_type arg_mark,
360 unsigned char exceptions)
365 typename String::size_type
i1=0;
367 while( (i1=buf.find(arg_mark,i1)) != String::npos ) {
368 if( i1+1 >= buf.size() ) {
376 if(buf[i1+1] == buf[i1] ) {
383 if( i1 < buf.size() && buf[
i1] == arg_mark )
389 template<
class String>
inline 391 const typename String::size_type beg,
392 const typename String::size_type
end) {
393 dst.append(src.begin()+beg, src.begin()+
end);
404 template<
class Ch,
class Tr,
class Alloc>
409 #if !defined(BOOST_NO_STD_LOCALE) 410 const std::ctype<Ch> & fac =
BOOST_USE_FACET( std::ctype<Ch>, getloc());
417 bool ordered_args=
true;
422 make_or_reuse_data(num_items);
426 typename string_type::size_type i0=0,
i1=0;
427 typename string_type::const_iterator
it;
428 bool special_things=
false;
430 while( (
i1=buf.find(arg_mark,
i1)) != string_type::npos ) {
431 string_type & piece = (cur_item==0) ? prefix_ : items_[cur_item-1].appendix_;
432 if( buf[
i1+1] == buf[
i1] ) {
437 BOOST_ASSERT( static_cast<unsigned int>(cur_item) < items_.size() || cur_item==0);
446 it, buf.end(), &items_[cur_item], fac,
i1, exceptions());
447 i1 = it - buf.begin();
451 items_[cur_item].compute_states();
453 int argN=items_[cur_item].argN_;
454 if(argN == format_item_t::argN_ignored)
456 if(argN ==format_item_t::argN_no_posit)
458 else if(argN == format_item_t::argN_tabulation) special_things=
true;
459 else if(argN > max_argN) max_argN = argN;
467 string_type & piece = (cur_item==0) ? prefix_ : items_[cur_item-1].appendix_;
479 int non_ordered_items = 0;
480 for(
int i=0;
i< num_items; ++
i)
481 if(items_[
i].argN_ == format_item_t::argN_no_posit) {
482 items_[
i].argN_ = non_ordered_items;
485 max_argN = non_ordered_items-1;
491 if(special_things) style_ |= special_needs;
492 num_args_ = max_argN + 1;
493 if(ordered_args) style_ |= ordered;
494 else style_ &= ~ordered;
501 #endif // BOOST_FORMAT_PARSING_HPP
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
void maybe_throw_exception(unsigned char exceptions, std::size_t pos, std::size_t size)
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
const T & const_or_not(const T &x)
Iter str2int(const Iter &start, const Iter &last, Res &res, const Facet &fac)
BOOST_NORETURN void throw_exception(E const &e)
::std_msgs::String_< std::allocator< void > > String
int upper_bound_from_fstring(const String &buf, const typename String::value_type arg_mark, const Facet &fac, unsigned char exceptions)
void append_string(String &dst, const String &src, const typename String::size_type beg, const typename String::size_type end)
GLenum GLuint GLenum GLsizei const GLchar * buf
bool parse_printf_directive(Iter &start, const Iter &last, detail::format_item< Ch, Tr, Alloc > *fpar, const Facet &fac, std::size_t offset, unsigned char exceptions)
bool wrap_isdigit(const Facet &fac, Ch c)
#define BOOST_USE_FACET(Type, loc)
Iter wrap_scan_notdigit(const Facet &fac, Iter beg, Iter end)
#define BOOST_ASSERT(expr)
Iter skip_asterisk(Iter start, Iter last, const Facet &fac)
char wrap_narrow(const Facet &fac, Ch c, char deflt)