aboutsummaryrefslogtreecommitdiff
path: root/src/cache.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-12-29 01:11:27 +0000
committerMike Buland <eichlan@xagasoft.com>2009-12-29 01:11:27 +0000
commit501bac50016628b787906392ce7af8262e561e52 (patch)
tree3b8746c37f22127c680f4aab5286893e5194437d /src/cache.cpp
parentccc30fd28cb3e65195a6cea06ca00f95e16ac9f8 (diff)
downloadbuild-501bac50016628b787906392ce7af8262e561e52.tar.gz
build-501bac50016628b787906392ce7af8262e561e52.tar.bz2
build-501bac50016628b787906392ce7af8262e561e52.tar.xz
build-501bac50016628b787906392ce7af8262e561e52.zip
Ok, cache stuff is in, and that's good, now we have to use it.
Diffstat (limited to '')
-rw-r--r--src/cache.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/cache.cpp b/src/cache.cpp
new file mode 100644
index 0000000..1646d0a
--- /dev/null
+++ b/src/cache.cpp
@@ -0,0 +1,39 @@
1#include "cache.h"
2#include <bu/file.h>
3#include <bu/archive.h>
4
5Cache::Cache() :
6 bIsLoaded( false )
7{
8}
9
10Cache::~Cache()
11{
12}
13
14void Cache::bind( const Bu::FString &sCacheFile )
15{
16 this->sCacheFile = sCacheFile;
17 load();
18}
19
20void Cache::load()
21{
22 if( bIsLoaded )
23 return;
24 Bu::File fIn( sCacheFile, Bu::File::Read );
25 Bu::Archive ar( fIn, Bu::Archive::load );
26
27 ar >> hRequires >> hVariables;
28
29 bIsLoaded = true;
30}
31
32void Cache::save()
33{
34 Bu::File fIn( sCacheFile, Bu::File::WriteNew );
35 Bu::Archive ar( fIn, Bu::Archive::save );
36
37 ar << hRequires << hVariables;
38}
39