-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
M. Fatih Cırıt
committed
Jul 14, 2023
1 parent
cef89cf
commit 517ee08
Showing
3 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2023 The Autoware Foundation | ||
// | ||
// 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. | ||
|
||
#include "include/parse_version.hpp" | ||
|
||
#include "include/version_types.hpp" | ||
|
||
#include <yaml-cpp/yaml.h> | ||
|
||
#include <filesystem> | ||
|
||
namespace autoware_version_manager | ||
{ | ||
namespace parse_version | ||
{ | ||
|
||
VersionAutoware parse_autoware_version(const YAML::Node & yaml_node) | ||
{ | ||
VersionAutoware version; | ||
version.year = yaml_node["year"].as<int>(); | ||
version.minor = yaml_node["minor"].as<int>(); | ||
version.micro = yaml_node["micro"].as<int>(); | ||
return version; | ||
} | ||
|
||
VersionAutoware parse_autoware_version(const std::filesystem::path & path) | ||
{ | ||
YAML::Node yaml_node = YAML::LoadFile(path.string()); | ||
return parse_autoware_version(yaml_node); | ||
} | ||
|
||
VersionInterface parse_interface_version(const YAML::Node & yaml_node) | ||
{ | ||
VersionInterface version; | ||
version.major = yaml_node["major"].as<int>(); | ||
version.minor = yaml_node["minor"].as<int>(); | ||
version.patch = yaml_node["patch"].as<int>(); | ||
return version; | ||
} | ||
|
||
VersionInterface parse_interface_version(const std::filesystem::path & path) | ||
{ | ||
YAML::Node yaml_node = YAML::LoadFile(path.string()); | ||
return parse_interface_version(yaml_node); | ||
} | ||
|
||
} // namespace parse_version | ||
} // namespace autoware_version_manager |