*** empty log message ***
This commit is contained in:
parent
ee10100b1e
commit
d829770bbd
@ -5,10 +5,13 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: VersionInfo.h,v 1.1 2005/01/27 03:35:23 cozman Exp $
|
||||
// $Id: VersionInfo.h,v 1.2 2005/02/05 02:57:07 cozman Exp $
|
||||
//
|
||||
// Revisions:
|
||||
// $Log: VersionInfo.h,v $
|
||||
// Revision 1.2 2005/02/05 02:57:07 cozman
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.1 2005/01/27 03:35:23 cozman
|
||||
// initial import (exceptions,types, and logging,oh my!)
|
||||
//
|
||||
@ -17,10 +20,70 @@
|
||||
#ifndef PHOTON_UTIL_VERSIONINFO_H
|
||||
#define PHOTON_UTIL_VERSIONINFO_H
|
||||
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
|
||||
namespace photon {
|
||||
namespace util {
|
||||
|
||||
// Class: VersionInfo
|
||||
// Class which stores version information, such as release numbers.
|
||||
// Format is Major.Minor.Release [ExtraInfo].
|
||||
//
|
||||
// Operators:
|
||||
// VersionInfo < VersionInfo
|
||||
// VersionInfo <= VersionInfo
|
||||
// VersionInfo == VersionInfo
|
||||
// VersionInfo >= VersionInfo
|
||||
// VersionInfo > VersionInfo
|
||||
// ostream& << VersionInfo
|
||||
class VersionInfo
|
||||
{
|
||||
public:
|
||||
// Group: Variables
|
||||
|
||||
// Variable: Major
|
||||
// Major version number, should be changed when major changes take place.
|
||||
unsigned int major;
|
||||
|
||||
// Variable: Minor
|
||||
// Minor version number, should be changed when key features are
|
||||
// added/removed/changed.
|
||||
unsigned int minor;
|
||||
|
||||
// Variable: Release
|
||||
// Release number, should be changed upon every release that isn't
|
||||
// signifigant enough to reflect a change in the minor versioning number.
|
||||
unsigned int release;
|
||||
|
||||
// Variable: Extra
|
||||
// String for holding extra data, such as a release name or special tag.
|
||||
std::string extra;
|
||||
|
||||
// Group: (Con/De)structors
|
||||
|
||||
// Function: VersionInfo
|
||||
// Initializing constructor, VersionInfo must be initalized with this
|
||||
// constructor.
|
||||
//
|
||||
// Parameters:
|
||||
// maj - Major version number.
|
||||
// min - Minor version number.
|
||||
// rel - Release number.
|
||||
// ext - Extra info string. [default: ""]
|
||||
VersionInfo(unsigned int maj, unsigned int min, unsigned int rel,
|
||||
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;
|
||||
|
||||
//output operator
|
||||
friend std::ostream& operator<<(std::ostream &o, const VersionInfo &rhs);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,13 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: VersionInfo.cpp,v 1.1 2005/01/27 03:35:24 cozman Exp $
|
||||
// $Id: VersionInfo.cpp,v 1.2 2005/02/05 02:57:07 cozman Exp $
|
||||
//
|
||||
// Revisions:
|
||||
// $Log: VersionInfo.cpp,v $
|
||||
// Revision 1.2 2005/02/05 02:57:07 cozman
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.1 2005/01/27 03:35:24 cozman
|
||||
// initial import (exceptions,types, and logging,oh my!)
|
||||
//
|
||||
@ -16,11 +19,59 @@
|
||||
|
||||
#include "util/VersionInfo.h"
|
||||
|
||||
|
||||
namespace photon {
|
||||
namespace util {
|
||||
|
||||
VersionInfo::VersionInfo(unsigned int maj, unsigned int min, unsigned int rel,
|
||||
std::string ext) :
|
||||
major(maj), minor(min), release(rel), extra(ext)
|
||||
{
|
||||
}
|
||||
|
||||
bool VersionInfo::operator<(const VersionInfo &rhs) const
|
||||
{
|
||||
//chained compares, compare numbers in order of importance
|
||||
if(this->major < rhs.major)
|
||||
return true;
|
||||
else if(this->major == rhs.major)
|
||||
{
|
||||
if(this->minor < rhs.minor)
|
||||
return true;
|
||||
else if(this->minor == rhs.minor)
|
||||
{
|
||||
if(this->release < rhs.release)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false; //if it reaches this point rhs is >=
|
||||
}
|
||||
|
||||
bool VersionInfo::operator<=(const VersionInfo &rhs) const
|
||||
{
|
||||
return ((*this) < rhs || (*this) == rhs);
|
||||
}
|
||||
|
||||
bool VersionInfo::operator==(const VersionInfo &rhs) const
|
||||
{
|
||||
return this->extra == rhs.extra && this->release == rhs.release &&
|
||||
this->minor == rhs.minor && this->major == rhs.major;
|
||||
}
|
||||
|
||||
bool VersionInfo::operator>=(const VersionInfo &rhs) const
|
||||
{
|
||||
return ((*this) < rhs || (*this) == rhs);
|
||||
}
|
||||
|
||||
bool VersionInfo::operator>(const VersionInfo &rhs) const
|
||||
{
|
||||
return !((*this) <= rhs);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream &o, const VersionInfo &rhs)
|
||||
{
|
||||
return o << rhs.major << '.' << rhs.minor << '.' << rhs.release <<
|
||||
" [" << rhs.extra << "]";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user