xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Public Types | Public Member Functions | List of all members
xtd::diagnostics::trace_listener_collection Class Reference

#include <trace_listener_collection.h>

Definition

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

Namespace
xtd::diagnostics
Library
xtd.core

Public Types

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

Public Member Functions

 trace_listener_collection (const allocator_type &allocator=allocator_type())
 Creates a new object xtd::diagnostics::trace_listener_collection with specified alllocator (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...
 
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...
 

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 alllocator (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>
using xtdd::diagnostics;
int main() {
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>
using xtdd::diagnostics;
int main() {
debug::listeners()["default"]->write_line("User message");
}

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