swversion.h

00001 /******************************************************************************
00002  *  swversion.h   - definition of class SWVersion used to compare version info
00003  *
00004  * $Id: swversion.h 1763 2005-04-03 23:57:03Z scribe $
00005  *
00006  * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
00007  *      CrossWire Bible Society
00008  *      P. O. Box 2528
00009  *      Tempe, AZ  85280-2528
00010  *
00011  * This program is free software; you can redistribute it and/or modify it
00012  * under the terms of the GNU General Public License as published by the
00013  * Free Software Foundation version 2.
00014  *
00015  * This program is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * General Public License for more details.
00019  *
00020  */
00021 
00022 #ifndef SWVERSION_H
00023 #define SWVERSION_H
00024 
00025 #include <defs.h>
00026 SWORD_NAMESPACE_START
00027 
00030 class SWDLLEXPORT SWVersion {
00031         public:
00034         int major, minor, minor2, minor3;
00038         SWVersion(const char *version = "0.0");
00043         int compare(const SWVersion &vi) const;
00046         const char *getText() const;
00049         operator const char *() const { return getText(); }
00050         bool operator>(const SWVersion &vi) const {return (compare(vi) > 0);}
00051         bool operator<(const SWVersion &vi) const {return (compare(vi) < 0);}
00052         bool operator>=(const SWVersion &vi) const {return (compare(vi) >= 0);}
00053         bool operator<=(const SWVersion &vi) const {return (compare(vi) <= 0);}
00054         bool operator==(const SWVersion &vi) const {return (compare(vi) == 0);}
00055 
00060         static SWVersion currentVersion;
00061 };
00062 
00063 SWORD_NAMESPACE_END
00064 #endif
00065