47 #ifndef AI_METADATA_H_INC 48 #define AI_METADATA_H_INC 50 #if defined(_MSC_VER) && (_MSC_VER <= 1500) 51 # include "Compiler/pstdint.h" 105 #endif // __cplusplus 145 for (
unsigned i=0; i<mNumProperties; ++i) {
146 void* data = mValues[i].mData;
147 switch (mValues[i].mType) {
149 delete static_cast<bool*
>(data);
152 delete static_cast<int32_t*
>(data);
155 delete static_cast<uint64_t*
>(data);
158 delete static_cast<float*
>(data);
161 delete static_cast<double*
>(data);
164 delete static_cast<aiString*
>(data);
188 aiMetadata *Alloc(
unsigned int numProperties ) {
189 if ( 0 == numProperties ) {
210 inline void Add(
const std::string& key,
const T& value)
215 for(
unsigned int i = 0; i < mNumProperties; ++i)
217 new_keys[i] = mKeys[i];
218 new_values[i] = mValues[i];
225 mValues = new_values;
229 Set(mNumProperties - 1, key, value);
234 bool Set(
unsigned index,
const std::string& key,
const T& value ) {
236 if ( index >= mNumProperties ) {
249 mValues[index].mType = GetAiType(value);
251 mValues[index].mData =
new T(value);
258 bool Get(
unsigned index, T& value ) {
260 if ( index >= mNumProperties ) {
266 if ( GetAiType( value ) != mValues[ index ].mType ) {
272 value = *
static_cast<T*
>(mValues[index].mData);
279 bool Get(
const aiString& key, T& value ) {
281 for (
unsigned int i = 0; i < mNumProperties; ++i ) {
282 if ( mKeys[ i ] == key ) {
283 return Get( i, value );
290 inline bool Get(
const std::string& key, T& value ) {
300 if ( index >= mNumProperties ) {
305 entry = &mValues[index];
310 #endif // __cplusplus 314 #endif // AI_METADATA_H_INC Metadata entry.
Definition: metadata.h:82
Represents an UTF-8 string, zero byte terminated.
Definition: types.h:252
uint64 uint64_t
Default qualifier 64 bit unsigned integer type.
Definition: fwd.hpp:143
Definition: vector3.h:135
int32 int32_t
32 bit signed integer type.
Definition: fwd.hpp:71