summaryrefslogtreecommitdiff
path: root/include/swversion.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/swversion.h')
-rw-r--r--include/swversion.h34
1 files changed, 29 insertions, 5 deletions
diff --git a/include/swversion.h b/include/swversion.h
index 0fdb8a2..896b8fe 100644
--- a/include/swversion.h
+++ b/include/swversion.h
@@ -1,7 +1,7 @@
/******************************************************************************
* swversion.h - definition of class SWVersion used to compare version info
*
- * $Id: swversion.h,v 1.3 2002/01/06 22:26:23 chrislit Exp $
+ * $Id: swversion.h,v 1.15 2003/12/26 05:53:14 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -20,26 +20,50 @@
*/
#ifndef SWORDVER
-#define SWORDVER "1.5.3"
+#define SWORDVER "1.5.7"
#endif
#ifndef SWVERSION_H
#define SWVERSION_H
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+/** A basic tool class to handle program version numbers.
+*/
class SWVersion {
public:
+ /** The different version subnumbers.
+ */
int major, minor, minor2, minor3;
-
+ /**The constructor.
+ * @param version Version string to be parsed.
+ */
SWVersion(const char *version = "0.0");
+ /** Compare 2 Versions with each other.
+ * @param vi Version number to compare with.
+ * @return >0:this>vi; 0:this==vi; <0:this<vi
+ */
int compare(const SWVersion &vi) const;
- operator const char *() const;
+ /** @return The parsed version number text.
+ */
+ const char *getText() const;
+ /** @return The parsed version number text.
+ */
+ operator const char *() const { return getText(); }
bool operator>(const SWVersion &vi) const {return (compare(vi) > 0);}
bool operator<(const SWVersion &vi) const {return (compare(vi) < 0);}
+ bool operator>=(const SWVersion &vi) const {return (compare(vi) >= 0);}
+ bool operator<=(const SWVersion &vi) const {return (compare(vi) <= 0);}
bool operator==(const SWVersion &vi) const {return (compare(vi) == 0);}
- // current sword library version
+ /** Current sword library version.
+ * Use this to check (e.g. at compile time) if the
+ * version of the sword lib is recent enough for your program.
+ */
static SWVersion currentVersion;
};
+SWORD_NAMESPACE_END
#endif