• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2017 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 
17 #pragma once
18 
19 #include <string>
20 #include <vector>
21 
22 namespace android {
23 namespace properties {
24 
25 struct PropertyInfoEntry {
PropertyInfoEntryPropertyInfoEntry26   PropertyInfoEntry() {}
27   template <typename T, typename U, typename V>
PropertyInfoEntryPropertyInfoEntry28   PropertyInfoEntry(T&& name, U&& context, V&& type, bool exact_match)
29       : name(std::forward<T>(name)),
30         context(std::forward<U>(context)),
31         type(std::forward<V>(type)),
32         exact_match(exact_match) {}
33   std::string name;
34   std::string context;
35   std::string type;
36   bool exact_match;
37 };
38 
39 bool BuildTrie(const std::vector<PropertyInfoEntry>& property_info,
40                const std::string& default_context, const std::string& default_type,
41                std::string* serialized_trie, std::string* error);
42 
43 void ParsePropertyInfoFile(const std::string& file_contents, bool require_prefix_or_exact,
44                            std::vector<PropertyInfoEntry>* property_infos,
45                            std::vector<std::string>* errors);
46 
47 }  // namespace properties
48 }  // namespace android
49