• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2019 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "repr/json/converter.h"
16 
17 
18 namespace header_checker {
19 namespace repr {
20 
21 
22 const JsonArray json_empty_array;
23 const JsonObject json_empty_object;
24 const Json::Value json_0(0);
25 const Json::Value json_false(false);
26 const Json::Value json_empty_string("");
27 
28 
29 const AccessSpecifierIR default_access_ir = AccessSpecifierIR::PublicAccess;
30 
31 const RecordTypeIR::RecordKind default_record_kind_ir =
32     RecordTypeIR::RecordKind::struct_kind;
33 
34 const VTableComponentIR::Kind default_vtable_component_kind_ir =
35     VTableComponentIR::Kind::FunctionPointer;
36 
37 const ElfSymbolIR::ElfSymbolBinding default_elf_symbol_binding_ir =
38     ElfSymbolIR::ElfSymbolBinding::Global;
39 
40 
Set(const std::string & key,bool value)41 void JsonObject::Set(const std::string &key, bool value) {
42   SetOmissible(key, value, false);
43 }
44 
45 
Set(const std::string & key,uint64_t value)46 void JsonObject::Set(const std::string &key, uint64_t value) {
47   SetOmissible<Json::UInt64>(key, value, 0);
48 }
49 
50 
Set(const std::string & key,int64_t value)51 void JsonObject::Set(const std::string &key, int64_t value) {
52   SetOmissible<Json::Int64>(key, value, 0);
53 }
54 
55 
Set(const std::string & key,const std::string & value)56 void JsonObject::Set(const std::string &key, const std::string &value) {
57   SetOmissible<const std::string &>(key, value, "");
58 }
59 
60 
Set(const std::string & key,const JsonArray & value)61 void JsonObject::Set(const std::string &key, const JsonArray &value) {
62   SetOmissible(key, value, json_empty_array);
63 }
64 
65 
66 }  // namespace repr
67 }  // header_checker
68