implemented import formats

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@102 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-12-09 23:22:33 +00:00
parent c130916465
commit a400644b25
12 changed files with 260 additions and 18 deletions
+12
View File
@@ -69,6 +69,18 @@ class Set : public Packaged {
/// Styling information for a particular stylesheet
IndexMap<FieldP, ValueP>& stylingDataFor(const StyleSheet&);
/// Find a value in the data by name and type
template <typename T> T& value(const String& name) {
for(IndexMap<FieldP, ValueP>::iterator it = data.begin() ; it != data.end() ; ++it) {
if ((*it)->fieldP->name == name) {
T* ret = dynamic_cast<T*>(it->get());
if (!ret) throw InternalError(_("Set field with name '")+name+_("' doesn't have the right type"));
return *ret;
}
}
throw InternalError(_("Expected a set field with name '")+name+_("'"));
}
protected:
virtual String typeName() const;
virtual void validate(Version);