diff options
Diffstat (limited to 'pokescripting/ItemWrapper.h')
| -rw-r--r-- | pokescripting/ItemWrapper.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/pokescripting/ItemWrapper.h b/pokescripting/ItemWrapper.h new file mode 100644 index 00000000..784cd63c --- /dev/null +++ b/pokescripting/ItemWrapper.h @@ -0,0 +1,81 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __POKESCRIPTING_ITEMWRAPPER__ +#define __POKESCRIPTING_ITEMWRAPPER__ + +// Pokescripting includes +#include "ItemTypeWrapper.h" +#include "ObjectWrapper.h" + +// Pokemod includes +#include "../pokemod/Item.h" + +namespace Pokescripting +{ +class POKESCRIPTING_EXPORT ItemWrapper : public ObjectWrapper +{ + Q_OBJECT + + public: + ItemWrapper(const Pokemod::Item* item, QObject* parent); + public slots: + QString name() const; + bool sellable() const; + const ItemTypeWrapper* type() const; + int price() const; + QString description() const; + private: + ItemWrapper& operator=(const ItemWrapper& rhs); + + const Pokemod::Item* m_item; +}; + +inline ItemWrapper::ItemWrapper(const Pokemod::Item* item, QObject* parent) : + ObjectWrapper(item, parent), + m_item(item) +{ +} + +inline QString ItemWrapper::name() const +{ + return m_item->name(); +} + +inline bool ItemWrapper::sellable() const +{ + return m_item->sellable(); +} + +inline const ItemTypeWrapper* ItemWrapper::type() const +{ + return new ItemTypeWrapper(pokemod()->itemTypeById(m_item->type()), const_cast<ItemWrapper*>(this)); +} + +inline int ItemWrapper::price() const +{ + return m_item->price(); +} + +inline QString ItemWrapper::description() const +{ + return m_item->description(); +} + +} + +#endif |
