21 #include <boost/tokenizer.hpp> 60 typedef boost::escaped_list_separator<char> Separator;
61 typedef boost::tokenizer<Separator> BT;
73 std::streampos file_position_;
74 unsigned int line_counter_;
75 unsigned int line_position_;
79 file_position_(0), line_counter_(0), line_position_(0) {}
82 Position(std::streampos file_pos,
unsigned int line,
unsigned int line_pos):
83 file_position_(file_pos), line_counter_(line), line_position_(line_pos) {}
94 Tokenizer(
const FilePath &fp, Separator separator = Separator(
"\\",
" \t",
"\"") );
105 Tokenizer( std::istream &in, Separator separator = Separator(
"\\",
" \t",
"\"") );
112 void set_comment_pattern(
const std::string &pattern);
124 bool skip_to(
const std::string &pattern,
const std::string &end_search_pattern=
"");
137 bool next_line(
bool assert_for_remaining_tokens=
true);
147 inline BT::iterator & operator ++() {
148 if (! eol()) {position_.line_position_++; ++tok_;}
150 while (! eol() && (*tok_).size()==0 ) {position_.line_position_++; ++tok_;}
157 inline bool eol()
const 158 {
return tok_ == line_tokenizer_.end(); }
163 inline bool eof()
const 164 {
return in_->eof(); }
169 inline unsigned int pos()
const 170 {
return position_.line_position_;}
176 inline unsigned int line_num()
const 177 {
return position_.line_counter_;}
182 inline const std::string &f_name()
const 188 std::string position_msg()
const;
193 inline const std::string &line()
const 199 const Tokenizer::Position get_position();
207 void set_position(
const Tokenizer::Position pos);
216 void set_tokenizer();
224 std::ifstream *own_stream_;
230 std::string comment_pattern_;
238 Separator separator_;
UnitSI operator*(const UnitSI &a, const UnitSI &b)
Product of two units.
Dedicated class for storing path to input and output files.