ENH: mark some vars as advanced (and resort the list)
[cmake.git] / Source / cmListFileCache.h
blob8007b88a6fe314a1fd83e2525744c4a2c9c0a931
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmListFileCache.h,v $
5 Language: C++
6 Date: $Date: 2002-09-19 18:34:15 $
7 Version: $Revision: 1.7 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmListFileCache_h
18 #define cmListFileCache_h
20 #include "cmStandardIncludes.h"
22 /** \class cmListFileCache
23 * \brief A class to cache list file contents.
25 * cmListFileCache is a class used to cache the contents of parsed
26 * cmake list files.
29 struct cmListFileFunction
31 std::string m_Name;
32 std::vector<std::string> m_Arguments;
35 struct cmListFile
37 cmListFile()
38 :m_ModifiedTime(0)
41 long int m_ModifiedTime;
42 std::vector<cmListFileFunction> m_Functions;
45 class cmListFileCache
47 public:
48 static cmListFileCache* GetInstance();
49 static void ClearCache();
52 /** Return the cached version of the given file.
53 * If the file is not already in the cache, a cache entry
54 * will be made. If there is an error loading the file,
55 * NULL is returned.
57 cmListFile* GetFileCache(const char* path);
59 //! Flush cache file out of cache.
60 void FlushCache(const char* path);
62 private:
63 // Cache the file
64 bool CacheFile(const char* path);
65 // private data
66 typedef std::map<cmStdString, cmListFile> ListFileMap;
67 ListFileMap m_ListFileCache; // file name to ListFile map
68 static cmListFileCache* Instance; // singelton pointer
72 #endif