30 std::string
str()
const;
44 throw std::runtime_error(
"PrettyPrinter is frozen");
48 if (has_content(value)) {
58 std::unique_ptr<std::stringstream> owned_stream;
61 bool isNewLine =
true;
69 static bool has_content(
const T& value) {
70 auto not_space = [](
char c) {
71 return !std::isspace(
static_cast<unsigned char>(c));
73 if constexpr (std::is_same_v<T, char>) {
74 return not_space(value);
75 }
else if constexpr (std::is_convertible_v<const T&, std::string_view>) {
76 std::string_view text(value);
77 return std::any_of(text.begin(), text.end(), not_space);
80 return !std::is_function_v<T>;
87 std::unique_ptr<types::IType> reference_;
96 std::unique_ptr<types::IType>
clone()
const override;
PrettyPrinter & operator<<(std::ostream &(*manip)(std::ostream &))
PrettyPrinter & operator<<(const T &value)
Definition utils.h:42
void setIndent(int indent)
PrettyPrinter(int indent=0, bool frozen=false)
int changeIndent(int delta)
PrettyPrinter(std::ostream &stream, int indent=0, bool frozen=false)
size_t content() const
Monotonic count of writes that emitted non-whitespace text; compare two readings to detect an empty r...
Definition utils.h:36
bool operator==(const types::IType &other) const override
Compares two types for equality.
virtual void replace_symbols(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
Replace symbolic expressions on this type.
Reference(types::StorageType storage_type, size_t alignment, const std::string &initializer, const types::IType &reference_)
virtual void replace_symbols(const symbolic::ExpressionMapping &replacements) override
bool is_symbol() const override
Checks if this type represents a symbolic/integer type.
const types::IType & reference_type() const
bool is_pointer_like() const override
Checks if this is a pointer or a structure behaves like a pointer.
Definition utils.h:104
std::unique_ptr< types::IType > clone() const override
Creates a deep copy of this type.
std::string print() const override
Returns a string representation of this type.
virtual types::TypeID type_id() const override
Returns the TypeID for runtime type identification.
types::PrimitiveType primitive_type() const override
Returns the primitive type for this type.
Reference(const types::IType &reference_)
Abstract base interface for all types in the sdfglib type system.
Definition type.h:625
StorageType storage_type() const
Gets the storage type (const version).
Definition type.h:651
std::string initializer() const
Gets the initializer expression.
Definition type.h:683
size_t alignment() const
Gets the alignment requirement in bytes.
Definition type.h:673
Represents the storage location and management characteristics of data.
Definition type.h:64
SymEngine::RCP< const SymEngine::Basic > Expression
Reference-counted pointer to a symbolic expression (SymEngine Basic).
Definition symbolic.h:83
SymEngine::map_basic_basic ExpressionMapping
Definition symbolic.h:109
Definition argument_registry.h:10
PrimitiveType
Enumeration of all primitive data types supported by sdfglib.
Definition type.h:35
TypeID
Enumeration of high-level type categories.
Definition type.h:607
Core type system definitions for sdfglib.