123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- /*=============================================================================
- Library: CTK
- Copyright (c) 2010 German Cancer Research Center,
- Division of Medical and Biological Informatics
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- =============================================================================*/
- #ifndef CTKVERSIONRANGE_H
- #define CTKVERSIONRANGE_H
- #include "ctkVersion.h"
- namespace ctk {
- /**
- * Class representing CTK version ranges.
- */
- class VersionRange
- {
- private:
- Version* low;
- Version* high;
- bool lowIncluded;
- bool highIncluded;
- public:
- /**
- * The empty version range "[0.0.0,inf)".
- */
- static const VersionRange& defaultVersionRange();
- /**
- * Construct a VersionRange object.
- * Format for a range:
- * ( "(" | "[" ) LOW_VERSION "," HIGH_VERSION ( ")" | "]" )
- * Format for at least a version:
- * VERSION
- *
- * @param vr Input string.
- */
- VersionRange(const QString& vr);
- /**
- * Construct the default VersionRange object.
- *
- */
- VersionRange();
- ~VersionRange();
- bool isSpecified() const;
- /**
- * Check if specified version is within our range.
- *
- * @param ver Version to compare to.
- * @return Return true if within range, otherwise false.
- */
- bool withinRange(const Version& ver) const;
- /**
- * Check if objects range is within another VersionRange.
- *
- * @param range VersionRange to compare to.
- * @return Return true if within range, otherwise false.
- */
- bool withinRange(const VersionRange& range) const;
- /**
- * Compare object to another VersionRange. VersionRanges are compared on the
- * lower bound.
- *
- * @param obj VersionRange to compare to.
- * @return Return 0 if equals, negative if this object is less than obj
- * and positive if this object is larger then obj.
- * @exception ClassCastException if object is not a VersionRange object.
- */
- int compare(const VersionRange& obj) const;
- /**
- * String with version number. If version is not specified return
- * an empty string.
- *
- * @return QString.
- */
- QString toString() const;
- /**
- * Check if object is equal to this object.
- *
- * @param obj Package entry to compare to.
- * @return true if equal, otherwise false.
- */
- bool operator==(const VersionRange& r) const;
- };
- }
- #endif // CTKVERSIONRANGE_H
|