|
| 1 | +//****************************************************************************** |
| 2 | +// Copyright (C) 1999 Jim Wanner and the SourceMonitor team. |
| 3 | +// |
| 4 | +// Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | +// copy of this software and associated documentation files (the "Software"), |
| 6 | +// to deal in the Software without restriction, including without limitation |
| 7 | +// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | +// and/or sell copies of the Software, and to permit persons to whom the |
| 9 | +// Software is furnished to do so, subject to the following conditions: |
| 10 | +// |
| 11 | +// The above copyright notice and this permission notice shall be included |
| 12 | +// in all copies or substantial portions of the Software. |
| 13 | +// |
| 14 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 | +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 19 | +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 20 | +// DEALINGS IN THE SOFTWARE. |
| 21 | +//****************************************************************************** |
| 22 | + |
| 23 | +#include "version.h" |
| 24 | +#include <sstream> |
| 25 | + |
| 26 | +namespace smos |
| 27 | +{ |
| 28 | + namespace smcore |
| 29 | + { |
| 30 | + //****************************************************************************** |
| 31 | + Version::Version(void) : m_major(0), m_minor(0), m_revision(0) |
| 32 | + { |
| 33 | + } |
| 34 | + //****************************************************************************** |
| 35 | + Version::~Version(void) |
| 36 | + { |
| 37 | + } |
| 38 | + //****************************************************************************** |
| 39 | + Version::Version(const Version &versionObject) |
| 40 | + { |
| 41 | + this->m_major = versionObject.m_major; |
| 42 | + this->m_minor = versionObject.m_minor; |
| 43 | + this->m_revision = versionObject.m_revision; |
| 44 | + } |
| 45 | + //****************************************************************************** |
| 46 | + Version &Version::operator=(const Version &versionObject) |
| 47 | + { |
| 48 | + if (&versionObject != this) |
| 49 | + { |
| 50 | + this->m_major = versionObject.m_major; |
| 51 | + this->m_minor = versionObject.m_minor; |
| 52 | + this->m_revision = versionObject.m_revision; |
| 53 | + } |
| 54 | + return *this; |
| 55 | + } |
| 56 | + //****************************************************************************** |
| 57 | + bool Version::operator==(const Version &versionObject) const |
| 58 | + { |
| 59 | + if (&versionObject == this) |
| 60 | + { |
| 61 | + return true; |
| 62 | + } |
| 63 | + bool result = (this->m_major == versionObject.m_major) && |
| 64 | + (this->m_minor == versionObject.m_minor) && |
| 65 | + (this->m_revision == versionObject.m_revision); |
| 66 | + return result; |
| 67 | + } |
| 68 | + //****************************************************************************** |
| 69 | + bool Version::operator!=(const Version &versionObject) const |
| 70 | + { |
| 71 | + bool result = !(*this == versionObject); |
| 72 | + return result; |
| 73 | + } |
| 74 | + //****************************************************************************** |
| 75 | + smos::smcore::SMString Version::AsString(void) const |
| 76 | + { |
| 77 | + std::stringstream os; |
| 78 | + os << this->m_major << "." << this->m_minor << "." << this->m_revision; |
| 79 | + |
| 80 | + smos::smcore::SMString result = os.str(); |
| 81 | + return result; |
| 82 | + } |
| 83 | + //****************************************************************************** |
| 84 | + void Version::SetVersion(const short &major, const short &minor, const short &revision) |
| 85 | + { |
| 86 | + this->m_major = major; |
| 87 | + this->m_minor = minor; |
| 88 | + this->m_revision = revision; |
| 89 | + } |
| 90 | + } |
| 91 | +} |
0 commit comments