]> git.tdb.fi Git - builder.git/blobdiff - source/cache.h
Refactor transitive dependencies to work on all targets
[builder.git] / source / cache.h
diff --git a/source/cache.h b/source/cache.h
deleted file mode 100644 (file)
index 69025fd..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef CACHE_H_
-#define CACHE_H_
-
-#include <list>
-#include <map>
-#include <msp/fs/path.h>
-#include <msp/time/timestamp.h>
-
-class SourcePackage;
-class Target;
-
-/**
-Stores data between build runs.  This can be used to avoid scanning files again
-every time builder is run, or to detect outside changes.
-
-Data is stored as lists of strings and keyed to target and an arbitrary
-identifier.  Any kind of strings can be stored, even ones that contain
-unprintable characters or nuls.
-*/
-class Cache
-{
-public:
-       typedef std::list<std::string> ValueList;
-private:
-       typedef std::pair<std::string, std::string> Key;
-       typedef std::map<Key, ValueList> DataMap;
-
-       SourcePackage &package;
-       Msp::FS::Path filename;
-       DataMap data;
-       Msp::Time::TimeStamp mtime;
-       mutable bool changed;
-
-public:
-       Cache(SourcePackage &p);
-
-       /// Sets a key to a single value, replacing any existing values.
-       void set_value(const Target *, const std::string &, const std::string &);
-
-       /// Appends a value to a key.  If the key does not exist, it is created.
-       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 &);
-
-       /** 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 &);
-
-       /// Indicates whether a key exists.
-       bool has_key(const Target *, const std::string &);
-
-       /// Returns the last modification timestamp of the cache.
-       const Msp::Time::TimeStamp &get_mtime() const { return mtime; }
-
-       /** Loads the cache file and sets the last modification timestamp
-       accordingly. */
-       void load();
-
-       /** Saves the cache.  Does nothing if there is no data to save or nothing
-       has changed. */
-       void save() const;
-};
-
-#endif