Files
MagicSetEditor2/src/util/version.cpp
T
twanvl d2196eea09 Finally got precompiled headers to work.
Now all C++ files need to #include <util/prec.hpp>
 That is why all .cpp files are touched by this commit

Many changes to installers and update checking:
     - the window is now called PackagesWindow, in a new source file
     - update checking is now independent from the PackagesWindow. For update checking only a list of package versions are needed (vector<PackageDependency>). This is much less information to download at each startup.
     - the list of available packages is now a list of available Installers, since an installer can contain multiple packages.
     - moved the logic of dependency checking etc. to data/installer
     - moved the actual installation to util/io/package_manager
     - moved directory iteration/creation logic to util/file_utils
     - added PackageDirectory: the local and global package directory now have their own object (was part of PackageManager)
     - added PackageVersion: for detecting if a package has been modified after it was installed.
     - added PackageDescription: description/header of a package. Basicly the same as what Packaged provides.
     - added DownloadableInstaller: where to find an insaller, what does it contain?
     - added InstallablePackage: brining it all together: installer, package, status, action.

Current status: the insaller is currently broken in a few places, more on that soon.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@792 0fc631ac-6414-0410-93d0-97cfa31319b6
2007-12-29 18:30:41 +00:00

74 lines
2.6 KiB
C++

//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2007 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/version.hpp>
#include <util/reflect.hpp>
// ----------------------------------------------------------------------------- : Version
UInt Version::toNumber() const { return version; }
String Version::toString() const {
if (version > 20000000) {
// major > 2000, the version is a date, use ISO notation
return String::Format(_("%04d-%02d-%02d"),
(version / 10000) ,
(version / 100) % 100,
(version / 1) % 100);
} else {
return String::Format(_("%d.%d.%d"),
(version / 10000) ,
(version / 100) % 100,
(version / 1) % 100);
}
}
Version Version::fromString(const String& version) {
UInt major = 0, minor = 0, build = 0;
if (wxSscanf(version, _("%u.%u.%u"), &major, &minor, &build)<=1) // a.b.c style
wxSscanf(version, _("%u-%u-%u"), &major, &minor, &build); // date style
return Version(major * 10000 + minor * 100 + build);
}
template <> void Reader::handle(Version& v) {
v = Version::fromString(getValue());
}
template <> void Writer::handle(const Version& v) {
handle(v.toString());
}
template <> void GetDefaultMember::handle(const Version& v) {
handle(v.toNumber());
}
// ----------------------------------------------------------------------------- : Versions
// NOTE: Don't use leading zeroes, they mean octal
const Version app_version = 306; // 0.3.6
#ifdef UNICODE
const Char* version_suffix = _(" (beta)");
#else
const Char* version_suffix = _(" (beta, ascii build)");
#endif
/* Changes:
* 0.2.0 : start of version numbering practice
* 0.2.2 : _("include file")
* 0.2.6 : fix in settings loading
* 0.2.7 : new tag system, different style of close tags
* 0.3.0 : port of code to C++
* 0.3.1 : new keyword system, some new style options
* 0.3.2 : package dependencies
* 0.3.3 : keyword separator before/after
* 0.3.4 : html export; choice rendering based on scripted 'image'
* 0.3.5 : word lists, symbol font 'as text'
* 0.3.6 : free rotation, rotation behaviour changed.
*/
const Version file_version = 306; // 0.3.6