olp-cpp-sdk  1.22.0
Public Member Functions | Public Attributes | List of all members
olp::logging::MessageFormatter::Element Struct Reference

An element to print out in the final formatted message. More...

#include <MessageFormatter.h>

Public Member Functions

 Element (ElementType type_)
 Creates an Element instance with the element type. More...
 
 Element (ElementType type_, std::string format_, int limit_=0)
 Creates an Element instance with all of the members. More...
 
 Element (const Element &)=default
 The default copy constructor.
 
Elementoperator= (const Element &)=default
 The default copy operator.
 
 Element (Element &&other) noexcept
 The move operator overload.
 
Elementoperator= (Element &&other) noexcept
 The move assignment operator overload.
 
bool operator== (const Element &other) const
 Checks whether the values of two Element instances are the same. More...
 
bool operator!= (const Element &other) const
 Checks whether the values of two Element instances are not the same. More...
 

Public Attributes

ElementType type
 The type of element to print.
 
std::string format
 The format for printing out the element. More...
 
int limit
 The number of characters to limit string types before passing to the formatter. More...
 

Detailed Description

An element to print out in the final formatted message.

Constructor & Destructor Documentation

◆ Element() [1/2]

olp::logging::MessageFormatter::Element::Element ( ElementType  type_)
explicit

Creates an Element instance with the element type.

The format string is set automatically based on the type.

Parameters
type_The element type.

◆ Element() [2/2]

olp::logging::MessageFormatter::Element::Element ( ElementType  type_,
std::string  format_,
int  limit_ = 0 
)
inline

Creates an Element instance with all of the members.

Parameters
type_The element type.
format_The format string. It is a literal when type_ is ElementType::String.
limit_The number of characters to limit string types before passing to the formatter. A negative number cuts off from the beginning of the string. A positive number cuts off from the end of the string. A value of zero leaves the input string untouched.

Member Function Documentation

◆ operator!=()

bool olp::logging::MessageFormatter::Element::operator!= ( const Element other) const
inline

Checks whether the values of two Element instances are not the same.

Parameters
otherThe other Element instance.
Returns
True if the values are not the same; false otherwise.

◆ operator==()

bool olp::logging::MessageFormatter::Element::operator== ( const Element other) const
inline

Checks whether the values of two Element instances are the same.

Parameters
otherThe other Element instance.
Returns
True if the values are the same; false otherwise.

Member Data Documentation

◆ format

std::string olp::logging::MessageFormatter::Element::format

The format for printing out the element.

It is used as a literal for ElementType::String without passing through printf.

◆ limit

int olp::logging::MessageFormatter::Element::limit

The number of characters to limit string types before passing to the formatter.

A negative number cuts off from the beginning of a string. A positive number cuts off from the end of the string. A value of zero leaves the input string untouched.


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