Treelite
Classes | Functions
format_util.h File Reference

Formatting utilities. More...

#include <fmt/format.h>
#include <limits>
#include <string>
#include <sstream>
#include <iomanip>
Include dependency graph for format_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ArrayFormatter
 format array as text, wrapped to a given maximum text width. Uses high precision to render floating-point values. More...
 

Functions

std::string IndentMultiLineString (const std::string &str, size_t indent=2)
 apply indentation to a multi-line string by inserting spaces at the beginning of each line More...
 
template<typename T >
std::string ToStringHighPrecision (T value)
 obtain a string representation of floating-point value, expressed in high precision More...
 

Detailed Description

Formatting utilities.

Copyright (c) by 2020 Contributors

Author
Hyunsu Cho

Definition in file format_util.h.

Function Documentation

◆ IndentMultiLineString()

std::string treelite::compiler::common_util::IndentMultiLineString ( const std::string &  str,
size_t  indent = 2 
)
inline

apply indentation to a multi-line string by inserting spaces at the beginning of each line

Parameters
strmulti-line string
indentindent level to be applied (in number of spaces)
Returns
indented string

Definition at line 26 of file format_util.h.

◆ ToStringHighPrecision()

std::string treelite::compiler::common_util::ToStringHighPrecision ( value)
inline

obtain a string representation of floating-point value, expressed in high precision

Parameters
valuea value of primitive type
Returns
string representation

Definition at line 53 of file format_util.h.