slang/ast/SFormat.h file

SystemVerilog string formatting routines.

Namespaces

namespace slang
Root namespace.
namespace slang::ast
The SystemVerilog AST.
namespace slang::ast::SFormat
Utility methods for formatting strings using SystemVerilog formatting styles.

Classes

struct slang::ast::SFormat::FormatOptions
A collection of options that can be applied to the SFormat string formatting functions.

Functions

auto parse(std::string_view formatString, function_ref<void(std::string_view text)> onText, function_ref<void(char specifier, size_t offset, size_t len, const FormatOptions&options)> onArg, function_ref<void(DiagCode code, size_t offset, size_t len, std::optional<char> specifier)> onError) -> bool
Parse the given formatString and call the provided callbacks for each parsed portion.
void formatInt(std::string& result, const SVInt& value, LiteralBase base, const FormatOptions& options)
Format the given value into a string and append it to result according to the provided options.
void formatArg(std::string& result, const ConstantValue& arg, const Type& type, char specifier, const FormatOptions& options, bool isStringLiteral)
Format the given arg into a string and append it to result according to the provided options.