2023-10-03 20:37:00 +02:00
|
|
|
// 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
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "IAttributes.h"
|
|
|
|
#include "IAttribute.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace video
|
|
|
|
{
|
2024-03-20 19:35:52 +01:00
|
|
|
class ITexture;
|
|
|
|
class IVideoDriver;
|
2023-10-03 20:37:00 +02:00
|
|
|
}
|
|
|
|
namespace io
|
|
|
|
{
|
|
|
|
|
|
|
|
//! Implementation of the IAttributes interface
|
|
|
|
class CAttributes : public IAttributes
|
|
|
|
{
|
|
|
|
public:
|
2024-03-20 19:35:52 +01:00
|
|
|
CAttributes(video::IVideoDriver *driver = 0);
|
2023-10-03 20:37:00 +02:00
|
|
|
~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.
|
2024-03-20 19:35:52 +01:00
|
|
|
const c8 *getAttributeName(s32 index) const override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! Returns the type of an attribute
|
|
|
|
//! \param attributeName: Name for the attribute
|
2024-03-20 19:35:52 +01:00
|
|
|
E_ATTRIBUTE_TYPE getAttributeType(const c8 *attributeName) const override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! 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 if an attribute with a name exists
|
2024-03-20 19:35:52 +01:00
|
|
|
bool existsAttribute(const c8 *attributeName) const override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! Returns attribute index from name, -1 if not found
|
2024-03-20 19:35:52 +01:00
|
|
|
s32 findAttribute(const c8 *attributeName) const override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! Removes all attributes
|
|
|
|
void clear() override;
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Integer Attribute
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Adds an attribute as integer
|
2024-03-20 19:35:52 +01:00
|
|
|
void addInt(const c8 *attributeName, s32 value) override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! Sets an attribute as integer value
|
2024-03-20 19:35:52 +01:00
|
|
|
void setAttribute(const c8 *attributeName, s32 value) override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! 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()
|
2024-03-20 19:35:52 +01:00
|
|
|
s32 getAttributeAsInt(const c8 *attributeName, irr::s32 defaultNotFound = 0) const override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! 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
|
2024-03-20 19:35:52 +01:00
|
|
|
void addFloat(const c8 *attributeName, f32 value) override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! Sets a attribute as float value
|
2024-03-20 19:35:52 +01:00
|
|
|
void setAttribute(const c8 *attributeName, f32 value) override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! 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()
|
2024-03-20 19:35:52 +01:00
|
|
|
f32 getAttributeAsFloat(const c8 *attributeName, irr::f32 defaultNotFound = 0.f) const override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! 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
|
2024-03-20 19:35:52 +01:00
|
|
|
void addBool(const c8 *attributeName, bool value) override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! Sets an attribute as boolean value
|
2024-03-20 19:35:52 +01:00
|
|
|
void setAttribute(const c8 *attributeName, bool value) override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! 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()
|
2024-03-20 19:35:52 +01:00
|
|
|
bool getAttributeAsBool(const c8 *attributeName, bool defaultNotFound = false) const override;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
|
|
|
//! 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:
|
2024-03-20 19:35:52 +01:00
|
|
|
core::array<IAttribute *> Attributes;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
2024-03-20 19:35:52 +01:00
|
|
|
IAttribute *getAttributeP(const c8 *attributeName) const;
|
2023-10-03 20:37:00 +02:00
|
|
|
|
2024-03-20 19:35:52 +01:00
|
|
|
video::IVideoDriver *Driver;
|
2023-10-03 20:37:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace io
|
|
|
|
} // end namespace irr
|