Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# value.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *
    00004  *  This program is free software; you can redistribute it and/or modify
    00005  *  it under the terms of the GNU General Public License as published by
    00006  *  the Free Software Foundation; either version 2 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  This program is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  */
    00018
    00023
    00024 #ifndef INTI_G_VALUE_H
    00025 #define INTI_G_VALUE_H
    00026
    00027 #ifndef INTI_G_BOXED_H
    00028 #include <inti/glib/boxed.h>
    00029 #endif
    00030
    00031 #ifndef INTI_UTF_STRING_H
    00032 #include <inti/utf-string.h>
    00033 #endif
    00034
    00035 namespace Inti {
    00036
    00037 namespace G {
    00038
    00039 class Object;
    00040
    00052
    00053 class Value : public Boxed
    00054 {
    00055 public:
    00058
    00059         Value();
    00061
    00062         explicit Value(GType type);
    00065
    00066         explicit Value(GParamSpec *pspec);
    00068
    00069         explicit Value(GValue *value);
    00075
    00076         Value(GValue *value, bool copy);
    00084
    00085         Value(const Value& src);
    00087
    00088         ~Value();
    00090
    00091         Value& operator=(const Value& src);
    00093
    00097
    00098         GValue* g_value() const { return (GValue*)boxed_; }
    00100
    00101         operator GValue* () const;
    00103
    00104         bool is_valid() const;
    00106
    00107         GType type() const;
    00109
    00110         String type_name() const;
    00112
    00113         bool holds(GType type) const;
    00115
    00116         bool equal(const Value& other) const;
    00118
    00119         bool operator==(const Value& other) const;
    00121
    00122         bool operator!=(const Value& other) const;
    00124
    00125         void get(bool& value) const;
    00128
    00129         void get(gchar& value) const;
    00132
    00133         void get(guchar& value) const;
    00136
    00137         void get(gint& value) const;
    00142
    00143         void get(guint& value) const;
    00148
    00149         void get(gint64& value) const;
    00152
    00153         void get(guint64& value) const;
    00156
    00157         void get(gfloat& value) const;
    00160
    00161         void get(gdouble& value) const;
    00164
    00165         bool get(gpointer& value, bool wrap = false) const;
    00173
    00174         bool get(String& value) const;
    00178
    00179         bool get(Boxed *&value) const;
    00185
    00186         bool get(Object *&value) const;
    00190
    00191         template<typename ObjectType>
    00192         bool get(Pointer<ObjectType>& value) const
    00193         {
    00194                 gpointer tmp_value = 0;
    00195                 bool result = get(tmp_value, true);
    00196                 value = static_cast<ObjectType*>(tmp_value);
    00197                 return result;
    00198         }
    00202
    00206
    00207         void set(bool value);
    00210
    00211         void set(gchar value);
    00214
    00215         void set(guchar value);
    00218
    00219         void set(gint value);
    00224
    00225         void set(guint value);
    00230
    00231         void set(gint64 value);
    00234
    00235         void set(guint64 value);
    00238
    00239         void set(gfloat value);
    00242
    00243         void set(gdouble value);
    00246
    00247         void set(const gpointer value, bool wrapped = false);
    00253
    00254         void set(const String& value);
    00257
    00258         void set(const Boxed *value);
    00261
    00262         void set(const Object *value);
    00265
    00266         template<typename ObjectType>
    00267         void set(const Pointer<ObjectType>& value)
    00268         {
    00269                 set(value, true);
    00270         }
    00273
    00275 };
    00276
    00277 } // namespace G
    00278
    00279 } // namespace Inti
    00280
    00281 #endif // INTI_G_VALUE_H
    00282
    00283

Main Page - Footer