libopenraw
metavalue.hpp
1 /*
2  * libopenraw - metavalue.h
3  *
4  * Copyright (C) 2007-2016 Hubert Figuiere
5  * Copyright (C) 2008 Novell, Inc.
6  *
7  * This library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation, either version 3 of
10  * the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
21 
22 
23 #ifndef LIBOPENRAWPP_METAVALUE_H_
24 #define LIBOPENRAWPP_METAVALUE_H_
25 
26 #include <stdint.h>
27 #include <vector>
28 
29 #include <boost/variant.hpp>
30 
31 namespace OpenRaw {
32 
33 class MetaValue
34 {
35 public:
36  typedef boost::variant<std::string, uint32_t, double> value_t;
37 
38  MetaValue(const MetaValue &);
39  template <class T> MetaValue(const T &v)
40  {
41  m_values.push_back(v);
42  }
43  template <class T> MetaValue(const std::vector<T> &v)
44  : m_values(v)
45  {
46  }
47  explicit MetaValue(const value_t &v);
48  explicit MetaValue(const std::vector<value_t> &v);
49 
50  uint32_t getCount() const
51  {
52  return m_values.size();
53  }
54 
55  uint32_t getInteger(int idx) const;
56  const std::string & getString(int idx) const;
57  double getDouble(int idx) const;
58 private:
60  template<typename T> T get(int idx) const;
62  template<typename T> const T & getRef(int idx) const;
63 
64  std::vector<value_t> m_values;
65 };
66 
67 
68 }
69 
70 /*
71  Local Variables:
72  mode:c++
73  c-file-style:"stroustrup"
74  c-file-offsets:((innamespace . 0))
75  indent-tabs-mode:nil
76  fill-column:80
77  End:
78 */
79 
80 #endif
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.
Definition: arwfile.cpp:30