Debian Codegraph @

CodeLite/CxxPreProcessorCache.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // Copyright : (C) 2015 Eran Ifrah
5 // File name : CxxPreProcessorCache.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #ifndef CXXPREPROCESSORCACHE_H
27 #define CXXPREPROCESSORCACHE_H
28
29 #include "codelite_exports.h"
30 #include <wx/arrstr.h>
31 #include <map>
32
33 class WXDLLIMPEXP_CL CxxPreProcessorCache
34 {
35 struct CacheEntry {
36 wxString filename;
37 wxString project;
38 wxString config;
39 wxString preamble;
40 wxArrayString definitions;
41 time_t lastUpdated;
42 CacheEntry()
43 : lastUpdated(0)
44 {
45 }
46 };
47
48 typedef std::map<wxString, CacheEntry> Map_t;
49 CxxPreProcessorCache::Map_t m_impl;
50
51 public:
52 CxxPreProcessorCache();
53 virtual ~CxxPreProcessorCache();
54
55 /**
56 * @brief return the preamble for a give file
57 * A Preamble of a file is a list of all include statements
58 * used in the file
59 */
60 wxString GetPreamble(const wxString& filename) const;
61
62 /**
63 * @brief clear the cache content
64 */
65 void Clear();
66
67 /**
68 * @brief locate Pre Processors for a given file in a specific configuraion and project
69 */
70 bool Find(const wxString& filename, const wxString& project, const wxString& config, wxArrayString& definitions);
71
72 /**
73 * @brief insert item to the cache
74 */
75 bool
76 Insert(const wxString& filename, const wxString& project, const wxString& config, const wxArrayString& definitions);
77 };
78
79 #endif // CXXPREPROCESSORCACHE_H