19 #ifndef OST_IO_STAR_PARSER_HH
20 #define OST_IO_STAR_PARSER_HH
32 namespace ost {
namespace io {
38 category_(category), name_(name), value_(value)
55 int GetIndex(
const String& name)
const
57 std::map<String, int>::const_iterator i=index_map_.find(name);
58 return i==index_map_.end() ? -1 : i->second;
63 category_=category.
str();
68 index_map_.insert(std::make_pair(name.
str(), index_map_.size()));
70 size_t GetSize()
const
72 return index_map_.size();
77 std::map<String, int> index_map_;
116 const std::vector<StringRef>& columns)
134 static bool SplitLine(
const StringRef& line,
135 std::vector<StringRef>& parts,
bool clear=
true);
142 if (std::getline(stream_, current_line_)) {
143 str=
StringRef(current_line_.data(), current_line_.length());
145 has_current_line_=
true;
151 bool GetLine(StringRef& ref)
153 if (has_current_line_) {
154 ref=StringRef(current_line_.data(), current_line_.size());
157 return this->NextLine(ref);
162 assert(has_current_line_);
163 has_current_line_=
false;
167 void ParseDataItem();
168 void DiagnoseUnknown();
169 bool ParseMultilineValue(
String& value,
bool skip=
false);
170 std::istream& stream_;
172 bool has_current_line_;