mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Fix warnings
Semi-fix bug #6 (does not work if the zipfile was loaded from a directory) git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1439 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+23
-8
@@ -121,14 +121,8 @@ class Package : public IntrusivePtrVirtualBase {
|
||||
// --------------------------------------------------- : Managing the inside of the package : Reader/writer
|
||||
|
||||
template <typename T>
|
||||
void readFile(const String& file, T& obj) {
|
||||
Reader reader(openIn(file), dynamic_cast<Packaged*>(this), absoluteFilename() + _("/") + file);
|
||||
try {
|
||||
reader.handle_greedy(obj);
|
||||
} catch (const ParseError& err) {
|
||||
throw FileParseError(err.what(), absoluteFilename() + _("/") + file); // more detailed message
|
||||
}
|
||||
}
|
||||
void readFile(const String& file, T& obj);
|
||||
|
||||
template <typename T>
|
||||
T readFile(const String& file) {
|
||||
T obj;
|
||||
@@ -146,6 +140,9 @@ class Package : public IntrusivePtrVirtualBase {
|
||||
// TODO: I dislike putting this here very much. There ought to be a better way.
|
||||
virtual VCSP getVCS() { return new_intrusive<VCS>(); }
|
||||
|
||||
/// true if this is a zip file, false if a directory (updated on open/save)
|
||||
bool isZipfile() { return zipfile; }
|
||||
|
||||
// --------------------------------------------------- : Private stuff
|
||||
private:
|
||||
|
||||
@@ -165,6 +162,10 @@ class Package : public IntrusivePtrVirtualBase {
|
||||
String filename;
|
||||
/// Last modified time
|
||||
DateTime modified;
|
||||
|
||||
/// Zipfile flag
|
||||
bool zipfile;
|
||||
|
||||
public:
|
||||
/// Information on files in the package
|
||||
/** Note: must be public for DECLARE_TYPEOF to work */
|
||||
@@ -278,5 +279,19 @@ intrusive_ptr<T> open_package(const String& filename) {
|
||||
return package;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : readFile definition
|
||||
|
||||
// This is here because it uses dynamic_cast and must be to a complete type.
|
||||
template <typename T>
|
||||
inline void Package::readFile(const String& file, T& obj)
|
||||
{
|
||||
Reader reader(openIn(file), dynamic_cast<Packaged*>(this), absoluteFilename() + _("/") + file);
|
||||
try {
|
||||
reader.handle_greedy(obj);
|
||||
} catch (const ParseError& err) {
|
||||
throw FileParseError(err.what(), absoluteFilename() + _("/") + file); // more detailed message
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user