String  2.0
A feature-rich modern C++ string class.
String::Format Struct Reference

Specifies the formatting of a String::format operation. More...

#include <String.h>

Public Types

enum  Align : bool { Left, Right }
 
enum  Base { Oct = 8, Dec = 10, Hex = 16 }
 

Public Attributes

int precision { 6 }
 The precision (i.e. how many digits are generated) of floating point numbers output with this format. See std::ios::precision. More...
 
Base base { Base::Dec }
 The base used to display integer types. See std::ios::base. More...
 
Align alignment { Align::Left }
 Alignment used with width. See std::ios::left and std::ios::right. More...
 
int width { 0 }
 Width used on some format operations. See std::ios::width. More...
 
char fill { ' ' }
 Filler used to fill whitespace in width formats. See std::ios::fill. More...
 

Friends

std::ostream & operator<< (std::ostream &, const Format &)
 

Detailed Description

Specifies the formatting of a String::format operation.

Example

String::Format fmt;
fmt.precision = 3;
String my_string = String::format(fmt, 2.1337);

will result in

my_string = "2.13"

Member Enumeration Documentation

◆ Align

enum String::Format::Align : bool
Enumerator
Left 
Right 

◆ Base

Enumerator
Oct 
Dec 
Hex 

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Format fmt 
)
friend

Member Data Documentation

◆ alignment

Align String::Format::alignment { Align::Left }

Alignment used with width. See std::ios::left and std::ios::right.

◆ base

Base String::Format::base { Base::Dec }

The base used to display integer types. See std::ios::base.

◆ fill

char String::Format::fill { ' ' }

Filler used to fill whitespace in width formats. See std::ios::fill.

◆ precision

int String::Format::precision { 6 }

The precision (i.e. how many digits are generated) of floating point numbers output with this format. See std::ios::precision.

◆ width

int String::Format::width { 0 }

Width used on some format operations. See std::ios::width.


The documentation for this struct was generated from the following file: