FotoSHOCK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Formats.hpp
1 /*
2  * Copyright 2011, 2012 Lukas Jirkovsky
3  *
4  * This file is part of FotoSHOCKcore.
5  *
6  * FotoSHOCKcore is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * FotoSHOCKcore is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with FotoSHOCKcore. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef FORMATS_H
20 #define FORMATS_H
21 
22 #include <string>
23 #include <map>
24 
25 namespace FotoSHOCKcore {
26 namespace IO {
27 
29 
37 namespace Formats {
39 enum Enum {
40  JPG,
41  PNG,
42  EXR
43 };
44 }
45 
46 /* TODO: Replace by initializer list after move to C++11.
47  * TODO: This will have to automatically generated after the dynamic loading
48  * of codecs is implemented.
49  */
51 
56 static std::pair<std::string, Formats::Enum> map_data[] = {
57  std::make_pair("jpg", Formats::JPG),
58  std::make_pair("jpeg", Formats::JPG),
59  std::make_pair("png", Formats::PNG),
60  std::make_pair("exr", Formats::EXR)
61 };
62 
64 
67 #ifdef DEFINE_ExtToFormatsMap
68 std::map<std::string, Formats::Enum> ExtToFormatsMap (
69  map_data, map_data + sizeof map_data / sizeof map_data[0]
70 );
71 #else
72 extern std::map<std::string, Formats::Enum> ExtToFormatsMap;
73 #endif
74 
75 }
76 }
77 
78 #endif