1 | // Aseprite |
2 | // Copyright (C) 2001-2017 David Capello |
3 | // |
4 | // This program is distributed under the terms of |
5 | // the End-User License Agreement for Aseprite. |
6 | |
7 | #ifndef APP_FILE_FILE_FORMATS_MANAGER_H_INCLUDED |
8 | #define APP_FILE_FILE_FORMATS_MANAGER_H_INCLUDED |
9 | #pragma once |
10 | |
11 | #include "dio/file_format.h" |
12 | |
13 | #include <vector> |
14 | |
15 | namespace app { |
16 | |
17 | class FileFormat; |
18 | |
19 | // A list of file formats. Used by the FileFormatsManager to keep |
20 | // track of all known file extensions supported by ASE. |
21 | typedef std::vector<FileFormat*> FileFormatsList; |
22 | |
23 | // Manages the list of known formats by ASEPRITE (image file format that can |
24 | // be loaded and/or saved). |
25 | class FileFormatsManager { |
26 | public: |
27 | // Returns a singleton of this class. |
28 | static FileFormatsManager* instance(); |
29 | static void destroyInstance(); |
30 | |
31 | virtual ~FileFormatsManager(); |
32 | |
33 | // Iterators to access to the list of formats. |
34 | FileFormatsList::iterator begin(); |
35 | FileFormatsList::iterator end(); |
36 | |
37 | FileFormat* getFileFormat(const dio::FileFormat dioFormat) const; |
38 | |
39 | private: |
40 | FileFormatsManager(); |
41 | void registerFormat(FileFormat* fileFormat); |
42 | |
43 | FileFormatsList m_formats; |
44 | }; |
45 | |
46 | } // namespace app |
47 | |
48 | #endif |
49 | |