summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-06-03 00:14:37 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-06-03 00:14:37 +0100
commit33a63ec13cb9d595c86c7218764a986642ae3dc8 (patch)
tree7f6a0f471b5b1e278ba060816cb77db6d93bed5f
parentSimplify the regex used match package names in dependencies. (diff)
downloadgentoobrowse-api-33a63ec13cb9d595c86c7218764a986642ae3dc8.tar.bz2
gentoobrowse-api-33a63ec13cb9d595c86c7218764a986642ae3dc8.tar.xz
gentoobrowse-api-33a63ec13cb9d595c86c7218764a986642ae3dc8.zip
Copy-free getRange in ebuild cache parser
-rw-r--r--gentoobrowse-api/service/utils/ebuildCacheParser.cpp10
-rw-r--r--gentoobrowse-api/service/utils/ebuildCacheParser.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/gentoobrowse-api/service/utils/ebuildCacheParser.cpp b/gentoobrowse-api/service/utils/ebuildCacheParser.cpp
index ad894db..068d10b 100644
--- a/gentoobrowse-api/service/utils/ebuildCacheParser.cpp
+++ b/gentoobrowse-api/service/utils/ebuildCacheParser.cpp
@@ -29,6 +29,16 @@ namespace Gentoo {
}
return Glib::ustring(kvi->second.first, kvi->second.second);
}
+
+ boost::optional<EbuildCacheParser::Range>
+ EbuildCacheParser::getRange(const std::string & key) const
+ {
+ auto kvi = kvs.find(key);
+ if (kvi == kvs.end()) {
+ return boost::optional<Range>();
+ }
+ return kvi->second;
+ }
}
}
diff --git a/gentoobrowse-api/service/utils/ebuildCacheParser.h b/gentoobrowse-api/service/utils/ebuildCacheParser.h
index e9f1dfc..c7449c7 100644
--- a/gentoobrowse-api/service/utils/ebuildCacheParser.h
+++ b/gentoobrowse-api/service/utils/ebuildCacheParser.h
@@ -17,6 +17,7 @@ namespace Gentoo {
EbuildCacheParser(const boost::filesystem::path & p);
boost::optional<Glib::ustring> get(const std::string & key) const;
+ boost::optional<Range> getRange(const std::string & key) const;
private:
KVs kvs;