1 /** 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 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 16 #include "json_object_matcher.h" 17 18 namespace ark { 19 operator <<(std::ostream & os,const JsonObject::Value & value)20std::ostream &operator<<(std::ostream &os, const JsonObject::Value &value) 21 { 22 if (auto *string = value.Get<JsonObject::StringT>()) { 23 return os << std::quoted(*string); 24 } 25 if (auto *number = value.Get<JsonObject::NumT>()) { 26 return os << *number; 27 } 28 if (auto *boolean = value.Get<JsonObject::BoolT>()) { 29 return os << std::boolalpha << *boolean; 30 } 31 if (auto *array = value.Get<JsonObject::ArrayT>()) { 32 return os << *array; 33 } 34 if (auto *object = value.Get<JsonObject::JsonObjPointer>()) { 35 if (*object) { 36 return os << **object; 37 } 38 return os << "null"; 39 } 40 41 UNREACHABLE(); 42 } 43 44 } // namespace ark 45