HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FS_FileHistoryManager.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: FS_FileHistoryManager.h (C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __FS_FileHistoryManager__
13 #define __FS_FileHistoryManager__
14 
15 #include "FS_API.h"
16 #include <UT/UT_Array.h>
17 #include <UT/UT_NonCopyable.h>
18 #include <UT/UT_UniquePtr.h>
19 
20 // IMPORTANT: Must be kept in sync with FS_FileHistoryTypeNames
22 {
56 };
57 
58 class UT_String;
59 
60 class FS_FileHistory;
61 
63 {
64 public:
65 
66  static FS_FileHistoryManager *getFileHistoryManager();
67 
70 
71  void saveFileHistoryList();
72  void saveDirHistoryList();
73 
74  void loadFileHistoryList();
75  void loadDirHistoryList();
76 
77 
78  // Queries the files for a menu.
79  int numFilesInList(FS_FileHistoryType filetype) const;
80  const char *getFilenameFromList(int index, FS_FileHistoryType filetype) const;
81 
82  // Queries the directories for a menu.
83  int numDirsInList(FS_FileHistoryType filetype) const;
84  const char *getDirFromList(int index, FS_FileHistoryType filetype) const;
85 
86  void getFormattedFilenameFromList(int index,
87  FS_FileHistoryType filetype, UT_String &path) const;
88  void getFormattedDirFromList(int index,
89  FS_FileHistoryType filetype, UT_String &path) const;
90 
91  // This will add to both the file and directory history
92  void addFileToHistoryList(const char *filename,
93  FS_FileHistoryType filetype);
94  void removeFileFromHistoryList(const char *filename,
95  FS_FileHistoryType filetype);
96 
97 protected:
99 
100  void saveHistoryList(const char *filename, bool filelist);
101  void loadHistoryList(const char *filename, bool filelist);
102 private:
103  FS_FileHistory *getHistoryList(FS_FileHistoryType filetype);
104  const FS_FileHistory *getHistoryList(FS_FileHistoryType filetype) const;
105  FS_FileHistory *getDirHistoryList(FS_FileHistoryType filetype);
106  const FS_FileHistory *getDirHistoryList(FS_FileHistoryType filetype) const;
107 
108  using FS_FileHistoryPtr = UT_UniquePtr<FS_FileHistory>;
109  UT_Array<FS_FileHistoryPtr> myHistoryList;
110  UT_Array<FS_FileHistoryPtr> myDirHistoryList;
111 };
112 
113 #define FSgetFileHistoryManager FS_FileHistoryManager::getFileHistoryManager
114 
115 #endif
GT_API const UT_StringHolder filename
FS_FileHistoryType
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
GLuint index
Definition: glcorearb.h:786
#define FS_API
Definition: FS_API.h:10