File: FileCache.h.orig

package info (click to toggle)
fastdep 0.16-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 596 kB
  • ctags: 323
  • sloc: cpp: 2,144; ansic: 814; sh: 208; makefile: 124
file content (73 lines) | stat: -rw-r--r-- 2,126 bytes parent folder | download | duplicates (5)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef FILECACHE_H_
#define FILECACHE_H_

#include <map>
#include <string>
#include <vector>
#include <iostream>

#include "FileStructure.h"
#include "os.h"

class Sequence;

class FileCache
{
	public:
		FileCache(const std::string& aBaseDir);
		FileCache(const FileCache& anOther);
		virtual ~FileCache();

		FileCache& operator=(const FileCache& anOther);

		void generate(std::ostream& theStream, const std::string& aDirectory, const std::string& aFilename);
		FileStructure* update(const std::string& aDirectory, const std::string& aFilename, bool isSystem);

		void addIncludeDir(const std::string& aBaseDir, const std::string& aDir);
		void addIncludeDirFromFile(const std::string& aBaseDir, const std::string& aFilename);
		void addExcludeDir(const std::string& aBaseDir, const std::string& aDir);
		std::string getAllDependenciesLine() const;
	
		void SetObjectsShouldContainDirectories() { ObjectsContainDirectories=true; };
		void SetObjectsShouldNotContainDirectories() { ObjectsContainDirectories=false; };
		void SetObjectsDir(const std::string& aDir) { ObjectsDir = aDir+sPathSep; }

		void SetCompileCommand( const std::string &cmd );
		void SetQuietModeOn() {QuietMode = true; }
		void SetQuietModeOff() {QuietMode = false; }

		void addPreDefine(const std::string& aName);
		void inDebugMode();
	private:
		struct FileLocation
		{
			FileLocation(const std::string& aDir, const std::string& aName)
				: Directory(aDir), Name(aName)
			{
			}

			bool operator<(const FileLocation& aLoc) const
			{
				return (Directory < aLoc.Directory) ||
						((Directory == aLoc.Directory) && (Name < aLoc.Name));
			}
			std::string Directory;
			std::string Name;
		};
		typedef std::map<FileLocation, FileStructure*> FileMap;
		FileMap Files;
		std::vector<std::string> IncludeDirs;
		std::vector<std::string> ExcludeDirs;
		std::vector<std::string> AllDependencies;
		std::vector<std::string> PreDefined;
		std::string BaseDir;
		std::string ObjectsDir;
		std::string CompileCommand;
		bool ObjectsContainDirectories;
		static bool QuietMode;
		bool DebugMode;
		bool WarnAboutNonExistingSystemHeaders;
};

#endif