...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::value_extractor — Generic attribute value extractor.
// In header: <boost/log/attributes/value_extraction.hpp> template<typename T, typename FallbackPolicyT, typename TagT> class value_extractor : private FallbackPolicyT { public: // types typedef FallbackPolicyT fallback_policy; // Fallback policy. typedef T value_type; // Attribute value types. typedef value_ref< value_type, TagT > result_type; // Function object result type. // public member functions value_extractor() = default; value_extractor(value_extractor const &); template<typename U> explicit value_extractor(U const &); result_type operator()(attribute_value const &) const; result_type operator()(attribute_name const &, attribute_value_set const &) const; result_type operator()(attribute_name const &, record const &) const; result_type operator()(attribute_name const &, record_view const &) const; fallback_policy const & get_fallback_policy() const; };
Attribute value extractor is a functional object that attempts to find and extract the stored attribute value from the attribute values view or a log record. The extracted value is returned from the extractor.
value_extractor
public member functionsvalue_extractor() = default;
Default constructor
value_extractor(value_extractor const & that);
Copy constructor
template<typename U> explicit value_extractor(U const & arg);
Constructor
Parameters: |
|
result_type operator()(attribute_value const & attr) const;
Extraction operator. Attempts to acquire the stored value of one of the supported types. If extraction succeeds, the extracted value is returned.
Parameters: |
|
||
Returns: |
The extracted value, if extraction succeeded, an empty value otherwise. |
result_type operator()(attribute_name const & name, attribute_value_set const & attrs) const;
Extraction operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If extraction succeeds, the extracted value is returned.
Parameters: |
|
||||
Returns: |
The extracted value, if extraction succeeded, an empty value otherwise. |
result_type operator()(attribute_name const & name, record const & rec) const;
Extraction operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If extraction succeeds, the extracted value is returned.
Parameters: |
|
||||
Returns: |
The extracted value, if extraction succeeded, an empty value otherwise. |
result_type operator()(attribute_name const & name, record_view const & rec) const;
Extraction operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If extraction succeeds, the extracted value is returned.
Parameters: |
|
||||
Returns: |
The extracted value, if extraction succeeded, an empty value otherwise. |
fallback_policy const & get_fallback_policy() const;
Returns: |
Fallback policy |