diff options
author | vng <viktor.govako@gmail.com> | 2011-11-25 00:28:17 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:28:44 +0300 |
commit | 65530f86918698ec5cc6dbdd408e6295c28f7c1a (patch) | |
tree | 2b95e76f79c16a60b38e0b1a95ac72bebadfba8f /indexer/types_mapping.cpp | |
parent | c11367ac7accbbff694befc754132c3da8b76540 (diff) |
Avoid overhead in classificator reading (read to string -> istringstream).
Add reading of binary proto drawing rules.
Diffstat (limited to 'indexer/types_mapping.cpp')
-rw-r--r-- | indexer/types_mapping.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/indexer/types_mapping.cpp b/indexer/types_mapping.cpp index e25029d3a0..ed9a8382f7 100644 --- a/indexer/types_mapping.cpp +++ b/indexer/types_mapping.cpp @@ -5,26 +5,25 @@ #include "../base/stl_add.hpp" -void BaseTypeMapper::Load(string const & buffer) +void BaseTypeMapper::Load(istream & s) { - istringstream ss(buffer); Classificator const & c = classif(); string v; vector<string> path; uint32_t ind = 0; - while (true) + while (s.good()) { - ss >> v; + s >> v; - if (ss.eof()) - break; + if (!v.empty()) + { + path.clear(); + strings::Tokenize(v, "|", MakeBackInsertFunctor(path)); - path.clear(); - strings::Tokenize(v, "|", MakeBackInsertFunctor(path)); - - Add(ind++, c.GetTypeByPath(path)); + Add(ind++, c.GetTypeByPath(path)); + } } } |