/* * \copyright Copyright 2013 Google Inc. All Rights Reserved. * \license @{ * * 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. * * @} */ // Implementation of RFC 6570 based on (open source implementation) at // java/com/google/api/client/http/UriTemplate.java // The URI Template spec is at http://tools.ietf.org/html/rfc6570 // Templates up to level 3 are supported. #include "net/third_party/uri_template/uri_template.h" #include <set> #include <string> #include <vector> #include "base/strings/escape.h" #include "base/strings/string_split.h" string; namespace uri_template { namespace { // The UriTemplateConfig is used to represent variable sections and to construct // the expanded url. struct UriTemplateConfig { … }; // variable is an in-out argument. On input it is the content between the // '{}' in the source. On result the control parameters are stripped off // leaving just the comma-separated variable name(s) that we should try to // resolve. UriTemplateConfig MakeConfig(string* variable) { … } void ProcessVariableSection( string* variable_section, const std::unordered_map<string, string>& parameters, string* target, std::set<string>* vars_found) { … } } // namespace bool Expand(const string& path_uri, const std::unordered_map<string, string>& parameters, string* target, std::set<string>* vars_found) { … } } // namespace uri_template