src/model/Version.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "Version.hpp" | ||
| 7 | #include "Version_Impl.hpp" | ||
| 8 | |||
| 9 | #include "ParentObject.hpp" | ||
| 10 | |||
| 11 | #include <utilities/idd/OS_Version_FieldEnums.hxx> | ||
| 12 | #include <utilities/idd/IddEnums.hxx> | ||
| 13 | |||
| 14 | #include "../utilities/core/Assert.hpp" | ||
| 15 | |||
| 16 | #include <OpenStudio.hxx> | ||
| 17 | |||
| 18 | namespace openstudio { | ||
| 19 | namespace model { | ||
| 20 | |||
| 21 | namespace detail { | ||
| 22 | |||
| 23 | 5132 | Version_Impl::Version_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 24 |
4/6✓ Branch 1 taken 5132 times.
✓ Branch 4 taken 5132 times.
✓ Branch 7 taken 5132 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 5132 times.
✗ Branch 13 not taken.
|
5132 | OS_ASSERT(idfObject.iddObject().type() == Version::iddObjectType()); |
| 25 | 5132 | } | |
| 26 | |||
| 27 | 169 | Version_Impl::Version_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 28 | 169 | : ModelObject_Impl(other, model, keepHandle) { | |
| 29 |
4/6✓ Branch 1 taken 169 times.
✓ Branch 4 taken 169 times.
✓ Branch 7 taken 169 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 169 times.
✗ Branch 13 not taken.
|
169 | OS_ASSERT(other.iddObject().type() == Version::iddObjectType()); |
| 30 | 169 | } | |
| 31 | |||
| 32 | 10556 | Version_Impl::Version_Impl(const Version_Impl& other, Model_Impl* model, bool keepHandle) : ModelObject_Impl(other, model, keepHandle) {} | |
| 33 | |||
| 34 | ✗ | IddObjectType Version_Impl::iddObjectType() const { | |
| 35 | ✗ | return Version::iddObjectType(); | |
| 36 | } | ||
| 37 | |||
| 38 | 2 | std::string Version_Impl::versionIdentifier() const { | |
| 39 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | return getString(OS_VersionFields::VersionIdentifier).get(); |
| 40 | } | ||
| 41 | |||
| 42 | 4962 | bool Version_Impl::setVersionIdentifier(const std::string& s) { | |
| 43 | 4962 | return setString(OS_VersionFields::VersionIdentifier, s); | |
| 44 | ; | ||
| 45 | } | ||
| 46 | |||
| 47 | ✗ | boost::optional<std::string> Version_Impl::prereleaseIdentifier() const { | |
| 48 | ✗ | return getString(OS_VersionFields::PrereleaseIdentifier, false, true); | |
| 49 | } | ||
| 50 | |||
| 51 | 4962 | bool Version_Impl::setPrereleaseIdentifier(const std::string& s) { | |
| 52 | 4962 | return setString(OS_VersionFields::PrereleaseIdentifier, s); | |
| 53 | ; | ||
| 54 | } | ||
| 55 | |||
| 56 | // return the parent object in the hierarchy | ||
| 57 | ✗ | boost::optional<ParentObject> Version_Impl::parent() const { | |
| 58 | ✗ | boost::optional<ParentObject> result; | |
| 59 | ✗ | return result; | |
| 60 | } | ||
| 61 | |||
| 62 | ✗ | bool Version_Impl::setParent(ParentObject& /*newParent*/) { | |
| 63 | ✗ | return false; | |
| 64 | } | ||
| 65 | |||
| 66 | // Get all output variable names that could be associated with this object. | ||
| 67 | ✗ | const std::vector<std::string>& Version_Impl::outputVariableNames() const { | |
| 68 | ✗ | static const std::vector<std::string> result; | |
| 69 | ✗ | return result; | |
| 70 | } | ||
| 71 | |||
| 72 | } // namespace detail | ||
| 73 | |||
| 74 | 4962 | Version::Version(const Model& model) : ModelObject(iddObjectType(), model) { | |
| 75 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 4962 times.
✗ Branch 5 not taken.
|
4962 | OS_ASSERT(getImpl<detail::Version_Impl>()); |
| 76 |
2/2✓ Branch 1 taken 4962 times.
✓ Branch 4 taken 4962 times.
|
4962 | setVersionIdentifier(openStudioVersion()); |
| 77 | |||
| 78 |
1/1✓ Branch 1 taken 4962 times.
|
4962 | std::string preReleaseTag = openStudioVersionPrerelease(); |
| 79 |
1/2✓ Branch 1 taken 4962 times.
✗ Branch 2 not taken.
|
4962 | if (!preReleaseTag.empty()) { |
| 80 |
1/1✓ Branch 1 taken 4962 times.
|
4962 | setPrereleaseIdentifier(preReleaseTag); |
| 81 | } | ||
| 82 | 4962 | } | |
| 83 | |||
| 84 | // constructor | ||
| 85 |
1/1✓ Branch 3 taken 1955 times.
|
1955 | Version::Version(std::shared_ptr<detail::Version_Impl> impl) : ModelObject(std::move(impl)) {} |
| 86 | |||
| 87 | 2 | std::string Version::versionIdentifier() const { | |
| 88 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::Version_Impl>()->versionIdentifier(); |
| 89 | } | ||
| 90 | |||
| 91 | 4962 | bool Version::setVersionIdentifier(const std::string& s) { | |
| 92 |
1/1✓ Branch 3 taken 4962 times.
|
4962 | return getImpl<detail::Version_Impl>()->setVersionIdentifier(s); |
| 93 | } | ||
| 94 | |||
| 95 | ✗ | boost::optional<std::string> Version::prereleaseIdentifier() const { | |
| 96 | ✗ | return getImpl<detail::Version_Impl>()->prereleaseIdentifier(); | |
| 97 | } | ||
| 98 | |||
| 99 | 4962 | bool Version::setPrereleaseIdentifier(const std::string& s) { | |
| 100 |
1/1✓ Branch 3 taken 4962 times.
|
4962 | return getImpl<detail::Version_Impl>()->setPrereleaseIdentifier(s); |
| 101 | } | ||
| 102 | |||
| 103 | 23888 | IddObjectType Version::iddObjectType() { | |
| 104 |
1/1✓ Branch 1 taken 23888 times.
|
23888 | IddObjectType result(IddObjectType::OS_Version); |
| 105 | 23888 | return result; | |
| 106 | } | ||
| 107 | |||
| 108 | } // namespace model | ||
| 109 | } // namespace openstudio | ||
| 110 |