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

attribute.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                   attribute.h  -  Abstraction of object data
00003                              -------------------
00004     begin                : Tue Dec 17 2002
00005     copyright            : (C) 2002 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, NeoWTK, attribute.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2002
00023  Reality Rift Studios. All Rights Reserved.
00024 
00025  ***************************************************************************/
00026 
00027 #ifndef __NEOWTKATTRIBUTE_H
00028 #define __NEOWTKATTRIBUTE_H
00029 
00030 
00031 #include "base.h"
00032 #include "msg.h"
00033 
00034 #ifdef HAVE_NEOCHUNKIO
00035 #  include <neochunkio/complex.h>
00036 #  include "chunktype.h"
00037 #endif
00038 
00039 #include <neoengine/hashstring.h>
00040 
00041 
00048 namespace NeoWTK
00049 {
00050 
00051 
00057 class NEOWTK_API AttributeBase
00058 {
00059     public:
00060 
00062         NeoEngine::HashString                         m_strName;
00063 
00064 
00067                                                       AttributeBase( const NeoEngine::HashString &rstrName ) : m_strName( rstrName ) {}
00068 
00071         virtual                                      ~AttributeBase() {}
00072 };
00073 
00074 
00080 template <class T> class Attribute : public AttributeBase
00081 {
00082     public:
00083 
00085         T                                             m_kData;
00086 
00087 
00088 
00093                                                       Attribute( const NeoEngine::HashString &rstrName, const T &rkData ) : AttributeBase( rstrName ), m_kData( rkData ) {}
00094 
00097         virtual                                      ~Attribute() {}
00098 };
00099 
00100 
00101 #ifdef HAVE_NEOCHUNKIO
00102 
00103 
00109 class NEOWTK_API AttributeChunk : public NeoChunkIO::ComplexChunk
00110 {
00111     public:
00112 
00114         AttributeBase                                *m_pkData;
00115 
00116 
00123                                                       AttributeChunk( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID = "" ) : NeoChunkIO::ComplexChunk( usType, rstrType, rstrID ), m_pkData( 0 ) {}
00124         
00128         virtual                                      ~AttributeChunk();
00129 
00136         virtual int                                   ParseData( unsigned int uiFlags, NeoEngine::FileManager *pkFileManager );
00137 
00145         static NeoChunkIO::Chunk                     *Allocator( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID ) { return new AttributeChunk( usType, rstrType, rstrID ); }
00146 };
00147 
00148 
00149 #endif 
00152 }; 
00155 #endif

Generated on Wed Jan 21 14:21:20 2004 for NeoWTK by doxygen 1.3.5