Serenity Operating System
at master 39 lines 1.1 kB view raw
1/* 2 * Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibPDF/Object.h> 8#include <LibPDF/Value.h> 9 10namespace PDF { 11 12DeprecatedString Value::to_deprecated_string(int indent) const 13{ 14 return visit( 15 [&](Empty const&) -> DeprecatedString { 16 // Return type deduction means that we can't use implicit conversions. 17 return "<empty>"; 18 }, 19 [&](nullptr_t const&) -> DeprecatedString { 20 return "null"; 21 }, 22 [&](bool const& b) -> DeprecatedString { 23 return b ? "true" : "false"; 24 }, 25 [&](int const& i) { 26 return DeprecatedString::number(i); 27 }, 28 [&](float const& f) { 29 return DeprecatedString::number(f); 30 }, 31 [&](Reference const& ref) { 32 return DeprecatedString::formatted("{} {} R", ref.as_ref_index(), ref.as_ref_generation_index()); 33 }, 34 [&](NonnullRefPtr<Object> const& object) { 35 return object->to_deprecated_string(indent); 36 }); 37} 38 39}