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.
Loading...
Searching...
No Matches
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

Inherits std::vector< std::shared_ptr< xtd::diagnostics::trace_listener > >.

Public Types

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

Public Member Functions

 trace_listener_collection (const allocator_type &allocator=allocator_type())
 Creates a new object xtd::diagnostics::trace_listener_collection with specified allocator (optional).
 
 trace_listener_collection (const std::initializer_list< value_type > &il)
 Creates a new object xtd::diagnostics::trace_listener_collection with specified initializer list.
 
reference operator[] (const xtd::ustring &name)
 Gets the first xtd::diagnostics::trace_listener in the list with the specified name.
 
const_reference operator[] (const xtd::ustring &name) const
 Gets the first xtd::diagnostics::trace_listener in the list with the specified name.
 

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]

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>
int main() {
debug::listeners()["default"]->write_line("User message");
}
static listener_collection & listeners()
Gets the collection of listeners that is monitoring the trace output.
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition: assert_dialog_result.h:10

◆ operator[]() [2/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>
int main() {
debug::listeners()["default"]->write_line("User message");
}

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