summaryrefslogtreecommitdiffstats
path: root/pokemod/CoinList.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-07-21 01:39:22 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-07-21 01:39:22 +0000
commite94d9893b8753e72adb92b2c5eb203830ddf641c (patch)
treefe283d6ede1cfe1a1613742811fb5b34fb8db68c /pokemod/CoinList.cpp
parent65cc463f1d91fe99acf1c4dd9bce7e0038593022 (diff)
Moved to GPLv3 and Qt4, Changed String -> QString, other minor fixes
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@23 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/CoinList.cpp')
-rw-r--r--pokemod/CoinList.cpp55
1 files changed, 27 insertions, 28 deletions
diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp
index 73f611cb..15c61169 100644
--- a/pokemod/CoinList.cpp
+++ b/pokemod/CoinList.cpp
@@ -7,19 +7,18 @@
// Created: Wed Feb 28 21:16:29 2007
// Copyright: ©2007 Ben Boeckel and Nerdy Productions
// Licence:
-// This program is free software; you can redistribute it and/or modify
+// 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 2 of the License, or
+// 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, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+// with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////
#include "CoinList.h"
@@ -57,10 +56,10 @@ void PokeGen::PokeMod::CoinList::Validate()
}
if (GetCoinItemCount())
{
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> itemChecker;
- std::map<String, unsigned> pokemonChecker;
- for (std::vector<CoinItem>::iterator i = items.begin(); i != items.end(); ++i)
+ QMap<unsigned, unsigned> idChecker;
+ QMap<QString, unsigned> itemChecker;
+ QMap<QString, unsigned> pokemonChecker;
+ for (QList<CoinItem>::Iterator i = items.begin(); i != items.end(); ++i)
{
LogSubmoduleIterate("CoinList", id, "item", i->GetId(), name);
if (!i->IsValid())
@@ -71,27 +70,27 @@ void PokeGen::PokeMod::CoinList::Validate()
else if (i->GetType() == CIT_POKEMON)
++pokemonChecker[i->GetObjectString()];
}
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
+ for (QMap<unsigned, unsigned>::ConstIterator i = idChecker.begin(); i != idChecker.end(); ++i)
{
- if (1 < i->second)
+ if (1 < i.value())
{
- LogDuplicateId("CoinList", id, "coin item", i->first, name);
+ LogDuplicateId("CoinList", id, "coin item", i.key(), name);
isValid = false;
}
}
- for (std::map<String, unsigned>::const_iterator i = itemChecker.begin(); i != itemChecker.end(); ++i)
+ for (QMap<QString, unsigned>::ConstIterator i = itemChecker.begin(); i != itemChecker.end(); ++i)
{
- if (1 < i->second)
+ if (1 < i.value())
{
- LogDuplicateSubmodule("CoinList", id, "item", i->first, name);
+ LogDuplicateSubmodule("CoinList", id, "item", i.key(), name);
isValid = false;
}
}
- for (std::map<String, unsigned>::const_iterator i = pokemonChecker.begin(); i != pokemonChecker.end(); ++i)
+ for (QMap<QString, unsigned>::ConstIterator i = pokemonChecker.begin(); i != pokemonChecker.end(); ++i)
{
- if (1 < i->second)
+ if (1 < i.value())
{
- LogDuplicateSubmodule("CoinList", id, "Pokémon", i->first, name);
+ LogDuplicateSubmodule("CoinList", id, "Pokémon", i.key(), name);
isValid = false;
}
}
@@ -121,7 +120,7 @@ void PokeGen::PokeMod::CoinList::ImportIni(Ini &ini, const unsigned _id)
LogImportOver("CoinList", id, name);
}
-void PokeGen::PokeMod::CoinList::ExportIni(std::ofstream &fout) const
+void PokeGen::PokeMod::CoinList::ExportIni(QFile &fout) const
{
LogExportStart("CoinList", id, name);
Ini exCoinList("coinList");
@@ -129,12 +128,12 @@ void PokeGen::PokeMod::CoinList::ExportIni(std::ofstream &fout) const
exCoinList.AddField("name", name);
exCoinList.AddField("value", value);
exCoinList.Export(fout);
- for (std::vector<CoinItem>::const_iterator i = items.begin(); i != items.end(); ++i)
+ for (QList<CoinItem>::ConstIterator i = items.begin(); i != items.end(); ++i)
i->ExportIni(fout, name);
LogExportOver("CoinList", id, name);
}
-void PokeGen::PokeMod::CoinList::SetName(const String &n)
+void PokeGen::PokeMod::CoinList::SetName(const QString &n)
{
LogSetVar("CoinList", id, "name", n, name);
name = n;
@@ -146,7 +145,7 @@ void PokeGen::PokeMod::CoinList::SetValue(const unsigned v)
value = v;
}
-PokeGen::PokeMod::String PokeGen::PokeMod::CoinList::GetName() const
+QString PokeGen::PokeMod::CoinList::GetName() const
{
LogFetchVar("CoinList", id, "name", name, name);
return name;
@@ -170,7 +169,7 @@ const PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(const
return NULL;
}
-const PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(const String &n) const
+const PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(const QString &n) const
{
LogSubmoduleFetch("CoinList", id, "item", n, name);
for (unsigned i = 0; i < GetCoinItemCount(); ++i)
@@ -200,13 +199,13 @@ void PokeGen::PokeMod::CoinList::NewCoinItem(Ini *const ini)
if (ini)
newCoinItem.ImportIni(*ini);
LogSubmoduleNew("CoinList", id, "item", i, name);
- items.push_back(newCoinItem);
+ items.append(newCoinItem);
}
void PokeGen::PokeMod::CoinList::DeleteCoinItem(const unsigned _id)
{
LogSubmoduleRemoveStart("CoinList", id, "item", _id, name);
- for (std::vector<CoinItem>::iterator i = items.begin(); i != items.end(); ++i)
+ for (QList<CoinItem>::Iterator i = items.begin(); i != items.end(); ++i)
{
if (i->GetId() == _id)
{
@@ -217,10 +216,10 @@ void PokeGen::PokeMod::CoinList::DeleteCoinItem(const unsigned _id)
LogSubmoduleRemoveFail("CoinList", id, "item", _id, name);
}
-void PokeGen::PokeMod::CoinList::DeleteCoinItem(const String &n)
+void PokeGen::PokeMod::CoinList::DeleteCoinItem(const QString &n)
{
LogSubmoduleRemoveStart("CoinList", id, "item", n, name);
- for (std::vector<CoinItem>::iterator i = items.begin(); i != items.end(); ++i)
+ for (QList<CoinItem>::Iterator i = items.begin(); i != items.end(); ++i)
{
if (i->GetObjectString() == n)
{