Blender V4.3
cpp_type.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "BLI_cpp_type.hh"
6
7#include <sstream>
8
9namespace blender {
10
11std::string CPPType::to_string(const void *value) const
12{
13 std::stringstream ss;
14 this->print(value, ss);
15 return ss.str();
16}
17
18void CPPType::print_or_default(const void *value,
19 std::stringstream &ss,
20 StringRef default_value) const
21{
22 if (this->is_printable()) {
23 this->print(value, ss);
24 }
25 else {
26 ss << default_value;
27 }
28}
29
30} // namespace blender
bool is_printable() const
std::string to_string(const void *value) const
Definition cpp_type.cc:11
void print_or_default(const void *value, std::stringstream &ss, StringRef default_value) const
Definition cpp_type.cc:18
const void * default_value() const
void print(const void *value, std::stringstream &ss) const