~ubuntu-branches/ubuntu/utopic/libopenraw/utopic

« back to all changes in this revision

Viewing changes to lib/metavalue.h

  • Committer: Bazaar Package Importer
  • Author(s): David Paleino
  • Date: 2009-04-03 22:41:08 UTC
  • mto: (7.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20090403224108-f90nhq50nv5ze5ce
Tags: upstream-0.0.6
ImportĀ upstreamĀ versionĀ 0.0.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * libopenraw - metavalue.h
3
3
 *
4
4
 * Copyright (C) 2007 Hubert Figuiere
 
5
 * Copyright (C) 2008 Novell, Inc.
5
6
 *
6
 
 * This library is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the GNU Lesser General Public
8
 
 * License as published by the Free Software Foundation; either
9
 
 * version 2.1 of the License, or (at your option) any later version.
 
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.
10
11
 *
11
12
 * This library is distributed in the hope that it will be useful,
12
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
15
 * Lesser General Public License for more details.
15
16
 *
16
17
 * You should have received a copy of the GNU Lesser General Public
17
 
 * License along with this library; if not, write to the Free Software
18
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 
18
 * License along with this library.  If not, see
 
19
 * <http://www.gnu.org/licenses/>.
19
20
 */
20
21
 
21
22
 
22
23
#ifndef _OPENRAW_METAVALUE_H
23
24
#define _OPENRAW_METAVALUE_H
24
25
 
25
 
#include <boost/any.hpp>
 
26
#include <boost/variant.hpp>
26
27
#include <libopenraw/types.h>
27
28
 
 
29
#include "ifdentry.h"
 
30
 
28
31
namespace OpenRaw {
29
32
        
30
 
        class MetaValue
31
 
        {
32
 
        public:
33
 
                MetaValue(const MetaValue &);
34
 
                MetaValue(const boost::any &v);
35
 
                int32_t getInteger() const
36
 
                        throw(Internals::BadTypeException);
37
 
        private:
38
 
                boost::any m_value;
39
 
        };
 
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
 
47
        throw(Internals::BadTypeException);
 
48
    std::string getString() const
 
49
        throw(Internals::BadTypeException);
 
50
    
 
51
private:
 
52
    template<typename T> T get() const
 
53
        throw(Internals::BadTypeException);
 
54
 
 
55
    value_t m_value;
 
56
};
 
57
 
40
58
 
41
59
}
42
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
 
43
71
#endif