libopenraw
rawfilefactory.hpp
1/*
2 * libopenraw - rawfilefactory.h
3 *
4 * Copyright (C) 2006-2016 Hubert Figuiere
5 *
6 * This library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation, either version 3 of
9 * the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef OR_INTERNALS_RAWFILEFACTORY_H_
22#define OR_INTERNALS_RAWFILEFACTORY_H_
23
24#include <string>
25#include <map>
26#include <functional>
27
28#include "rawfile.hpp"
29#include "io/stream.hpp"
30
31namespace OpenRaw {
32namespace Internals {
33
35{
36public:
37 typedef std::function<RawFile*(const IO::Stream::Ptr&)> raw_file_factory_t;
41 typedef
42 std::map<RawFile::Type, raw_file_factory_t> Table;
43 typedef
44 std::map<std::string, RawFile::Type> Extensions;
45
53 RawFileFactory(RawFile::Type type,
54 const raw_file_factory_t & fn,
55 const char * ext);
56
58 static Table & table();
60 static Extensions & extensions();
61
63 static const char **fileExtensions();
64
65 static void registerType(RawFile::Type type,
66 const raw_file_factory_t & fn,
67 const char * ext);
68 static void unRegisterType(RawFile::Type type);
69};
70
71
72
77{
79 static Table rawFactoryTable;
80 return rawFactoryTable;
81}
82
83inline RawFileFactory::Extensions & RawFileFactory::extensions()
84{
86 static Extensions rawExtensionsTable;
87 return rawExtensionsTable;
88}
89
90}
91}
92
93#endif
94/*
95 Local Variables:
96 mode:c++
97 c-file-style:"stroustrup"
98 c-file-offsets:((innamespace . 0))
99 indent-tabs-mode:nil
100 fill-column:80
101 End:
102*/
static const char ** fileExtensions()
std::map< RawFile::Type, raw_file_factory_t > Table
RawFileFactory(RawFile::Type type, const raw_file_factory_t &fn, const char *ext)
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard....
Definition: arwfile.cpp:30