Irrlicht 3D Engine
IAttributes.h
Go to the documentation of this file.
00001 // Copyright (C) 2002-2012 Nikolaus Gebhardt
00002 // This file is part of the "Irrlicht Engine".
00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
00004 
00005 #ifndef __I_ATTRIBUTES_H_INCLUDED__
00006 #define __I_ATTRIBUTES_H_INCLUDED__
00007 
00008 #include "IReferenceCounted.h"
00009 #include "SColor.h"
00010 #include "vector3d.h"
00011 #include "vector2d.h"
00012 #include "line2d.h"
00013 #include "line3d.h"
00014 #include "triangle3d.h"
00015 #include "position2d.h"
00016 #include "rect.h"
00017 #include "dimension2d.h"
00018 #include "matrix4.h"
00019 #include "quaternion.h"
00020 #include "plane3d.h"
00021 #include "triangle3d.h"
00022 #include "line2d.h"
00023 #include "line3d.h"
00024 #include "irrString.h"
00025 #include "irrArray.h"
00026 #include "IXMLReader.h"
00027 #include "EAttributes.h"
00028 #include "path.h"
00029 
00030 namespace irr
00031 {
00032 namespace video
00033 {
00034     class ITexture;
00035 } // end namespace video
00036 namespace io
00037 {
00038     class IXMLWriter;
00039 
00041 class IAttributes : public virtual IReferenceCounted
00042 {
00043 public:
00044 
00046     virtual u32 getAttributeCount() const = 0;
00047 
00050     virtual const c8* getAttributeName(s32 index) = 0;
00051 
00054     virtual E_ATTRIBUTE_TYPE getAttributeType(const c8* attributeName) = 0;
00055 
00058     virtual E_ATTRIBUTE_TYPE getAttributeType(s32 index) = 0;
00059 
00062     virtual const wchar_t* getAttributeTypeString(const c8* attributeName) = 0;
00063 
00066     virtual const wchar_t* getAttributeTypeString(s32 index) = 0;
00067 
00069     virtual bool existsAttribute(const c8* attributeName) = 0;
00070 
00072     virtual s32 findAttribute(const c8* attributeName) const =0;
00073 
00075     virtual void clear() = 0;
00076 
00083     virtual bool read(io::IXMLReader* reader, bool readCurrentElementOnly=false, const wchar_t* elementName=0) = 0;
00084 
00089     virtual bool write(io::IXMLWriter* writer, bool writeXMLHeader=false, const wchar_t* elementName=0) = 0;
00090 
00091 
00092     /*
00093 
00094         Integer Attribute
00095 
00096     */
00097 
00099     virtual void addInt(const c8* attributeName, s32 value) = 0;
00100 
00102     virtual void setAttribute(const c8* attributeName, s32 value) = 0;
00103 
00107     virtual s32 getAttributeAsInt(const c8* attributeName) const =0;
00108 
00111     virtual s32 getAttributeAsInt(s32 index) const =0;
00112 
00114     virtual void setAttribute(s32 index, s32 value) = 0;
00115 
00116     /*
00117 
00118         Float Attribute
00119 
00120     */
00121 
00123     virtual void addFloat(const c8* attributeName, f32 value) = 0;
00124 
00126     virtual void setAttribute(const c8* attributeName, f32 value) = 0;
00127 
00131     virtual f32 getAttributeAsFloat(const c8* attributeName) = 0;
00132 
00135     virtual f32 getAttributeAsFloat(s32 index) = 0;
00136 
00138     virtual void setAttribute(s32 index, f32 value) = 0;
00139 
00140     /*
00141 
00142         String Attribute
00143 
00144     */
00145 
00147     virtual void addString(const c8* attributeName, const c8* value) = 0;
00148 
00152     virtual void setAttribute(const c8* attributeName, const c8* value) = 0;
00153 
00158     virtual core::stringc getAttributeAsString(const c8* attributeName) = 0;
00159 
00163     virtual void getAttributeAsString(const c8* attributeName, c8* target) = 0;
00164 
00167     virtual core::stringc getAttributeAsString(s32 index) = 0;
00168 
00172     virtual void setAttribute(s32 index, const c8* value) = 0;
00173 
00174     // wide strings
00175 
00177     virtual void addString(const c8* attributeName, const wchar_t* value) = 0;
00178 
00182     virtual void setAttribute(const c8* attributeName, const wchar_t* value) = 0;
00183 
00188     virtual core::stringw getAttributeAsStringW(const c8* attributeName) = 0;
00189 
00193     virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) = 0;
00194 
00197     virtual core::stringw getAttributeAsStringW(s32 index) = 0;
00198 
00202     virtual void setAttribute(s32 index, const wchar_t* value) = 0;
00203 
00204     /*
00205 
00206         Binary Data Attribute
00207 
00208     */
00209 
00211     virtual void addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) = 0;
00212 
00214     virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) = 0;
00215 
00217 
00221     virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) = 0;
00222 
00224 
00228     virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) = 0;
00229 
00231     virtual void setAttribute(s32 index, void* data, s32 dataSizeInBytes ) = 0;
00232 
00233 
00234     /*
00235         Array Attribute
00236     */
00237 
00239     virtual void addArray(const c8* attributeName, const core::array<core::stringw>& value) = 0;
00240 
00244     virtual void setAttribute(const c8* attributeName, const core::array<core::stringw>& value) = 0;
00245 
00250     virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName) = 0;
00251 
00254     virtual core::array<core::stringw> getAttributeAsArray(s32 index) = 0;
00255 
00257     virtual void setAttribute(s32 index, const core::array<core::stringw>& value) = 0;
00258 
00259 
00260     /*
00261 
00262         Bool Attribute
00263 
00264     */
00265 
00267     virtual void addBool(const c8* attributeName, bool value) = 0;
00268 
00270     virtual void setAttribute(const c8* attributeName, bool value) = 0;
00271 
00275     virtual bool getAttributeAsBool(const c8* attributeName) = 0;
00276 
00279     virtual bool getAttributeAsBool(s32 index) = 0;
00280 
00282     virtual void setAttribute(s32 index, bool value) = 0;
00283 
00284     /*
00285 
00286         Enumeration Attribute
00287 
00288     */
00289 
00291     virtual void addEnum(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
00292 
00294     virtual void addEnum(const c8* attributeName, s32 enumValue, const c8* const* enumerationLiterals) = 0;
00295 
00297     virtual void setAttribute(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
00298 
00302     virtual const c8* getAttributeAsEnumeration(const c8* attributeName) = 0;
00303 
00305 
00312     virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse) = 0;
00313 
00315 
00322     virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse) = 0;
00323 
00326     virtual const c8* getAttributeAsEnumeration(s32 index) = 0;
00327 
00331     virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) = 0;
00332 
00336     virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) = 0;
00337 
00339     virtual void setAttribute(s32 index, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
00340 
00341 
00342     /*
00343 
00344         SColor Attribute
00345 
00346     */
00347 
00349     virtual void addColor(const c8* attributeName, video::SColor value) = 0;
00350 
00351 
00353     virtual void setAttribute(const c8* attributeName, video::SColor color) = 0;
00354 
00358     virtual video::SColor getAttributeAsColor(const c8* attributeName) = 0;
00359 
00362     virtual video::SColor getAttributeAsColor(s32 index) = 0;
00363 
00365     virtual void setAttribute(s32 index, video::SColor color) = 0;
00366 
00367     /*
00368 
00369         SColorf Attribute
00370 
00371     */
00372 
00374     virtual void addColorf(const c8* attributeName, video::SColorf value) = 0;
00375 
00377     virtual void setAttribute(const c8* attributeName, video::SColorf color) = 0;
00378 
00382     virtual video::SColorf getAttributeAsColorf(const c8* attributeName) = 0;
00383 
00386     virtual video::SColorf getAttributeAsColorf(s32 index) = 0;
00387 
00389     virtual void setAttribute(s32 index, video::SColorf color) = 0;
00390 
00391 
00392     /*
00393 
00394         Vector3d Attribute
00395 
00396     */
00397 
00399     virtual void addVector3d(const c8* attributeName, core::vector3df value) = 0;
00400 
00402     virtual void setAttribute(const c8* attributeName, core::vector3df v) = 0;
00403 
00407     virtual core::vector3df getAttributeAsVector3d(const c8* attributeName) = 0;
00408 
00411     virtual core::vector3df getAttributeAsVector3d(s32 index) = 0;
00412 
00414     virtual void setAttribute(s32 index, core::vector3df v) = 0;
00415 
00416     /*
00417 
00418         Vector2d Attribute
00419 
00420     */
00421 
00423     virtual void addVector2d(const c8* attributeName, core::vector2df value) = 0;
00424 
00426     virtual void setAttribute(const c8* attributeName, core::vector2df v) = 0;
00427 
00431     virtual core::vector2df getAttributeAsVector2d(const c8* attributeName) = 0;
00432 
00435     virtual core::vector2df getAttributeAsVector2d(s32 index) = 0;
00436 
00438     virtual void setAttribute(s32 index, core::vector2df v) = 0;
00439 
00440     /*
00441 
00442         Position2d Attribute
00443 
00444     */
00445 
00447     virtual void addPosition2d(const c8* attributeName, core::position2di value) = 0;
00448 
00450     virtual void setAttribute(const c8* attributeName, core::position2di v) = 0;
00451 
00455     virtual core::position2di getAttributeAsPosition2d(const c8* attributeName) = 0;
00456 
00459     virtual core::position2di getAttributeAsPosition2d(s32 index) = 0;
00460 
00462     virtual void setAttribute(s32 index, core::position2di v) = 0;
00463 
00464     /*
00465 
00466         Rectangle Attribute
00467 
00468     */
00469 
00471     virtual void addRect(const c8* attributeName, core::rect<s32> value) = 0;
00472 
00474     virtual void setAttribute(const c8* attributeName, core::rect<s32> v) = 0;
00475 
00479     virtual core::rect<s32> getAttributeAsRect(const c8* attributeName) = 0;
00480 
00483     virtual core::rect<s32> getAttributeAsRect(s32 index) = 0;
00484 
00486     virtual void setAttribute(s32 index, core::rect<s32> v) = 0;
00487 
00488 
00489     /*
00490 
00491         Dimension2d Attribute
00492 
00493     */
00494 
00496     virtual void addDimension2d(const c8* attributeName, core::dimension2d<u32> value) = 0;
00497 
00499     virtual void setAttribute(const c8* attributeName, core::dimension2d<u32> v) = 0;
00500 
00504     virtual core::dimension2d<u32> getAttributeAsDimension2d(const c8* attributeName) = 0;
00505 
00508     virtual core::dimension2d<u32> getAttributeAsDimension2d(s32 index) = 0;
00509 
00511     virtual void setAttribute(s32 index, core::dimension2d<u32> v) = 0;
00512 
00513 
00514     /*
00515         matrix attribute
00516     */
00517 
00519     virtual void addMatrix(const c8* attributeName, const core::matrix4& v) = 0;
00520 
00522     virtual void setAttribute(const c8* attributeName, const core::matrix4& v) = 0;
00523 
00527     virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName) = 0;
00528 
00531     virtual core::matrix4 getAttributeAsMatrix(s32 index) = 0;
00532 
00534     virtual void setAttribute(s32 index, const core::matrix4& v) = 0;
00535 
00536     /*
00537         quaternion attribute
00538 
00539     */
00540 
00542     virtual void addQuaternion(const c8* attributeName, core::quaternion v) = 0;
00543 
00545     virtual void setAttribute(const c8* attributeName, core::quaternion v) = 0;
00546 
00550     virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName) = 0;
00551 
00554     virtual core::quaternion getAttributeAsQuaternion(s32 index) = 0;
00555 
00557     virtual void setAttribute(s32 index, core::quaternion v) = 0;
00558 
00559     /*
00560 
00561         3d bounding box
00562 
00563     */
00564 
00566     virtual void addBox3d(const c8* attributeName, core::aabbox3df v) = 0;
00567 
00569     virtual void setAttribute(const c8* attributeName, core::aabbox3df v) = 0;
00570 
00574     virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName) = 0;
00575 
00578     virtual core::aabbox3df getAttributeAsBox3d(s32 index) = 0;
00579 
00581     virtual void setAttribute(s32 index, core::aabbox3df v) = 0;
00582 
00583     /*
00584 
00585         plane
00586 
00587     */
00588 
00590     virtual void addPlane3d(const c8* attributeName, core::plane3df v) = 0;
00591 
00593     virtual void setAttribute(const c8* attributeName, core::plane3df v) = 0;
00594 
00598     virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName) = 0;
00599 
00602     virtual core::plane3df getAttributeAsPlane3d(s32 index) = 0;
00603 
00605     virtual void setAttribute(s32 index, core::plane3df v) = 0;
00606 
00607 
00608     /*
00609 
00610         3d triangle
00611 
00612     */
00613 
00615     virtual void addTriangle3d(const c8* attributeName, core::triangle3df v) = 0;
00616 
00618     virtual void setAttribute(const c8* attributeName, core::triangle3df v) = 0;
00619 
00623     virtual core::triangle3df getAttributeAsTriangle3d(const c8* attributeName) = 0;
00624 
00627     virtual core::triangle3df getAttributeAsTriangle3d(s32 index) = 0;
00628 
00630     virtual void setAttribute(s32 index, core::triangle3df v) = 0;
00631 
00632 
00633     /*
00634 
00635         line 2d
00636 
00637     */
00638 
00640     virtual void addLine2d(const c8* attributeName, core::line2df v) = 0;
00641 
00643     virtual void setAttribute(const c8* attributeName, core::line2df v) = 0;
00644 
00648     virtual core::line2df getAttributeAsLine2d(const c8* attributeName) = 0;
00649 
00652     virtual core::line2df getAttributeAsLine2d(s32 index) = 0;
00653 
00655     virtual void setAttribute(s32 index, core::line2df v) = 0;
00656 
00657 
00658     /*
00659 
00660         line 3d
00661 
00662     */
00663 
00665     virtual void addLine3d(const c8* attributeName, core::line3df v) = 0;
00666 
00668     virtual void setAttribute(const c8* attributeName, core::line3df v) = 0;
00669 
00673     virtual core::line3df getAttributeAsLine3d(const c8* attributeName) = 0;
00674 
00677     virtual core::line3df getAttributeAsLine3d(s32 index) = 0;
00678 
00680     virtual void setAttribute(s32 index, core::line3df v) = 0;
00681 
00682 
00683     /*
00684 
00685         Texture Attribute
00686 
00687     */
00688 
00690     virtual void addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0;
00691 
00693     virtual void setAttribute(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0;
00694 
00697     virtual video::ITexture* getAttributeAsTexture(const c8* attributeName) = 0;
00698 
00701     virtual video::ITexture* getAttributeAsTexture(s32 index) = 0;
00702 
00704     virtual void setAttribute(s32 index, video::ITexture* texture, const io::path& filename = "") = 0;
00705 
00706 
00707     /*
00708 
00709         User Pointer Attribute
00710 
00711     */
00712 
00714     virtual void addUserPointer(const c8* attributeName, void* userPointer) = 0;
00715 
00717     virtual void setAttribute(const c8* attributeName, void* userPointer) = 0;
00718 
00721     virtual void* getAttributeAsUserPointer(const c8* attributeName) = 0;
00722 
00725     virtual void* getAttributeAsUserPointer(s32 index) = 0;
00726 
00728     virtual void setAttribute(s32 index, void* userPointer) = 0;
00729 
00730 };
00731 
00732 } // end namespace io
00733 } // end namespace irr
00734 
00735 #endif
00736 
00737 
00738