xtd 0.2.0
xtd::diagnostics::trace_listener_collection Class Reference

Definition

Represents a collection of xtd::diagnostics::trace_listener.

class core_export_ trace_listener_collection : public std::vector<std::shared_ptr<xtd::diagnostics::trace_listener>>
Inheritance
std::vector<std::shared_ptr<xtd::diagnostics::trace_listener>> → xtd::diagnostics::trace_listener_collection
Header
#include <xtd/diagnostics/trace_listener_collection>
Namespace
xtd::diagnostics
Library
xtd.core

Alias

using base = std::vector< value_type >
 Represents the base type of the collection. More...
 

Constructors

 trace_listener_collection (const allocator_type &allocator=allocator_type())
 Creates a new object xtd::diagnostics::trace_listener_collection with specified allocator (optional). More...
 
 trace_listener_collection (const std::initializer_list< value_type > &il)
 Creates a new object xtd::diagnostics::trace_listener_collection with specified initializer list. More...
 
bool equals (const trace_listener_collection &value) const noexcept override
 

Operators

const_reference operator[] (const xtd::ustring &name) const
 Gets the first xtd::diagnostics::trace_listener in the list with the specified name. More...
 
reference operator[] (const xtd::ustring &name)
 Gets the first xtd::diagnostics::trace_listener in the list with the specified name. More...
 

Additional Inherited Members

- Public Member Functions inherited from xtd::iequatable< trace_listener_collection >
virtual bool equals (const trace_listener_collection &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type. More...
 

Member Typedef Documentation

◆ base

using xtd::diagnostics::trace_listener_collection::base = std::vector<value_type>

Represents the base type of the collection.

Constructor & Destructor Documentation

◆ trace_listener_collection() [1/2]

xtd::diagnostics::trace_listener_collection::trace_listener_collection ( const allocator_type &  allocator = allocator_type())
explicit

Creates a new object xtd::diagnostics::trace_listener_collection with specified allocator (optional).

Parameters
allocatorThe allocator associate to the collection (optional).
Remarks
If allocator not specified, the std::allocator<value_type> is used.

◆ trace_listener_collection() [2/2]

xtd::diagnostics::trace_listener_collection::trace_listener_collection ( const std::initializer_list< value_type > &  il)

Creates a new object xtd::diagnostics::trace_listener_collection with specified initializer list.

Parameters
ilThe initializer list that contains xtd::diagnostics::trace_listener items to fill the collection.

Member Function Documentation

◆ operator[]() [1/2]

const_reference xtd::diagnostics::trace_listener_collection::operator[] ( const xtd::ustring name) const

Gets the first xtd::diagnostics::trace_listener in the list with the specified name.

Parameters
nameThe name of the xtd::diagnostics::trace_listener to get from the list.
Returns
The first xtd::diagnostics::trace_listener in the list with the given Name. This item returns empty if no xtd::diagnostics::trace_listener with the given name can be found.
Remarks
The operator [] property is case-sensitive when searching for names. That is, if two listeners exist with the names "Lname" and "lname", operator [] property will find only the xtd::diagnostics::trace_listener with the xtd::diagnostics::trace_listener::name() that you specify, not both.
Examples
This example shows how to write "User message" text on the default trace listener of debug with name operator:
#include <xtd/xtd>
auto main()->int {
debug::listeners()["default"]->write_line("User message");
}

◆ operator[]() [2/2]

reference xtd::diagnostics::trace_listener_collection::operator[] ( const xtd::ustring name)

Gets the first xtd::diagnostics::trace_listener in the list with the specified name.

Parameters
nameThe name of the xtd::diagnostics::trace_listener to get from the list.
Returns
The first xtd::diagnostics::trace_listener in the list with the given Name. This item returns empty if no xtd::diagnostics::trace_listener with the given name can be found.
Remarks
The operator [] property is case-sensitive when searching for names. That is, if two listeners exist with the names "Lname" and "lname", operator [] property will find only the xtd::diagnostics::trace_listener with the xtd::diagnostics::trace_listener::name() that you specify, not both.
Examples
This example shows how to write "User message" text on the default trace listener of debug with name operator:
#include <xtd/xtd>
auto main()->int {
debug::listeners()["default"]->write_line("User message");
}

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