Boost-Geometry-Utils
view release on metacpan or search on metacpan
src/boost/format/format_implementation.hpp view on Meta::CPAN
template< class Ch, class Tr, class Alloc>
io::detail::locale_t basic_format<Ch, Tr, Alloc>::
getloc() const {
return loc_ ? loc_.get() : io::detail::locale_t();
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const string_type& s)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
exceptions_(io::all_error_bits)
{
parse(s);
}
template< class Ch, class Tr, class Alloc> // just don't copy the buf_ member
basic_format<Ch, Tr, Alloc>:: basic_format(const basic_format& x)
: items_(x.items_), bound_(x.bound_), style_(x.style_),
cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(x.dumped_),
prefix_(x.prefix_), exceptions_(x.exceptions_), loc_(x.loc_)
{
}
template< class Ch, class Tr, class Alloc> // just don't copy the buf_ member
basic_format<Ch, Tr, Alloc>& basic_format<Ch, Tr, Alloc>::
operator= (const basic_format& x) {
if(this == &x)
return *this;
(basic_format<Ch, Tr, Alloc>(x)).swap(*this);
return *this;
}
template< class Ch, class Tr, class Alloc>
void basic_format<Ch, Tr, Alloc>::
swap (basic_format & x) {
std::swap(exceptions_, x.exceptions_);
std::swap(style_, x.style_);
std::swap(cur_arg_, x.cur_arg_);
std::swap(num_args_, x.num_args_);
std::swap(dumped_, x.dumped_);
items_.swap(x.items_);
prefix_.swap(x.prefix_);
bound_.swap(x.bound_);
}
template< class Ch, class Tr, class Alloc>
unsigned char basic_format<Ch,Tr, Alloc>:: exceptions() const {
return exceptions_;
}
template< class Ch, class Tr, class Alloc>
unsigned char basic_format<Ch,Tr, Alloc>:: exceptions(unsigned char newexcept) {
unsigned char swp = exceptions_;
exceptions_ = newexcept;
return swp;
}
template<class Ch, class Tr, class Alloc>
void basic_format<Ch, Tr, Alloc>::
make_or_reuse_data (std::size_t nbitems) {
#if !defined(BOOST_NO_STD_LOCALE)
Ch fill = ( BOOST_USE_FACET(std::ctype<Ch>, getloc()) ). widen(' ');
#else
Ch fill = ' ';
#endif
if(items_.size() == 0)
items_.assign( nbitems, format_item_t(fill) );
else {
if(nbitems>items_.size())
items_.resize(nbitems, format_item_t(fill));
bound_.resize(0);
for(std::size_t i=0; i < nbitems; ++i)
items_[i].reset(fill); // strings are resized, instead of reallocated
}
prefix_.resize(0);
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
clear () {
// empty the string buffers (except bound arguments)
// and make the format object ready for formatting a new set of arguments
BOOST_ASSERT( bound_.size()==0 || num_args_ == static_cast<int>(bound_.size()) );
for(unsigned long i=0; i<items_.size(); ++i) {
// clear converted strings only if the corresponding argument is not bound :
if( bound_.size()==0 || items_[i].argN_<0 || !bound_[ items_[i].argN_ ] )
items_[i].res_.resize(0);
}
cur_arg_=0; dumped_=false;
// maybe first arg is bound:
if(bound_.size() != 0) {
for(; cur_arg_ < num_args_ && bound_[cur_arg_]; ++cur_arg_)
{}
}
return *this;
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
clear_binds () {
// remove all binds, then clear()
bound_.resize(0);
clear();
return *this;
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
clear_bind (int argN) {
// remove the bind of ONE argument then clear()
if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] ) {
if( exceptions() & io::out_of_range_bit)
boost::throw_exception(io::out_of_range(argN, 1, num_args_+1 ) );
else return *this;
}
bound_[argN-1]=false;
clear();
return *this;
}
( run in 0.764 second using v1.01-cache-2.11-cpan-39bf76dae61 )