libopenraw
metavalue.h
1 /*
2  * libopenraw - metavalue.h
3  *
4  * Copyright (C) 2007 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 _OPENRAW_METAVALUE_H
24 #define _OPENRAW_METAVALUE_H
25 
26 #include <boost/variant.hpp>
27 #include <libopenraw/types.h>
28 
29 #include "ifdentry.h"
30 
31 namespace OpenRaw {
32 
33 class MetaValue
34 {
35 public:
36  typedef boost::variant<std::string, uint32_t> value_t;
37 
38  MetaValue(const MetaValue &);
39  template <class T> MetaValue(const T &v)
40  : m_value(v)
41  {
42  }
43  explicit MetaValue(const value_t &v);
44  explicit MetaValue(const Internals::IFDEntry::Ref & e);
45 
46  uint32_t getInteger() const
48  std::string getString() const
50 
51 private:
52  template<typename T> T get() const
54 
55  value_t m_value;
56 };
57 
58 
59 }
60 
61 /*
62  Local Variables:
63  mode:c++
64  c-file-style:"stroustrup"
65  c-file-offsets:((innamespace . 0))
66  indent-tabs-mode:nil
67  fill-column:80
68  End:
69 */
70 
71 #endif
boost::shared_ptr< IFDEntry > Ref
Definition: ifdentry.h:122