parameter_path.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
17 
18 
19 namespace Aws {
20 namespace Client {
21 
22 std::string ParameterPath::get_resolved_path(char node_namespace_separator,
23  char parameter_namespace_separator) const
24 {
25  std::string resolved_path = get_node_path(node_namespace_separator);
26  if (!resolved_path.empty()) {
27  resolved_path += node_namespace_separator;
28  }
29  resolved_path += get_local_path(parameter_namespace_separator);
30  return resolved_path;
31 }
32 
33 std::string ParameterPath::get_node_path(char node_namespace_separator) const
34 {
35  std::string resolved_path;
36  /* Construct the node's path by the provided lists of keys */
37  for (const auto & node_namespace : node_namespaces_) {
38  resolved_path += node_namespace + node_namespace_separator;
39  }
40  if (!resolved_path.empty() && resolved_path.back() == node_namespace_separator) {
41  resolved_path.pop_back();
42  }
43  return resolved_path;
44 }
45 
46 std::string ParameterPath::get_local_path(char parameter_namespace_separator) const
47 {
48  std::string resolved_path;
49  /* Construct the parameter's path by the provided lists of keys */
50  for (const auto & parameter_path_key : parameter_path_keys_) {
51  resolved_path += parameter_path_key + parameter_namespace_separator;
52  }
53  if (!resolved_path.empty() && resolved_path.back() == parameter_namespace_separator) {
54  resolved_path.pop_back();
55  }
56  return resolved_path;
57 }
58 
59 const ParameterPath ParameterPath::operator+(const std::string & addend) const
60 {
62  result += addend;
63  return result;
64 }
65 
66 ParameterPath & ParameterPath::operator+=(const std::string & addend)
67 {
68  parameter_path_keys_.push_back(addend);
69  return *this;
70 }
71 
72 } // namespace Client
73 } // namespace Aws
ParameterPath & operator+=(const std::string &addend)
const ParameterPath operator+(const std::string &addend) const
std::string get_local_path(char parameter_namespace_separator) const
std::string get_resolved_path(char node_namespace_separator, char parameter_namespace_separator) const
std::vector< std::string > node_namespaces_
std::string get_node_path(char node_namespace_separator) const
std::vector< std::string > parameter_path_keys_


aws_common
Author(s): AWS RoboMaker
autogenerated on Sat Mar 6 2021 03:11:38