123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- #ifndef BOOST_FORMAT_CLASS_HPP
- #define BOOST_FORMAT_CLASS_HPP
- #include <vector>
- #include <string>
- #include <boost/format/format_fwd.hpp>
- #include <boost/format/internals_fwd.hpp>
- #include <boost/format/internals.hpp>
- namespace boost {
- class basic_format
- {
- public:
- typedef std::string string_t;
- typedef BOOST_IO_STD ostringstream internal_stream_t;
- private:
- typedef BOOST_IO_STD ostream stream_t;
- typedef io::detail::stream_format_state stream_format_state;
- typedef io::detail::format_item format_item_t;
- public:
- basic_format(const char* str);
- basic_format(const string_t& s);
- #ifndef BOOST_NO_STD_LOCALE
- basic_format(const char* str, const std::locale & loc);
- basic_format(const string_t& s, const std::locale & loc);
- #endif
- basic_format(const basic_format& x);
- basic_format& operator= (const basic_format& x);
- basic_format& clear();
-
- template<class T> basic_format& operator%(const T& x)
- {
- return io::detail::feed<const T&>(*this,x);
- }
- #ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
- template<class T> basic_format& operator%(T& x)
- {
- return io::detail::feed<T&>(*this,x);
- }
- #endif
-
- template<class T>
- basic_format& bind_arg(int argN, const T& val)
- {
- return io::detail::bind_arg_body(*this, argN, val);
- }
- basic_format& clear_bind(int argN);
- basic_format& clear_binds();
-
- template<class T>
- basic_format& modify_item(int itemN, const T& manipulator)
- {
- return io::detail::modify_item_body(*this, itemN, manipulator) ;
- }
-
- unsigned char exceptions() const;
- unsigned char exceptions(unsigned char newexcept);
-
- string_t str() const;
- friend BOOST_IO_STD ostream&
- operator<< ( BOOST_IO_STD ostream& , const basic_format& );
-
- template<class T> friend basic_format&
- io::detail::feed(basic_format&, T);
-
- template<class T> friend
- void io::detail::distribute(basic_format&, T);
-
- template<class T> friend
- basic_format& io::detail::modify_item_body(basic_format&, int, const T&);
- template<class T> friend
- basic_format& io::detail::bind_arg_body(basic_format&, int, const T&);
- private:
-
- enum style_values { ordered = 1,
- special_needs = 4 };
-
- void parse(const string_t&);
- int style_;
- int cur_arg_;
- int num_args_;
- mutable bool dumped_;
- std::vector<format_item_t> items_;
- string_t prefix_;
- std::vector<bool> bound_;
-
- internal_stream_t oss_;
- stream_format_state state0_;
- unsigned char exceptions_;
- };
- }
- #endif
|