summaryrefslogtreecommitdiffstats
path: root/src/version.h
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2011-10-23 09:03:12 +0000
committerJon A. Cruz <jon@joncruz.org>2011-10-23 09:03:12 +0000
commitf12861c744aff474afdaa457781008cbb995113f (patch)
tree5118f67c2bd189a9a7514efad6791d0335688502 /src/version.h
parentDocumentation update pass. (diff)
downloadinkscape-f12861c744aff474afdaa457781008cbb995113f.tar.gz
inkscape-f12861c744aff474afdaa457781008cbb995113f.zip
Cleanup constructors and initialization. Removed unused macro.
(bzr r10693)
Diffstat (limited to 'src/version.h')
-rw-r--r--src/version.h82
1 files changed, 46 insertions, 36 deletions
diff --git a/src/version.h b/src/version.h
index faa8c38b2..d90d27772 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
*
@@ -16,45 +17,54 @@
namespace Inkscape {
-struct Version {
- Version() {
- major = 0;
- minor = 0;
- }
- 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 :