11 #include <boost/tokenizer.hpp>
50 typedef boost::escaped_list_separator<char> Separator;
51 typedef boost::tokenizer<Separator> BT;
63 std::streampos file_position_;
64 unsigned int line_counter_;
65 unsigned int line_position_;
69 file_position_(0), line_counter_(0), line_position_(0) {}
72 Position(std::streampos file_pos,
unsigned int line,
unsigned int line_pos):
73 file_position_(file_pos), line_counter_(line), line_position_(line_pos) {}
95 Tokenizer( std::istream &in);
102 void set_comment_pattern(
const std::string &pattern);
114 bool skip_to(
const std::string &pattern,
const std::string &end_search_pattern=
"");
127 bool next_line(
bool assert_for_remaining_tokens=
true);
137 inline BT::iterator & operator ++() {
138 if (! eol()) {position_.line_position_++; ++tok_;}
140 while (! eol() && (*tok_).size()==0 ) {position_.line_position_++; ++tok_;}
147 inline bool eol()
const
148 {
return tok_ == line_tokenizer_.end(); }
153 inline bool eof()
const
154 {
return in_->eof(); }
159 inline unsigned int pos()
const
160 {
return position_.line_position_;}
166 inline unsigned int line_num()
const
167 {
return position_.line_counter_;}
172 inline const std::string &f_name()
const
178 std::string position_msg()
const;
183 inline const std::string &
line()
const
189 const Tokenizer::Position get_position();
197 void set_position(
const Tokenizer::Position pos);
206 void set_tokenizer();
211 std::ifstream *own_stream_;
217 std::string comment_pattern_;
225 Separator separator_;
UnitSI operator*(const UnitSI &a, const UnitSI &b)
Product of two units.
Dedicated class for storing path to input and output files.