summaryrefslogtreecommitdiffstats
path: root/sigmod/CoinList.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-12-29 12:09:27 -0500
committerBen Boeckel <MathStuf@gmail.com>2008-12-29 12:09:27 -0500
commit8e278873d4bd35a7cd7f3b6d9d7852fa422370b8 (patch)
tree9e97b71d30779c07c79ca166e1d704a3de4d5e4f /sigmod/CoinList.cpp
parente801b73a2f9cb845913cf546002c8f50eefc473c (diff)
Merged CHECK macro branch
Diffstat (limited to 'sigmod/CoinList.cpp')
-rw-r--r--sigmod/CoinList.cpp108
1 files changed, 8 insertions, 100 deletions
diff --git a/sigmod/CoinList.cpp b/sigmod/CoinList.cpp
index d2b3e3a7..a8fd4f2f 100644
--- a/sigmod/CoinList.cpp
+++ b/sigmod/CoinList.cpp
@@ -102,107 +102,16 @@ QDomElement Sigmod::CoinList::save() const
return xml;
}
-void Sigmod::CoinList::setName(const QString& name)
-{
- CHECK(name);
-}
-
-void Sigmod::CoinList::setScript(const Sigcore::Script& script)
-{
- CHECK(script);
-}
-
-QString Sigmod::CoinList::name() const
-{
- return m_name;
-}
-
-Sigcore::Script Sigmod::CoinList::script() const
-{
- return m_script;
-}
-
-const Sigmod::CoinListItem* Sigmod::CoinList::item(const int index) const
-{
- if (index < itemCount())
- return m_items.at(index);
- return NULL;
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::item(const int index)
-{
- if (index < itemCount())
- return m_items[index];
- return NULL;
-}
-
-const Sigmod::CoinListItem* Sigmod::CoinList::itemById(const int id) const
-{
- return item(itemIndex(id));
-}
+SETTER(CoinList, QString&, Name, name)
+SETTER(CoinList, Sigcore::Script&, Script, script)
-Sigmod::CoinListItem* Sigmod::CoinList::itemById(const int id)
-{
- return item(itemIndex(id));
-}
+GETTER(CoinList, QString, name)
+GETTER(CoinList, Sigcore::Script, script)
-int Sigmod::CoinList::itemIndex(const int id) const
-{
- for (int i = 0; i < itemCount(); ++i)
- {
- if (m_items[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
+CHECK(CoinList, QString&, name)
+CHECK(CoinList, Sigcore::Script&, script)
-int Sigmod::CoinList::itemCount() const
-{
- return m_items.size();
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::newItem()
-{
- return newItem(new CoinListItem(this, itemId()));
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::newItem(const QDomElement& xml)
-{
- return newItem(new CoinListItem(xml, this, itemId()));
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::newItem(const CoinListItem& item)
-{
- return newItem(new CoinListItem(item, this, itemId()));
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::newItem(CoinListItem* item)
-{
- m_items.append(item);
- return item;
-}
-
-void Sigmod::CoinList::deleteItem(const int index)
-{
- if (index < itemCount())
- {
- delete m_items[index];
- m_items.removeAt(index);
- }
-}
-
-void Sigmod::CoinList::deleteItemById(const int id)
-{
- deleteItem(itemIndex(id));
-}
-
-int Sigmod::CoinList::itemId() const
-{
- int i = 0;
- while ((i < itemCount()) && (itemIndex(i) != INT_MAX))
- ++i;
- return i;
-}
+SUBCLASS(CoinList, Item, item, items)
Sigmod::CoinList& Sigmod::CoinList::operator=(const CoinList& rhs)
{
@@ -217,6 +126,5 @@ Sigmod::CoinList& Sigmod::CoinList::operator=(const CoinList& rhs)
void Sigmod::CoinList::clear()
{
- qDeleteAll(m_items);
- m_items.clear();
+ SUBCLASS_CLEAR(items);
}