Blender V5.0
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
8
9#include "BLI_cpp_type.hh"
10
11#include <sstream>
12
13namespace blender {
14
15std::string CPPType::to_string(const void *value) const
16{
17 std::stringstream ss;
18 this->print(value, ss);
19 return ss.str();
20}
21
22void CPPType::print_or_default(const void *value,
23 std::stringstream &ss,
25{
26 if (this->is_printable()) {
27 this->print(value, ss);
28 }
29 else {
30 ss << default_value;
31 }
32}
33
34} // namespace blender
bool is_printable() const
std::string to_string(const void *value) const
Definition cpp_type.cc:15
void print_or_default(const void *value, std::stringstream &ss, StringRef default_value) const
Definition cpp_type.cc:22
const void * default_value() const
void print(const void *value, std::stringstream &ss) const