diff options
| author | Andrew Higginson <at.higginson@gmail.com> | 2011-12-27 21:04:47 +0000 |
|---|---|---|
| committer | Andrew <at.higginson@gmail.com> | 2011-12-27 21:04:47 +0000 |
| commit | 80960b623a99aae1402ab651b2974ef544ed3b03 (patch) | |
| tree | ba49d42c2789e9e11f805e2d5263e10f9fedeef8 /src/version.h | |
| parent | try to fix bug (diff) | |
| parent | GDL: Cherry-pick upstream patch 73852 (2011-03-23) - Add missing return value. (diff) | |
| download | inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.tar.gz inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.zip | |
merged with trunk so I can build again...
(bzr r10092.1.36)
Diffstat (limited to 'src/version.h')
| -rw-r--r-- | src/version.h | 81 |
1 files changed, 47 insertions, 34 deletions
diff --git a/src/version.h b/src/version.h index c62063123..26fbc11a3 100644 --- a/src/version.h +++ b/src/version.h @@ -1,6 +1,7 @@ /* * Authors: * MenTaLguY <mental@rydia.net> + * Jon A. Cruz <jon@joncruz.org> * * Copyright (C) 2003 MenTaLguY * @@ -10,48 +11,60 @@ #ifndef SEEN_INKSCAPE_VERSION_H #define SEEN_INKSCAPE_VERSION_H -#include <glib/gtypes.h> +#include <glib.h> #define SVG_VERSION "1.1" namespace Inkscape { -struct Version { - Version() {} - Version(unsigned mj, unsigned mn) { - // somebody pollutes our namespace with major() and minor() - // macros, so we can't use new-style initializers - major = mj; - minor = mn; - } - - unsigned major; - unsigned minor; - - bool operator>(Version const &other) const { - return major > other.major || - ( major == other.major && minor > other.minor ); - } - bool operator==(Version const &other) const { - return major == other.major && minor == other.minor; - } - bool operator!=(Version const &other) const { - return major != other.major || minor != other.minor; - } - bool operator<(Version const &other) const { - return major < other.major || - ( major == other.major && minor < other.minor ); - } +class Version { +public: + + Version() : _major(0), _minor(0) {} + + // Note: somebody pollutes our namespace with major() and minor() + Version(unsigned mj, unsigned mn) : _major(mj), _minor(mn) {} + + bool operator>(Version const &other) const { + return _major > other._major || + ( _major == other._major && _minor > other._minor ); + } + + bool operator==(Version const &other) const { + return _major == other._major && _minor == other._minor; + } + + bool operator!=(Version const &other) const { + return _major != other._major || _minor != other._minor; + } + + bool operator<(Version const &other) const { + return _major < other._major || + ( _major == other._major && _minor < other._minor ); + } + + unsigned int _major; + unsigned int _minor; }; } -#define SP_VERSION_IS_ZERO (v) (!(v).major && !(v).minor) +gboolean sp_version_from_string(const gchar *string, Inkscape::Version *version); -gboolean sp_version_from_string (const gchar *string, Inkscape::Version *version); -gchar *sp_version_to_string (Inkscape::Version version); -gboolean sp_version_inside_range (Inkscape::Version version, - unsigned major_min, unsigned minor_min, - unsigned major_max, unsigned minor_max); +gchar *sp_version_to_string(Inkscape::Version version); -#endif +gboolean sp_version_inside_range(Inkscape::Version version, + unsigned major_min, unsigned minor_min, + unsigned major_max, unsigned minor_max); + +#endif // SEEN_INKSCAPE_VERSION_H +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)) + indent-tabs-mode:nil + fill-column:75 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : |
