separate short_name for packages, moved full_name,short_name and icon_filename to Packaged

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@173 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-12-25 14:19:36 +00:00
parent f7d12a4114
commit 031266c71b
12 changed files with 41 additions and 63 deletions
+15 -4
View File
@@ -60,9 +60,6 @@ String Package::fullName() const {
const String& Package::absoluteFilename() const {
return filename;
}
InputStreamP Package::openIconFile() {
return InputStreamP();
}
void Package::open(const String& n) {
@@ -408,12 +405,21 @@ String Package::toStandardName(const String& name) {
// note: reflection must be declared before it is used
IMPLEMENT_REFLECTION(Packaged) {
// default does nothing
REFLECT(short_name);
REFLECT(full_name);
REFLECT_N("icon", icon_filename);
}
Packaged::Packaged() {
}
InputStreamP Packaged::openIconFile() {
if (!icon_filename.empty()) {
return openIn(icon_filename);
} else {
return InputStreamP();
}
}
void Packaged::open(const String& package) {
Package::open(package);
Reader reader(openIn(typeName()), absoluteFilename() + _("/") + typeName());
@@ -436,3 +442,8 @@ void Packaged::saveAs(const String& package) {
referenceFile(typeName());
Package::saveAs(package);
}
void Packaged::validate(Version) {
// a default for the short name
if (short_name.empty()) short_name = name();
}