|
LibSWOC++ 1.5.14
Solid Wall of C++
|
#include <bwf_base.h>


Classes | |
| class | Binding |
Specialized binding for names in an instance of ContextNames. More... | |
Public Types | |
| using | context_type = T |
| using | Generator = typename super_type::Generator |
| Functional type for a generator. | |
| using | ExternalGenerator = std::function<ExternalGeneratorSignature> |
| Signature for an external (context-free) generator. | |
Public Types inherited from swoc::bwf::NameMap< BufferWriter &(BufferWriter &, const Spec &, T &)> | |
| using | Generator |
| Signature for generators. | |
Public Member Functions | |
| self_type & | assign (std::string_view const &name, const ExternalGenerator &bg) |
| self_type & | assign (std::string_view const &name, Generator const &generator) |
| Binding | bind (context_type &context) |
Public Member Functions inherited from swoc::bwf::NameMap< BufferWriter &(BufferWriter &, const Spec &, T &)> | |
| NameMap () | |
| Construct an empty container. | |
| NameMap (std::initializer_list< std::tuple< std::string_view, Generator const & > > list) | |
| Construct and assign the names and generators in list. | |
| self_type & | assign (std::string_view const &name, Generator const &generator) |
| bool | contains (std::string_view name) |
| NameMap () | |
| Construct an empty container. | |
| NameMap (std::initializer_list< std::tuple< std::string_view, Generator const & > > list) | |
| Construct and assign the names and generators in list. | |
| self_type & | assign (std::string_view const &name, Generator const &generator) |
| bool | contains (std::string_view name) |
Protected Member Functions | |
| virtual BufferWriter & | operator() (BufferWriter &w, const Spec &spec, context_type &ctx) const |
Protected Member Functions inherited from swoc::bwf::NameMap< BufferWriter &(BufferWriter &, const Spec &, T &)> | |
| std::string_view | localize (std::string_view const &name) |
| Copy name in to local storage and return a view of it. | |
| std::string_view | localize (std::string_view const &name) |
| Copy name in to local storage and return a view of it. | |
Additional Inherited Members | |
Protected Types inherited from swoc::bwf::NameMap< BufferWriter &(BufferWriter &, const Spec &, T &)> | |
| using | Map |
Protected Attributes inherited from swoc::bwf::NameMap< BufferWriter &(BufferWriter &, const Spec &, T &)> | |
| Map | _map |
| Name to name generator. | |
| MemArena | _arena |
| Local name storage. | |
| Map | _map |
| Name to name generator. | |
| MemArena | _arena |
| Local name storage. | |
Associate names with context dependent generators.
| T | The context type. This is used directly. If the context needs to be const then this parameter should make that explicit, e.g. ContextNames<const Context>. This parameter is accessible via the context_type alias. |
This provides a name binding that also has a local context, provided at the formatting call site. The functors have access to this context and are presumed to use it to generate output. This binding can also contain external generators which do not get access to the context to make it convenient to add external generators as well as context generators.
A context functor should have the signature
context will be the context for the binding passed to the formatter.
This is used by the formatting logic by calling the bind method with a context object.
Definition at line 382 of file bwf_base.h.
| using swoc::bwf::ContextNames< T >::context_type = T |
Export for external convenience.
Definition at line 389 of file bwf_base.h.
| using swoc::bwf::ContextNames< T >::ExternalGenerator = std::function<ExternalGeneratorSignature> |
Signature for an external (context-free) generator.
Definition at line 393 of file bwf_base.h.
| using swoc::bwf::ContextNames< T >::Generator = typename super_type::Generator |
Functional type for a generator.
Definition at line 391 of file bwf_base.h.
| auto swoc::bwf::ContextNames< T >::assign | ( | std::string_view const & | name, |
| const ExternalGenerator & | bg ) |
Assign the external generator bg to name.
This is used for generators in the namespace that do not use the context.
| name | Name associated with the generator. |
| bg | An external generator that requires no context. |
*this Definition at line 623 of file bwf_base.h.
| auto swoc::bwf::ContextNames< T >::assign | ( | std::string_view const & | name, |
| Generator const & | generator ) |
Assign the generator to the name.
| name | Name associated with the generator. |
| generator | The generator function. |
Definition at line 631 of file bwf_base.h.
|
inline |
Bind the name map to a specific context.
| context | The instance of T to use in the generators. |
BoundNames.This is used when passing the context name map to the formatter.
Definition at line 558 of file bwf_base.h.
|
protectedvirtual |
Generate output based on the name in spec.
| w | Output. |
| spec | Format specifier for output. |
| ctx | The context object. |
This is called from the formatting logic to generate output for a named specifier. Subclasses that need to handle name dispatch differently should override this method. This method performs a name lookup in the local nameset.
Definition at line 564 of file bwf_base.h.