mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Added compact syntax for package dependencies:
"depends on: package version" git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@777 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -5,13 +5,17 @@ Data type: dependency
|
|||||||
[[type:Package]]s can depend on other packages.
|
[[type:Package]]s can depend on other packages.
|
||||||
For example a [[type:stylesheet]] needs a particular version of the corresponding [[type:game]] package, and maybe some additional [[type:include]]s.
|
For example a [[type:stylesheet]] needs a particular version of the corresponding [[type:game]] package, and maybe some additional [[type:include]]s.
|
||||||
|
|
||||||
--Proeprties--
|
--Properties--
|
||||||
! Property Type Description
|
! Property Type Description
|
||||||
| @package@ [[type:string]] Filename of the package this package depends on.
|
| @package@ [[type:string]] Filename of the package this package depends on.
|
||||||
| @version@ [[type:version]] Minimal version of that package that is required.
|
| @version@ [[type:version]] Minimal version of that package that is required.
|
||||||
|
|
||||||
|
The two properties can also be written on a single line, separated by a space (see the examples).
|
||||||
|
|
||||||
--Example--
|
--Example--
|
||||||
The magic-new stylesheet depends on a particular version of the game file:
|
The magic-new stylesheet depends on a particular version of the game file:
|
||||||
>depends on:
|
>depends on:
|
||||||
> package: magic.mse-game
|
> package: magic.mse-game
|
||||||
> version: 2007-06-06
|
> version: 2007-06-06
|
||||||
|
This can be written more compactly as
|
||||||
|
>depends on: magic.mse-game 2007-06-06
|
||||||
|
|||||||
@@ -615,6 +615,12 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\gui\control\package_list.hpp">
|
RelativePath=".\gui\control\package_list.hpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\gui\control\tree_list.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\gui\control\tree_list.hpp">
|
||||||
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="card_list"
|
Name="card_list"
|
||||||
Filter="">
|
Filter="">
|
||||||
|
|||||||
+19
-3
@@ -436,9 +436,25 @@ String Package::toStandardName(const String& name) {
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------- : Packaged
|
// ----------------------------------------------------------------------------- : Packaged
|
||||||
|
|
||||||
IMPLEMENT_REFLECTION(PackageDependency) {
|
template <> void Reader::handle(PackageDependency& dep) {
|
||||||
REFLECT(package);
|
if (!isComplex()) {
|
||||||
REFLECT(version);
|
handle(dep.package);
|
||||||
|
size_t pos = dep.package.find_first_of(_(' '));
|
||||||
|
if (pos != String::npos) {
|
||||||
|
dep.version = Version::fromString(dep.package.substr(pos+1));
|
||||||
|
dep.package = dep.package.substr(0,pos);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
handle(_("package"), dep.package);
|
||||||
|
handle(_("version"), dep.version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template <> void Writer::handle(const PackageDependency& dep) {
|
||||||
|
if (dep.version != Version()) {
|
||||||
|
handle(dep.package + _(" ") + dep.version.toString());
|
||||||
|
} else {
|
||||||
|
handle(dep.package);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// note: reflection must be declared before it is used
|
// note: reflection must be declared before it is used
|
||||||
|
|||||||
Reference in New Issue
Block a user