1 /* 2 * Copyright (C) 2019 The Android Open Source Project 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 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #pragma once 17 18 #include <string> 19 #include <utility> 20 #include <vector> 21 22 #include "linkerconfig/configwriter.h" 23 #include "linkerconfig/section.h" 24 25 namespace android { 26 namespace linkerconfig { 27 namespace modules { 28 using DirToSection = std::pair<std::string, std::string>; 29 30 class Configuration { 31 public: Configuration(std::vector<Section> sections,std::vector<DirToSection> dir_to_sections)32 explicit Configuration(std::vector<Section> sections, 33 std::vector<DirToSection> dir_to_sections) 34 : sections_(std::move(sections)), 35 dir_to_section_list_(std::move(dir_to_sections)) { 36 } 37 Configuration(const Configuration&) = delete; 38 Configuration(Configuration&&) = default; 39 40 void WriteConfig(ConfigWriter& writer); 41 42 // For test usage 43 Section* GetSection(const std::string& name); 44 45 private: 46 std::vector<Section> sections_; 47 std::vector<DirToSection> dir_to_section_list_; 48 }; 49 } // namespace modules 50 } // namespace linkerconfig 51 } // namespace android