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
commit3f1a387c9f98100a72d7f4ae7bfb4a8d39affad7 (patch)
tree7f6a0f471b5b1e278ba060816cb77db6d93bed5f
parentSimplify the regex used match package names in dependencies. (diff)
downloadgentoobrowse-api-3f1a387c9f98100a72d7f4ae7bfb4a8d39affad7.tar.bz2
gentoobrowse-api-3f1a387c9f98100a72d7f4ae7bfb4a8d39affad7.tar.xz
gentoobrowse-api-3f1a387c9f98100a72d7f4ae7bfb4a8d39affad7.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;