newspeoplefor developersdocumentationdownloads

_attrid.h

Go to the documentation of this file.
00001 #ifndef ATTR__ATTRID_H
00002 #define ATTR__ATTRID_H
00003 //------------------------------------------------------------------------------
00014 #include "util/narray.h"
00015 #include "util/nstring.h"
00016 #include "util/nvariant.h"
00017 #include "attr/attributeclasses.h"
00018 
00020 const int ID_REGISTRY_SIZE = 256;
00021 
00022 class _attrid
00023 {
00024 public:
00026     enum Type
00027     {
00028         Void     = nVariant::Void,
00029         Int      = nVariant::Int,
00030         Float    = nVariant::Float,
00031         Bool     = nVariant::Bool,
00032         Vector3  = nVariant::Vector3,
00033         Vector4  = nVariant::Vector4,
00034         String   = nVariant::String,
00035         Matrix44 = nVariant::Matrix44,
00036     };
00038     enum
00039     {
00040         Read  = (1<<0),
00041         Write = (1<<1),
00042         Store = (1<<2),
00043     };
00044 
00046     _attrid(const char* name, Type t, uchar flags);
00048     //~_attrid();
00049 
00051     const nString& GetName() const;
00053     Type GetType() const;
00055     bool IsStorable() const;
00057     bool IsWritable() const;
00058 
00059 protected:
00061     _attrid() {};
00062 
00063     nString name;
00064     Type type;
00065     uchar flags;
00066 };
00067 
00068 //------------------------------------------------------------------------------
00071 inline
00072 _attrid::_attrid(const char* n, Type t, uchar f) :
00073     name(n),
00074     type(t),
00075     flags(f)
00076 {
00077     // empty
00078 }
00079 //------------------------------------------------------------------------------
00082 inline
00083 _attrid::Type
00084 _attrid::GetType() const
00085 {
00086     return this->type;
00087 }
00088 
00089 //------------------------------------------------------------------------------
00092 inline
00093 const nString&
00094 _attrid::GetName() const
00095 {
00096     return this->name;
00097 }
00098 
00099 //------------------------------------------------------------------------------
00102 inline
00103 bool
00104 _attrid::IsStorable() const
00105 {
00106     return 0 != (this->flags & Store);
00107 }
00108 
00109 //------------------------------------------------------------------------------
00112 inline
00113 bool
00114 _attrid::IsWritable() const
00115 {
00116     return 0 != (this->flags & Write);
00117 }
00118 
00119 //------------------------------------------------------------------------------
00120 #endif

Copyright © 1999-2005 by the contributing authors. Ideas, requests, problems: Send feedback.