// -*- C++ -*- // Boost general library 'format' --------------------------- // See http://www.boost.org for updates, documentation, and revision history. // (C) Samuel Krempp 2001 // krempp@crans.ens-cachan.fr // Permission to copy, use, modify, sell and // distribute this software is granted provided this copyright notice appears // in all copies. This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // ideas taken from Rüdiger Loos's format class // and Karl Nelson's ofstream // ---------------------------------------------------------------------------- // feed_args.hpp : functions for processing each argument // (feed, feed_manip, and distribute) // ---------------------------------------------------------------------------- #ifndef BOOST_FORMAT_FEED_ARGS_HPP #define BOOST_FORMAT_FEED_ARGS_HPP #include "boost/format/format_class.hpp" #include
aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/linux.scm6
1 files changed, 3 insertions, 3 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm>= 0) res.erase(specs.truncate_); if( res.size() - w > 0) { // length w exceeded // either it was multi-output with first output padding up all width.. // either it was one big arg and we are fine. empty_buf( oss_); oss_.width(0); put_last(oss_, x ); string_t tmp = oss_.str(); // minimal-length output std::streamsize d; if( (d=w - tmp.size()) <=0 ) { // minimal length is already >= w, so no padding (cool!) res.swap(tmp); } else { // hum.. we need to pad (it was necessarily multi-output) typedef typename string_t::size_type size_type; size_type i = 0; while( i( d ), oss_.fill()); res.swap( tmp ); } } else { // okay, only one thing was printed and padded, so res is fine. } } prev_state.apply_on(oss_); empty_buf( oss_); oss_.clear(); } // end- put(..) } // local namespace template void distribute(basic_format& self, T x) // call put(x, ..) on every occurence of the current argument : { if(self.cur_arg_ >= self.num_args_) { if( self.exceptions() & too_many_args_bit ) boost::throw_exception(too_many_args()); // too many variables have been supplied ! else return; } for(unsigned long i=0; i < self.items_.size(); ++i) { if(self.items_[i].argN_ == self.cur_arg_) { put (x, self.items_[i], self.items_[i].res_, self.oss_ ); } } } template basic_format& feed(basic_format& self, T x) { if(self.dumped_) self.clear(); distribute (self, x); ++self.cur_arg_; if(self.bound_.size() != 0) { while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] ) ++self.cur_arg_; } // this arg is finished, reset the stream's format state self.state0_.apply_on(self.oss_); return self; } } // namespace detail } // namespace io } // namespace boost #endif // BOOST_FORMAT_FEED_ARGS_HPP