added time_created and time_modified to Card. This changes the file format

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1321 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2009-01-09 19:07:14 +00:00
parent 2dab839906
commit 4fde933a11
5 changed files with 26 additions and 4 deletions
+7
View File
@@ -371,8 +371,15 @@ template <> void Reader::handle(tribool& b) {
const String& v = getValue();
b = (v==_("true") || v==_("1") || v==_("yes"));
}
// ----------------------------------------------------------------------------- : Handling less basic util types
template <> void Reader::handle(wxDateTime& date) {
if (!date.ParseDateTime(getValue().c_str())) {
throw ParseError(_("Expected a date and time"));
}
}
template <> void Reader::handle(Vector2D& vec) {
if (!wxSscanf(getValue().c_str(), _("(%lf,%lf)"), &vec.x, &vec.y)) {
throw ParseError(_("Expected (x,y)"));
+5
View File
@@ -113,6 +113,11 @@ template <> void Writer::handle(const tribool& value) {
// ----------------------------------------------------------------------------- : Handling less basic util types
template <> void Writer::handle(const wxDateTime& date) {
if (date.IsValid()) {
handle(date.Format(_("%Y-%m-%d %H:%M:%S")));
}
}
template <> void Writer::handle(const Vector2D& vec) {
handle(String::Format(_("(%.10lf,%.10lf)"), vec.x, vec.y));
}