LibSWOC++ 1.5.14
Solid Wall of C++
Loading...
Searching...
No Matches
swoc::bwf::Format Struct Reference

#include <bwf_base.h>

Collaboration diagram for swoc::bwf::Format:
Collaboration graph

Classes

struct  FormatExtractor
 Extraction support for pre-parsed format strings. More...
 
struct  TextViewExtractor
 Extraction support for TextView. More...
 

Public Types

using self_type = Format
 Self reference type.
 
using Container = std::vector<Spec>
 
using iterator = Container::iterator
 
using const_iterator = Container::const_iterator
 

Public Member Functions

 Format ()=default
 Empty format.
 
 Format (TextView fmt)
 Construct from a format string fmt.
 
 Format (self_type &&that)=default
 Move constructor.
 
 Format (self_type const &)=delete
 No copy.
 
FormatExtractor bind () const
 Wrap the format instance in an extractor.
 
bool is_literal () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 

Static Public Member Functions

static TextViewExtractor bind (TextView fmt)
 Wrap the format string in an extractor.
 

Public Attributes

Container _items
 Items from format string.
 

Detailed Description

Format string support.

This contains the parsing logic for format strings and also serves as the type for pre-compiled format string.

When used by the print formatting logic, there is an abstraction layer, "extraction", which performs the equivalent of the parse method. This allows the formatting to treat pre-compiled or immediately parsed format strings the same. It also enables formatted print support for any parser that can deliver literals and Spec instances.

Definition at line 140 of file bwf_base.h.

Member Typedef Documentation

◆ const_iterator

using swoc::bwf::Format::const_iterator = Container::const_iterator

Definition at line 212 of file bwf_base.h.

◆ Container

using swoc::bwf::Format::Container = std::vector<Spec>

Definition at line 208 of file bwf_base.h.

◆ iterator

using swoc::bwf::Format::iterator = Container::iterator

Definition at line 211 of file bwf_base.h.

◆ self_type

Self reference type.

Definition at line 141 of file bwf_base.h.

Constructor & Destructor Documentation

◆ Format()

swoc::bwf::Format::Format ( TextView fmt)

Construct from a format string fmt.

Preparse format string for later use.

Definition at line 605 of file bw_format.cc.

Member Function Documentation

◆ begin() [1/2]

iterator swoc::bwf::Format::begin ( )
inline

Definition at line 215 of file bwf_base.h.

◆ begin() [2/2]

const_iterator swoc::bwf::Format::begin ( ) const
inline

Definition at line 223 of file bwf_base.h.

◆ bind() [1/2]

auto swoc::bwf::Format::bind ( ) const
inline

Wrap the format instance in an extractor.

Definition at line 532 of file bwf_base.h.

◆ bind() [2/2]

auto swoc::bwf::Format::bind ( swoc::TextView fmt)
inlinestatic

Wrap the format string in an extractor.

Definition at line 527 of file bwf_base.h.

◆ end() [1/2]

iterator swoc::bwf::Format::end ( )
inline

Definition at line 219 of file bwf_base.h.

◆ end() [2/2]

const_iterator swoc::bwf::Format::end ( ) const
inline

Definition at line 227 of file bwf_base.h.

◆ is_literal()

bool swoc::bwf::Format::is_literal ( ) const
Returns
true if all specifiers are literal.

Definition at line 635 of file bw_format.cc.

Member Data Documentation

◆ _items

Container swoc::bwf::Format::_items

Items from format string.

Definition at line 209 of file bwf_base.h.


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