2005-01-27 03:35:23 +00:00
|
|
|
//This file is part of Photon (http://photon.sourceforge.net)
|
|
|
|
//Copyright (C) 2004-2005 James Turk
|
|
|
|
//
|
|
|
|
// Author:
|
|
|
|
// James Turk (jpt2433@rit.edu)
|
|
|
|
//
|
|
|
|
// Version:
|
2005-11-13 07:59:48 +00:00
|
|
|
// $Id: VersionInfo.hpp,v 1.8 2005/11/13 07:59:48 cozman Exp $
|
2005-01-27 03:35:23 +00:00
|
|
|
|
2005-02-13 22:12:02 +00:00
|
|
|
#ifndef PHOTON_UTIL_VERSIONINFO_HPP
|
|
|
|
#define PHOTON_UTIL_VERSIONINFO_HPP
|
2005-01-27 03:35:23 +00:00
|
|
|
|
2005-02-05 02:57:07 +00:00
|
|
|
#include <string>
|
|
|
|
#include <ostream>
|
|
|
|
|
2005-03-03 09:25:19 +00:00
|
|
|
namespace photon
|
|
|
|
{
|
|
|
|
namespace util
|
|
|
|
{
|
2005-01-27 03:35:23 +00:00
|
|
|
|
2005-02-05 02:57:07 +00:00
|
|
|
// Class: VersionInfo
|
|
|
|
// Class which stores version information, such as release numbers.
|
2005-11-13 07:59:48 +00:00
|
|
|
// Format is Major.Minor.Patch [ExtraInfo].
|
2005-02-05 02:57:07 +00:00
|
|
|
//
|
|
|
|
// Operators:
|
2005-02-07 01:48:25 +00:00
|
|
|
// - VersionInfo < VersionInfo
|
|
|
|
// - VersionInfo <= VersionInfo
|
|
|
|
// - VersionInfo == VersionInfo
|
|
|
|
// - VersionInfo >= VersionInfo
|
|
|
|
// - VersionInfo > VersionInfo
|
|
|
|
// - ostream& << VersionInfo
|
2005-02-05 02:57:07 +00:00
|
|
|
class VersionInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Group: Variables
|
|
|
|
|
2005-04-21 19:30:19 +00:00
|
|
|
// Variable: majorRelease
|
2005-11-13 07:59:48 +00:00
|
|
|
// Major release version number, should be changed when major changes take
|
2005-04-21 19:30:19 +00:00
|
|
|
// place.
|
|
|
|
unsigned int majorRelease;
|
2005-02-05 02:57:07 +00:00
|
|
|
|
2005-02-07 01:48:25 +00:00
|
|
|
// Variable: minor
|
2005-11-13 07:59:48 +00:00
|
|
|
// Minor release version number, should be changed when key features are
|
2005-02-05 02:57:07 +00:00
|
|
|
// added/removed/changed.
|
2005-04-21 19:30:19 +00:00
|
|
|
unsigned int minorRelease;
|
2005-02-05 02:57:07 +00:00
|
|
|
|
2005-02-13 22:12:02 +00:00
|
|
|
// Variable: patch
|
|
|
|
// Patch number, should be changed upon every release that isn't
|
2005-02-05 02:57:07 +00:00
|
|
|
// signifigant enough to reflect a change in the minor versioning number.
|
2005-02-13 22:12:02 +00:00
|
|
|
unsigned int patch;
|
2005-02-05 02:57:07 +00:00
|
|
|
|
2005-02-07 01:48:25 +00:00
|
|
|
// Variable: extra
|
2005-02-05 02:57:07 +00:00
|
|
|
// String for holding extra data, such as a release name or special tag.
|
|
|
|
std::string extra;
|
|
|
|
|
|
|
|
// Group: (Con/De)structors
|
2005-11-13 07:59:48 +00:00
|
|
|
public:
|
2005-02-13 22:12:02 +00:00
|
|
|
// Function: VersionInfo
|
|
|
|
// Default constructor.
|
|
|
|
VersionInfo();
|
2005-02-05 02:57:07 +00:00
|
|
|
|
|
|
|
// Function: VersionInfo
|
2005-02-13 22:12:02 +00:00
|
|
|
// Initializing constructor.
|
2005-02-05 02:57:07 +00:00
|
|
|
//
|
|
|
|
// Parameters:
|
2005-11-13 07:59:48 +00:00
|
|
|
// maj - Major version number.
|
2005-02-05 02:57:07 +00:00
|
|
|
// min - Minor version number.
|
2005-02-13 22:12:02 +00:00
|
|
|
// pat - Patch number.
|
2005-02-05 02:57:07 +00:00
|
|
|
// ext - Extra info string. [default: ""]
|
2005-02-13 22:12:02 +00:00
|
|
|
VersionInfo(unsigned int maj, unsigned int min, unsigned int pat,
|
2005-07-18 06:18:50 +00:00
|
|
|
const std::string& ext="");
|
2005-02-05 02:57:07 +00:00
|
|
|
|
|
|
|
//operators
|
|
|
|
bool operator<(const VersionInfo &rhs) const;
|
|
|
|
bool operator<=(const VersionInfo &rhs) const;
|
|
|
|
bool operator==(const VersionInfo &rhs) const;
|
|
|
|
bool operator>=(const VersionInfo &rhs) const;
|
|
|
|
bool operator>(const VersionInfo &rhs) const;
|
2005-01-27 03:35:23 +00:00
|
|
|
|
2005-02-05 02:57:07 +00:00
|
|
|
//output operator
|
|
|
|
friend std::ostream& operator<<(std::ostream &o, const VersionInfo &rhs);
|
|
|
|
};
|
2005-01-27 03:35:23 +00:00
|
|
|
|
2005-03-01 07:51:23 +00:00
|
|
|
// Section: VersionInfo Utilities
|
|
|
|
|
2005-02-27 05:50:39 +00:00
|
|
|
// Function: ensureVersion
|
|
|
|
// Checks a version of a library against the required version, throws
|
|
|
|
// an APIError if the version is not met.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// library - Name of library being initialized.
|
|
|
|
// version - Version of library being used.
|
|
|
|
// required - Required version of library.
|
|
|
|
void ensureVersion(const std::string& library,
|
|
|
|
const util::VersionInfo& version,
|
|
|
|
const util::VersionInfo& required);
|
|
|
|
|
2005-01-27 03:35:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-13 22:12:02 +00:00
|
|
|
#endif //PHOTON_UTIL_VERSIONINFO_HPP
|