aboutsummaryrefslogtreecommitdiff
path: root/src/cache.cpp
blob: 1646d0a2f239a2e28799a23b658d17e99c3bc02a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "cache.h"
#include <bu/file.h>
#include <bu/archive.h>

Cache::Cache() :
	bIsLoaded( false )
{
}

Cache::~Cache()
{
}

void Cache::bind( const Bu::FString &sCacheFile )
{
	this->sCacheFile = sCacheFile;
	load();
}

void Cache::load()
{
	if( bIsLoaded )
		return;
	Bu::File fIn( sCacheFile, Bu::File::Read );
	Bu::Archive ar( fIn, Bu::Archive::load );

	ar >> hRequires >> hVariables;

	bIsLoaded = true;
}

void Cache::save()
{
	Bu::File fIn( sCacheFile, Bu::File::WriteNew );
	Bu::Archive ar( fIn, Bu::Archive::save );

	ar << hRequires << hVariables;
}