cpp_photon/include/util/VersionInfo.hpp

97 lines
2.6 KiB
C++
Raw Normal View History

//This file is part of Photon (http://photon.sourceforge.net)
//Copyright (C) 2004-2005 James Turk
//
// Author:
// James Turk (jpt2433@rit.edu)
//
// Version:
2005-02-27 05:50:39 +00:00
// $Id: VersionInfo.hpp,v 1.3 2005/02/27 05:50:39 cozman Exp $
2005-02-13 22:12:02 +00:00
#ifndef PHOTON_UTIL_VERSIONINFO_HPP
#define PHOTON_UTIL_VERSIONINFO_HPP
2005-02-05 02:57:07 +00:00
#include <string>
#include <ostream>
namespace photon {
namespace util {
2005-02-05 02:57:07 +00:00
// Class: VersionInfo
// Class which stores version information, such as release numbers.
// Format is Major.Minor.Release [ExtraInfo].
//
// 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-02-07 01:48:25 +00:00
// Variable: major
2005-02-05 02:57:07 +00:00
// Major version number, should be changed when major changes take place.
unsigned int major;
2005-02-07 01:48:25 +00:00
// Variable: minor
2005-02-05 02:57:07 +00:00
// Minor version number, should be changed when key features are
// added/removed/changed.
unsigned int minor;
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-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:
// maj - Major version number.
// 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-02-05 02:57:07 +00:00
std::string ext="");
//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-02-05 02:57:07 +00:00
//output operator
friend std::ostream& operator<<(std::ostream &o, const VersionInfo &rhs);
};
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-02-13 22:12:02 +00:00
#endif //PHOTON_UTIL_VERSIONINFO_HPP