From 6431f3fcdbc2b19fed1bdc13bf1f11aebcd68179 Mon Sep 17 00:00:00 2001 From: James Turk Date: Sun, 27 Feb 2005 05:53:36 +0000 Subject: [PATCH] formatting fixes --- src/util/VersionInfo.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/util/VersionInfo.cpp b/src/util/VersionInfo.cpp index 055988f..b74e10d 100644 --- a/src/util/VersionInfo.cpp +++ b/src/util/VersionInfo.cpp @@ -5,10 +5,14 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: VersionInfo.cpp,v 1.4 2005/02/16 06:58:26 cozman Exp $ +// $Id: VersionInfo.cpp,v 1.5 2005/02/27 05:53:36 cozman Exp $ #include "util/VersionInfo.hpp" +#include + +#include "exceptions.hpp" + namespace photon { namespace util { @@ -63,7 +67,21 @@ bool VersionInfo::operator>(const VersionInfo &rhs) const std::ostream& operator<<(std::ostream &o, const VersionInfo &rhs) { return o << rhs.major << '.' << rhs.minor << '.' << rhs.patch << - " [" << rhs.extra << "]"; + (rhs.extra.empty() ? "" : " [" + rhs.extra + "]"); +} + +void ensureVersion(const std::string& library, + const util::VersionInfo& version, + const util::VersionInfo& required) +{ + std::stringstream ss; + + if(version < required) + { + ss << library << " version " << required << " required; " << + version << " used, please update."; + throw APIError(ss.str()); + } } }