1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef UTIL_JSON_JSON_VALUE_H_ 6 #define UTIL_JSON_JSON_VALUE_H_ 7 8 #include "absl/strings/string_view.h" 9 #include "absl/types/optional.h" 10 #include "json/value.h" 11 12 #define JSON_EXPAND_FIND_CONSTANT_ARGS(s) (s), ((s) + sizeof(s) - 1) 13 14 namespace openscreen { 15 16 absl::optional<int> MaybeGetInt(const Json::Value& message, 17 const char* first, 18 const char* last); 19 20 absl::optional<absl::string_view> MaybeGetString(const Json::Value& message); 21 22 absl::optional<absl::string_view> MaybeGetString(const Json::Value& message, 23 const char* first, 24 const char* last); 25 26 } // namespace openscreen 27 28 #endif // UTIL_JSON_JSON_VALUE_H_ 29