1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_ATTRIBUTES_H_INCLUDED__
#define __C_ATTRIBUTES_H_INCLUDED__
#include "IAttributes.h"
#include "IAttribute.h"
namespace irr
{
namespace video
{
class ITexture;
class IVideoDriver;
}
namespace io
{
//! Implementation of the IAttributes interface
class CAttributes : public IAttributes
{
public:
CAttributes(video::IVideoDriver* driver=0);
~CAttributes();
//! Returns amount of attributes in this collection of attributes.
u32 getAttributeCount() const override;
//! Returns attribute name by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
const c8* getAttributeName(s32 index) const override;
//! Returns the type of an attribute
//! \param attributeName: Name for the attribute
E_ATTRIBUTE_TYPE getAttributeType(const c8* attributeName) const override;
//! Returns attribute type by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
E_ATTRIBUTE_TYPE getAttributeType(s32 index) const override;
//! Returns the type string of the attribute
//! \param attributeName: String for the attribute type
//! \param defaultNotFound Value returned when attributeName was not found
const wchar_t* getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound = L"unknown") const override;
//! Returns the type string of the attribute by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
const wchar_t* getAttributeTypeString(s32 index, const wchar_t* defaultNotFound = L"unknown") const override;
//! Returns if an attribute with a name exists
bool existsAttribute(const c8* attributeName) const override;
//! Returns attribute index from name, -1 if not found
s32 findAttribute(const c8* attributeName) const override;
//! Removes all attributes
void clear() override;
/*
Integer Attribute
*/
//! Adds an attribute as integer
void addInt(const c8* attributeName, s32 value) override;
//! Sets an attribute as integer value
void setAttribute(const c8* attributeName, s32 value) override;
//! Gets an attribute as integer value
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
s32 getAttributeAsInt(const c8* attributeName, irr::s32 defaultNotFound=0) const override;
//! Gets an attribute as integer value
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
s32 getAttributeAsInt(s32 index) const override;
//! Sets an attribute as integer value
void setAttribute(s32 index, s32 value) override;
/*
Float Attribute
*/
//! Adds an attribute as float
void addFloat(const c8* attributeName, f32 value) override;
//! Sets a attribute as float value
void setAttribute(const c8* attributeName, f32 value) override;
//! Gets an attribute as float value
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
f32 getAttributeAsFloat(const c8* attributeName, irr::f32 defaultNotFound=0.f) const override;
//! Gets an attribute as float value
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
f32 getAttributeAsFloat(s32 index) const override;
//! Sets an attribute as float value
void setAttribute(s32 index, f32 value) override;
/*
Bool Attribute
*/
//! Adds an attribute as bool
void addBool(const c8* attributeName, bool value) override;
//! Sets an attribute as boolean value
void setAttribute(const c8* attributeName, bool value) override;
//! Gets an attribute as boolean value
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
bool getAttributeAsBool(const c8* attributeName, bool defaultNotFound=false) const override;
//! Gets an attribute as boolean value
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
bool getAttributeAsBool(s32 index) const override;
//! Sets an attribute as boolean value
void setAttribute(s32 index, bool value) override;
protected:
core::array<IAttribute*> Attributes;
IAttribute* getAttributeP(const c8* attributeName) const;
video::IVideoDriver* Driver;
};
} // end namespace io
} // end namespace irr
#endif
|