Fixed/hacked 'no parameter' for 0.2.7 keyword compatability;

Added 'just_header' flag to make stylesheet list load faster;
Added versioning and dependency support to packages

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@320 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-05 23:19:52 +00:00
parent e7bc7438b8
commit 6feef4feb0
11 changed files with 146 additions and 22 deletions
+11 -4
View File
@@ -14,6 +14,7 @@
#include <wx/filename.h>
DECLARE_POINTER_TYPE(Packaged);
class PackageDependency;
// ----------------------------------------------------------------------------- : PackageManager
@@ -40,9 +41,10 @@ class PackageManager {
PackagedP& p = loaded_packages[filename];
shared_ptr<T> typedP = dynamic_pointer_cast<T>(p);
if (typedP) {
typedP->loadFully();
return typedP;
} else {
// not loaded, or loaded with wrong type
// not loaded, or loaded with wrong type (i.e. with just_header)
p = typedP = new_shared<T>();
typedP->open(filename);
return typedP;
@@ -50,7 +52,9 @@ class PackageManager {
}
/// Open a package with the specified name, the type of package is determined by its extension!
PackagedP openAny(const String& name);
/** @param if just_header is true, then the package is not fully parsed.
*/
PackagedP openAny(const String& name, bool just_header = false);
/// Find a package whos name matches a pattern
/** Find more using wxFindNextFile().
@@ -58,9 +62,12 @@ class PackageManager {
*/
String findFirst(const String& pattern);
// Open a file from a package, with a name encoded as "package/file"
/// Open a file from a package, with a name encoded as "package/file"
InputStreamP openFileFromPackage(const String& name);
/// Check if the given dependency is currently installed
bool checkDependency(const PackageDependency& dep, bool report_errors = false);
private:
map<String, PackagedP> loaded_packages;
String data_directory;