summaryrefslogtreecommitdiffstats
path: root/pokemod/Time.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-02 08:42:08 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-02 08:42:08 +0000
commit822b5fcaa34b78b9668a58680f9e0d89aa3fd7bd (patch)
tree40dc605213eff20f62b16e5f54e5e5e03d744d63 /pokemod/Time.cpp
parent696414f1dc8bc419427efb6c1abe1bbae0a68a56 (diff)
[FIX] Exceptions no longer used in pokemod
[DEL] Exception and BugCatcher are no longer needed [ADD] Object.cpp added git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@119 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Time.cpp')
-rw-r--r--pokemod/Time.cpp40
1 files changed, 16 insertions, 24 deletions
diff --git a/pokemod/Time.cpp b/pokemod/Time.cpp
index 50754361..e04b69f8 100644
--- a/pokemod/Time.cpp
+++ b/pokemod/Time.cpp
@@ -47,27 +47,13 @@ Time::Time(const QDomElement& xml, const Object* parent, const int id) :
load(xml, id);
}
-bool Time::validate() const
+void Time::validate(QTextStream& stream)
{
- // TODO: validate
-// bool valid = true;
-// static_cast<const Pokemod*>(pokemod())->validationMsg(QString("---Time \"%1\" with id %2---").arg(m_name).arg(id()), Pokemod::V_Msg);
-// if (m_name == "")
-// {
-// static_cast<const Pokemod*>(pokemod())->validationMsg("Name not defined");
-// valid = false;
-// }
-// if (23 < m_hour)
-// {
-// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid starting hour");
-// valid = false;
-// }
-// if (59 < m_minute)
-// {
-// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid start minute");
-// valid = false;
-// }
-// return valid;
+ TEST_SETUP();
+ if (m_name.isEmpty())
+ error(stream, "Name is empty");
+ TEST(setHour, hour);
+ TEST(setMinute, minute);
}
void Time::load(const QDomElement& xml, int id)
@@ -92,17 +78,23 @@ void Time::setName(const QString& name)
m_name = name;
}
-void Time::setHour(const int hour) throw(BoundsException)
+void Time::setHour(const int hour)
{
if (24 <= hour)
- error<BoundsException>("hour");
+ {
+ boundsError("hour");
+ return;
+ }
m_hour = hour;
}
-void Time::setMinute(const int minute) throw(BoundsException)
+void Time::setMinute(const int minute)
{
if (60 <= minute)
- error<BoundsException>("minute");
+ {
+ boundsError("minute");
+ return;
+ }
m_minute = minute;
}