From 2319d01e262b705716e19474865f555f3ca81a7d Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 1 May 2017 13:50:13 +0300 Subject: Add hxx extension for headers and lib prefix for library dirs --- bpkg/system-repository.hxx | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 bpkg/system-repository.hxx (limited to 'bpkg/system-repository.hxx') diff --git a/bpkg/system-repository.hxx b/bpkg/system-repository.hxx new file mode 100644 index 0000000..b28e758 --- /dev/null +++ b/bpkg/system-repository.hxx @@ -0,0 +1,55 @@ +// file : bpkg/system-repository.hxx -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef BPKG_SYSTEM_REPOSITORY_HXX +#define BPKG_SYSTEM_REPOSITORY_HXX + +#include + +#include + +#include +#include + +namespace bpkg +{ + // A map of discovered system package versions. The information can be + // authoritative (i.e., it was provided by the user or auto-discovered + // on this run) or non-authoritative (i.e., comes from selected_packages + // that are present in the database; in a sence it was authoritative but + // on some previous run. + // + // Note that in our model we assume that once an authoritative version has + // been discovered, it does not change (on this run; see caching logic in + // available package). + // + struct system_package + { + using version_type = bpkg::version; + + version_type version; + bool authoritative; + }; + + class system_repository_type + { + public: + const version& + insert (const string& name, const version&, bool authoritative); + + const system_package* + find (const string& name) + { + auto i (map_.find (name)); + return i != map_.end () ? &i->second : nullptr; + } + + private: + std::map map_; + }; + + extern system_repository_type system_repository; +} + +#endif // BPKG_SYSTEM_REPOSITORY_HXX -- cgit v1.1