value.h
1/***************************************************************************
2 * value.h
3 * This file is part of the KDE project
4 * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 * This program 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 GNU
13 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 ***************************************************************************/
19
20#ifndef KROSS_API_VALUE_H
21#define KROSS_API_VALUE_H
22
23#include <tqstring.h>
24#include <tqvariant.h>
25
26#include "object.h"
27
28namespace Kross { namespace Api {
29
37 template<class T, class V>
38 class Value : public Object
39 {
40 public:
41
48 Value(V value)
49 : Object()
50 , m_value(value) {}
51
55 virtual ~Value() {}
56
57 //operator V&() const { return m_value; }
58
64 V& getValue() { return m_value; }
65 //operator V& () { return m_value; }
66
67 template<typename TYPE>
68 static Object::Ptr toObject(TYPE t) { return new T(t); }
69
70#if 0
71//do we need it anyway?
81 void setValue(V& value) { m_value = value; }
82#endif
83
84 private:
85 V m_value;
86 };
87
88}}
89
90#endif
91
The common Object class all other object-classes are inheritated from.
Definition object.h:51
TDESharedPtr< Object > Ptr
Shared pointer to implement reference-counting.
Definition object.h:57
Template class to represent values.
Definition value.h:39
V & getValue()
Return the value.
Definition value.h:64
Value(V value)
Constructor.
Definition value.h:48
virtual ~Value()
Destructor.
Definition value.h:55
The Kross scripting bridge to embed scripting functionality into an application.
Definition callable.h:31