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

Extraction support for TextView. More...

#include <bwf_base.h>

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

Public Member Functions

 operator bool () const
 
bool operator() (std::string_view &literal_v, Spec &spec)
 

Static Public Member Functions

static bool parse (TextView &fmt, std::string_view &literal, std::string_view &specifier)
 

Public Attributes

TextView _fmt
 Format string.
 

Detailed Description

Extraction support for TextView.

Definition at line 155 of file bwf_base.h.

Member Function Documentation

◆ operator bool()

swoc::bwf::Format::TextViewExtractor::operator bool ( ) const
inlineexplicit
Returns
true if more format string, false if none.

Definition at line 536 of file bwf_base.h.

◆ operator()()

bool swoc::bwf::Format::TextViewExtractor::operator() ( std::string_view & literal_v,
Spec & spec )

Extract next formatting elements.

Parameters
literal_v[out] The next literal.
spec[out] The next format specifier.
Returns
true if spec was filled out, false if no specifier was found.

Definition at line 240 of file bw_format.cc.

◆ parse()

bool swoc::bwf::Format::TextViewExtractor::parse ( TextView & fmt,
std::string_view & literal,
std::string_view & specifier )
static

Parse elements of a format string.

Parameters
fmtThe format string [in|out]
literalA literal if found
specifierA specifier if found (less enclosing braces)
Returns
true if a specifier was found, false if not.

Pull off the next literal and/or specifier from fmt. The return value distinguishes the case of no specifier found (false) or an empty specifier (true).

Parse out the next literal and/or format specifier from the format string. Pass the results back in literal and specifier as appropriate. Update fmt to strip the parsed text.

Returns
true if a specifier was parsed, false if not.

Definition at line 195 of file bw_format.cc.

Member Data Documentation

◆ _fmt

TextView swoc::bwf::Format::TextViewExtractor::_fmt

Format string.

Definition at line 156 of file bwf_base.h.


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