summaryrefslogtreecommitdiff
path: root/tools/aapt/CrunchCache.h
diff options
context:
space:
mode:
author Mike Lockwood <lockwood@google.com> 2013-08-28 09:44:17 -0700
committer Mike Lockwood <lockwood@google.com> 2013-08-28 09:44:17 -0700
commit9f6a119c8aa276432ece4fe2118bd8a3c9b1067e (patch)
tree1391656f9ad624aa99d4c7d2880d38121801a424 /tools/aapt/CrunchCache.h
parent647b6f5ed276bf93d95e5801e5e8af2802ef5fbb (diff)
Move frameworks/base/tools/ to frameworks/tools/
Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
Diffstat (limited to 'tools/aapt/CrunchCache.h')
-rw-r--r--tools/aapt/CrunchCache.h102
1 files changed, 0 insertions, 102 deletions
diff --git a/tools/aapt/CrunchCache.h b/tools/aapt/CrunchCache.h
deleted file mode 100644
index be3da5c40b25..000000000000
--- a/tools/aapt/CrunchCache.h
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// Copyright 2011 The Android Open Source Project
-//
-// Cache manager for pre-processed PNG files.
-// Contains code for managing which PNG files get processed
-// at build time.
-//
-
-#ifndef CRUNCHCACHE_H
-#define CRUNCHCACHE_H
-
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-#include "FileFinder.h"
-#include "CacheUpdater.h"
-
-using namespace android;
-
-/** CrunchCache
- * This class is a cache manager which can pre-process PNG files and store
- * them in a mirror-cache. It's capable of doing incremental updates to its
- * cache.
- *
- * Usage:
- * Create an instance initialized with the root of the source tree, the
- * root location to store the cache files, and an instance of a file finder.
- * Then update the cache by calling crunch.
- */
-class CrunchCache {
-public:
- // Constructor
- CrunchCache(String8 sourcePath, String8 destPath, FileFinder* ff);
-
- // Nobody should be calling the default constructor
- // So this space is intentionally left blank
-
- // Default Copy Constructor and Destructor are fine
-
- /** crunch is the workhorse of this class.
- * It goes through all the files found in the sourcePath and compares
- * them to the cached versions in the destPath. If the optional
- * argument forceOverwrite is set to true, then all source files are
- * re-crunched even if they have not been modified recently. Otherwise,
- * source files are only crunched when they needUpdating. Afterwards,
- * we delete any leftover files in the cache that are no longer present
- * in source.
- *
- * PRECONDITIONS:
- * No setup besides construction is needed
- * POSTCONDITIONS:
- * The cache is updated to fully reflect all changes in source.
- * The function then returns the number of files changed in cache
- * (counting deletions).
- */
- size_t crunch(CacheUpdater* cu, bool forceOverwrite=false);
-
-private:
- /** loadFiles is a wrapper to the FileFinder that places matching
- * files into mSourceFiles and mDestFiles.
- *
- * POSTCONDITIONS
- * mDestFiles and mSourceFiles are refreshed to reflect the current
- * state of the files in the source and dest directories.
- * Any previous contents of mSourceFiles and mDestFiles are cleared.
- */
- void loadFiles();
-
- /** needsUpdating takes a file path
- * and returns true if the file represented by this path is newer in the
- * sourceFiles than in the cache (mDestFiles).
- *
- * PRECONDITIONS:
- * mSourceFiles and mDestFiles must be initialized and filled.
- * POSTCONDITIONS:
- * returns true if and only if source file's modification time
- * is greater than the cached file's mod-time. Otherwise returns false.
- *
- * USAGE:
- * Should be used something like the following:
- * if (needsUpdating(filePath))
- * // Recrunch sourceFile out to destFile.
- *
- */
- bool needsUpdating(String8 relativePath) const;
-
- // DATA MEMBERS ====================================================
-
- String8 mSourcePath;
- String8 mDestPath;
-
- Vector<String8> mExtensions;
-
- // Each vector of paths contains one entry per PNG file encountered.
- // Each entry consists of a path pointing to that PNG.
- DefaultKeyedVector<String8,time_t> mSourceFiles;
- DefaultKeyedVector<String8,time_t> mDestFiles;
-
- // Pointer to a FileFinder to use
- FileFinder* mFileFinder;
-};
-
-#endif // CRUNCHCACHE_H