Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2011-11-25 00:28:17 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:28:44 +0300
commit65530f86918698ec5cc6dbdd408e6295c28f7c1a (patch)
tree2b95e76f79c16a60b38e0b1a95ac72bebadfba8f /indexer/drawing_rules.cpp
parentc11367ac7accbbff694befc754132c3da8b76540 (diff)
Avoid overhead in classificator reading (read to string -> istringstream).
Add reading of binary proto drawing rules.
Diffstat (limited to 'indexer/drawing_rules.cpp')
-rw-r--r--indexer/drawing_rules.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/indexer/drawing_rules.cpp b/indexer/drawing_rules.cpp
index 6d6b29b43e..684b8b8be7 100644
--- a/indexer/drawing_rules.cpp
+++ b/indexer/drawing_rules.cpp
@@ -273,6 +273,26 @@ void RulesHolder::LoadFromTextProto(string const & buffer)
DoSetIndex doSet(*this);
google::protobuf::TextFormat::ParseFromString(buffer, &doSet.m_cont);
+
+ classif().GetMutableRoot()->ForEachObject(bind<void>(ref(doSet), _1));
+}
+
+void RulesHolder::SaveToBinaryProto(string const & buffer, ostream & s)
+{
+ ContainerProto cont;
+ google::protobuf::TextFormat::ParseFromString(buffer, &cont);
+
+ CHECK ( cont.SerializeToOstream(&s), ("Error in proto saving!") );
+}
+
+void RulesHolder::LoadFromBinaryProto(istream & s)
+{
+ Clean();
+
+ DoSetIndex doSet(*this);
+
+ CHECK ( doSet.m_cont.ParseFromIstream(&s), ("Error in proto loading!") );
+
classif().GetMutableRoot()->ForEachObject(bind<void>(ref(doSet), _1));
}