Example #1
0
	virtual AColor toColor() const {
		AColor c = parse_acolor(value);
		if (!c.Ok()) {
			throw ScriptErrorConversion(value, typeName(), _TYPE_("color"));
		}
		return c;
	}
Example #2
0
	virtual wxDateTime toDateTime() const {
		wxDateTime date;
		wxString::const_iterator end;
		if (!date.ParseDateTime(value, &end)) {
			throw ScriptErrorConversion(value, typeName(), _TYPE_("date"));
		}
		return date;
	}
Example #3
0
	virtual int toInt() const {
		long l;
		if (value.ToLong(&l)) {
			return l;
		} else {
			throw ScriptErrorConversion(value, typeName(), _TYPE_("integer"));
		}
	}
Example #4
0
	virtual double toDouble() const {
		double d;
		if (value.ToDouble(&d)) {
			return d;
		} else {
			throw ScriptErrorConversion(value, typeName(), _TYPE_("double"));
		}
	}
Example #5
0
	virtual bool toBool() const {
		if (value == _("yes") || value == _("true")) {
			return true;
		} else if (value == _("no") || value == _("false") || value.empty()) {
			return false;
		} else {
			throw ScriptErrorConversion(value, typeName(), _TYPE_("boolean"));
		}
	}
	virtual wxDateTime toDateTime() const {
		wxDateTime date;
		wxString::const_iterator *end;
		bool ret = date.ParseDateTime(value.c_str(), end);
		if (!ret) {
			throw ScriptErrorConversion(value, typeName(), _TYPE_("date"));
		}
		return date;
	}
Example #7
0
int          ScriptValue::itemCount()                       const { throw ScriptErrorConversion(typeName(), _TYPE_("collection")); }
Example #8
0
ScriptValueP ScriptValue::makeIterator()                    const { return delay_error(ScriptErrorConversion(typeName(), _TYPE_("collection"))); }
Example #9
0
ScriptValueP ScriptValue::do_eval(Context&, bool)           const { return delay_error(ScriptErrorConversion(typeName(), _TYPE_("function"))); }
Example #10
0
GeneratedImageP ScriptValue::toImage()                      const { throw ScriptErrorConversion(typeName(), _TYPE_("image"   )); }
Example #11
0
wxDateTime   ScriptValue::toDateTime()                      const { throw ScriptErrorConversion(typeName(), _TYPE_("date"    )); }
Example #12
0
AColor       ScriptValue::toColor()                         const { throw ScriptErrorConversion(typeName(), _TYPE_("color"   )); }
Example #13
0
double       ScriptValue::toDouble()                        const { throw ScriptErrorConversion(typeName(), _TYPE_("double"  )); }
Example #14
0
bool         ScriptValue::toBool()                          const { throw ScriptErrorConversion(typeName(), _TYPE_("boolean" )); }
Example #15
0
int          ScriptValue::toInt()                           const { throw ScriptErrorConversion(typeName(), _TYPE_("integer" )); }
Example #16
0
String       ScriptValue::toString()                        const { throw ScriptErrorConversion(typeName(), _TYPE_("string" )); }