PixelLightAPI  .
DynVar.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: DynVar.h                                       *
00003  *
00004  *  Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLCORE_DYNVAR_H__
00024 #define __PLCORE_DYNVAR_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/String/String.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLCore {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Forward declarations                                  ]
00042 //[-------------------------------------------------------]
00043 class DynTypeInfo;
00044 class VarDesc;
00045 
00046 
00047 //[-------------------------------------------------------]
00048 //[ Classes                                               ]
00049 //[-------------------------------------------------------]
00050 /**
00051 *  @brief
00052 *    Virtual base class for variables
00053 *
00054 *  @remarks
00055 *    This is the virtual base class to access variables and attributes dynamically.
00056 *    It is a virtual interface that allows you to access a variable regardless
00057 *    of it's actual type and storage.
00058 */
00059 class DynVar {
00060 
00061 
00062     //[-------------------------------------------------------]
00063     //[ Public functions                                      ]
00064     //[-------------------------------------------------------]
00065     public:
00066         /**
00067         *  @brief
00068         *    Constructor
00069         */
00070         PLCORE_API DynVar();
00071 
00072         /**
00073         *  @brief
00074         *    Destructor
00075         */
00076         PLCORE_API virtual ~DynVar();
00077 
00078 
00079     //[-------------------------------------------------------]
00080     //[ Public virtual DynVar functions                       ]
00081     //[-------------------------------------------------------]
00082     public:
00083         /**
00084         *  @brief
00085         *    Get variable descriptor
00086         *
00087         *  @return
00088         *    Descriptor (can be a null pointer)
00089         */
00090         PLCORE_API virtual const VarDesc *GetDesc() const;
00091 
00092         /**
00093         *  @brief
00094         *    Get type
00095         *
00096         *  @return
00097         *    Type info
00098         */
00099         PLCORE_API virtual DynTypeInfo &GetType() const;
00100 
00101         /**
00102         *  @brief
00103         *    Get type ID
00104         *
00105         *  @return
00106         *    Type ID
00107         */
00108         PLCORE_API virtual int GetTypeID() const;
00109 
00110         /**
00111         *  @brief
00112         *    Get type name
00113         *
00114         *  @return
00115         *    Type name (e.g. "int")
00116         */
00117         PLCORE_API virtual String GetTypeName() const;
00118 
00119         /**
00120         *  @brief
00121         *    Check if variable is set to default value
00122         *
00123         *  @return
00124         *    'true' if default value is set, else 'false'
00125         */
00126         PLCORE_API virtual bool IsDefault() const;
00127 
00128         /**
00129         *  @brief
00130         *    Set variable to default value
00131         */
00132         PLCORE_API virtual void SetDefault();
00133 
00134         /**
00135         *  @brief
00136         *    Get default value as string
00137         *
00138         *  @return
00139         *    Default value as string
00140         */
00141         PLCORE_API virtual String GetDefault() const;
00142 
00143         /**
00144         *  @brief
00145         *    Set value
00146         *
00147         *  @param[in] cValue
00148         *    Value as dynamic var
00149         */
00150         PLCORE_API virtual void SetVar(const DynVar &cValue);
00151 
00152         /**
00153         *  @brief
00154         *    Get value
00155         *
00156         *  @return
00157         *    Value as bool
00158         */
00159         PLCORE_API virtual bool GetBool() const;
00160 
00161         /**
00162         *  @brief
00163         *    Set value
00164         *
00165         *  @param[in] bValue
00166         *    Value as bool
00167         */
00168         PLCORE_API virtual void SetBool(bool bValue);
00169 
00170         /**
00171         *  @brief
00172         *    Get value
00173         *
00174         *  @return
00175         *    Value as int
00176         */
00177         PLCORE_API virtual int GetInt() const;
00178 
00179         /**
00180         *  @brief
00181         *    Set value
00182         *
00183         *  @param[in] nValue
00184         *    Value as int
00185         */
00186         PLCORE_API virtual void SetInt(int nValue);
00187 
00188         /**
00189         *  @brief
00190         *    Get value
00191         *
00192         *  @return
00193         *    Value as int8
00194         */
00195         PLCORE_API virtual int8 GetInt8() const;
00196 
00197         /**
00198         *  @brief
00199         *    Set value
00200         *
00201         *  @param[in] nValue
00202         *    Value as int8
00203         */
00204         PLCORE_API virtual void SetInt8(int8 nValue);
00205 
00206         /**
00207         *  @brief
00208         *    Get value
00209         *
00210         *  @return
00211         *    Value as int16
00212         */
00213         PLCORE_API virtual int16 GetInt16() const;
00214 
00215         /**
00216         *  @brief
00217         *    Set value
00218         *
00219         *  @param[in] nValue
00220         *    Value as int16
00221         */
00222         PLCORE_API virtual void SetInt16(int16 nValue);
00223 
00224         /**
00225         *  @brief
00226         *    Get value
00227         *
00228         *  @return
00229         *    Value as int32
00230         */
00231         PLCORE_API virtual int32 GetInt32() const;
00232 
00233         /**
00234         *  @brief
00235         *    Set value
00236         *
00237         *  @param[in] nValue
00238         *    Value as int32
00239         */
00240         PLCORE_API virtual void SetInt32(int32 nValue);
00241 
00242         /**
00243         *  @brief
00244         *    Get value
00245         *
00246         *  @return
00247         *    Value as int64
00248         */
00249         PLCORE_API virtual int64 GetInt64() const;
00250 
00251         /**
00252         *  @brief
00253         *    Set value
00254         *
00255         *  @param[in] nValue
00256         *    Value as int64
00257         */
00258         PLCORE_API virtual void SetInt64(int64 nValue);
00259 
00260         /**
00261         *  @brief
00262         *    Get value
00263         *
00264         *  @return
00265         *    Value as uint8
00266         */
00267         PLCORE_API virtual uint8 GetUInt8() const;
00268 
00269         /**
00270         *  @brief
00271         *    Set value
00272         *
00273         *  @param[in] nValue
00274         *    Value as uint8
00275         */
00276         PLCORE_API virtual void SetUInt8(uint8 nValue);
00277 
00278         /**
00279         *  @brief
00280         *    Get value
00281         *
00282         *  @return
00283         *    Value as uint16
00284         */
00285         PLCORE_API virtual uint16 GetUInt16() const;
00286 
00287         /**
00288         *  @brief
00289         *    Set value
00290         *
00291         *  @param[in] nValue
00292         *    Value as uint16
00293         */
00294         PLCORE_API virtual void SetUInt16(uint16 nValue);
00295 
00296         /**
00297         *  @brief
00298         *    Get value
00299         *
00300         *  @return
00301         *    Value as uint32
00302         */
00303         PLCORE_API virtual uint32 GetUInt32() const;
00304 
00305         /**
00306         *  @brief
00307         *    Set value
00308         *
00309         *  @param[in] nValue
00310         *    Value as uint32
00311         */
00312         PLCORE_API virtual void SetUInt32(uint32 nValue);
00313 
00314         /**
00315         *  @brief
00316         *    Get value
00317         *
00318         *  @return
00319         *    Value as uint64
00320         */
00321         PLCORE_API virtual uint64 GetUInt64() const;
00322 
00323         /**
00324         *  @brief
00325         *    Set value
00326         *
00327         *  @param[in] nValue
00328         *    Value as uint64
00329         */
00330         PLCORE_API virtual void SetUInt64(uint64 nValue);
00331 
00332         /**
00333         *  @brief
00334         *    Get value
00335         *
00336         *  @return
00337         *    Value as uint_ptr
00338         */
00339         PLCORE_API virtual uint_ptr GetUIntPtr() const;
00340 
00341         /**
00342         *  @brief
00343         *    Set value
00344         *
00345         *  @param[in] nValue
00346         *    Value as uint_ptr
00347         */
00348         PLCORE_API virtual void SetUIntPtr(uint_ptr nValue);
00349 
00350         /**
00351         *  @brief
00352         *    Get value
00353         *
00354         *  @return
00355         *    Value as float
00356         */
00357         PLCORE_API virtual float GetFloat() const;
00358 
00359         /**
00360         *  @brief
00361         *    Set value
00362         *
00363         *  @param[in] fValue
00364         *    Value as float
00365         */
00366         PLCORE_API virtual void SetFloat(float fValue);
00367 
00368         /**
00369         *  @brief
00370         *    Get value
00371         *
00372         *  @return
00373         *    Value as double
00374         */
00375         PLCORE_API virtual double GetDouble() const;
00376 
00377         /**
00378         *  @brief
00379         *    Set value
00380         *
00381         *  @param[in] dValue
00382         *    Value as double
00383         */
00384         PLCORE_API virtual void SetDouble(double dValue);
00385 
00386         /**
00387         *  @brief
00388         *    Get value
00389         *
00390         *  @return
00391         *    Value as string
00392         */
00393         PLCORE_API virtual String GetString() const;
00394 
00395         /**
00396         *  @brief
00397         *    Set value
00398         *
00399         *  @param[in] sValue
00400         *    Value as string
00401         */
00402         PLCORE_API virtual void SetString(const String &sValue);
00403 
00404 
00405 };
00406 
00407 
00408 //[-------------------------------------------------------]
00409 //[ Namespace                                             ]
00410 //[-------------------------------------------------------]
00411 } // PLCore
00412 
00413 
00414 #endif // __PLCORE_DYNVAR_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:50:52
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported