]> git.tdb.fi Git - builder.git/blobdiff - source/cache.h
Use default member initializers and constructor delegation
[builder.git] / source / cache.h
index 86a5f4721b62031bec864c206925881d0c14da02..9193dacec848ae834ac264be6e0bb8ef8bc855a1 100644 (file)
@@ -1,8 +1,10 @@
 #ifndef CACHE_H_
 #define CACHE_H_
 
+#include <map>
+#include <vector>
+#include <msp/fs/path.h>
 #include <msp/time/timestamp.h>
-#include "misc.h"
 
 class SourcePackage;
 class Target;
@@ -18,16 +20,15 @@ unprintable characters or nuls.
 class Cache
 {
 public:
-       typedef std::list<std::string> ValueList;
+       using Values = std::vector<std::string>;
 private:
-       typedef std::pair<std::string, std::string> Key;
-       typedef std::map<Key, ValueList> DataMap;
+       using Key = std::pair<std::string, std::string>;
 
        SourcePackage &package;
        Msp::FS::Path filename;
-       DataMap data;
+       std::map<Key, Values> data;
        Msp::Time::TimeStamp mtime;
-       bool changed;
+       mutable bool changed = false;
 
 public:
        Cache(SourcePackage &p);
@@ -39,14 +40,14 @@ public:
        void append_value(const Target *, const std::string &, const std::string &);
 
        /// Sets a key to a list of values, replacing any existing values.
-       void set_values(const Target *, const std::string &, const ValueList &);
+       void set_values(const Target *, const std::string &, const Values &);
 
        /** Returns the first value from a key.  The key must exist and be
        non-empty. */
        const std::string &get_value(const Target *, const std::string &);
 
        /// Returns the values from a key.  The key must exist.
-       const ValueList &get_values(const Target *, const std::string &);
+       const Values &get_values(const Target *, const std::string &);
 
        /// Indicates whether a key exists.
        bool has_key(const Target *, const std::string &);