xtd 0.2.0
system

Definition

Contains system classes.

Collaboration diagram for system:

Modules

 collections
 collections definitions.
 
 diagnostics
 diagnostics definitions.
 
 io
 io definitions.
 
 media
 media definitions.
 
 net
 Network definitions.
 
 synthesis
 Contains classes for initializing and configuring a speech synthesis engine, for creating prompts, for generating speech, for responding to events, and for modifying voice characteristics.
 
 threading
 threading definitions.
 
 web
 web definitions.
 

Classes

class  xtd::bit_converter
 Converts base data types to an std::vector of bytes, and an std::vector of bytes to base data types. More...
 
class  xtd::box< type_t >
 Represents a boxed object. More...
 
class  xtd::box_char< type_t >
 Represents a boxed char object. More...
 
class  xtd::box_floating_point< type_t >
 Represents a boxed floating point object. More...
 
class  xtd::box_integer< type_t >
 Represents a boxed integer object. More...
 
class  xtd::console
 Represents the standard input, output, and error streams for console applications. More...
 
class  xtd::convert
 Represents API to convert base type code. More...
 
class  xtd::convert_pointer
 Represents API to convert pointers. More...
 
class  xtd::convert_string
 Represents API to convert string containers. More...
 
class  xtd::date_time
 Represents an instant in time, typically expressed as a date and time of day. More...
 
class  xtd::delegate< result_t(arguments_t...)>
 Represents a delegate, which is a data structure that refers to a static method or to a class instance && an instance method of that class. More...
 
class  xtd::enum_object< enum_t >
 Provides the base class for enumerations. More...
 
class  xtd::enum_object< std::nullptr_t >
 Provides the base class for enumerations. More...
 
struct  xtd::enum_register< enum_t >
 Provides the registration struct for enumerations. More...
 
struct  xtd::enum_set_attribute< enum_t >
 Provides the set attribute struct for enumerations. More...
 
class  xtd::environment
 The environment class. More...
 
struct  xtd::guid
 Represents a globally unique identifier (GUID). A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated. More...
 
class  xtd::math
 Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions. More...
 
class  xtd::object
 Supports all classes in the xtd class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the xtd. It is the root of the type hierarchy. More...
 
class  xtd::random
 Represents a pseudo-random number generator, a device that produces a sequence of numbers that meet certain statistical requirements for randomness. More...
 
class  xtd::translator
 Represents translator class. This class cannot be inherited. More...
 
class  xtd::uri
 Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI. More...
 
class  xtd::ustring
 Represents text as a sequence of UTF-8 code units. More...
 
class  xtd::version
 Represents the version number of an assembly, operating system, or the xtd. This class cannot be inherited. More...
 

Typedefs

using xtd::boolean_object = box< bool >
 Represent a boxed bool. More...
 
using xtd::byte_object = box_integer< xtd::byte >
 Represent a boxed byte. More...
 
using xtd::char16_object = box_char< char16 >
 Represent a boxed char16. More...
 
using xtd::char32_object = box_char< char32 >
 Represent a boxed char32. More...
 
using xtd::char8_object = box_char< char8 >
 Represent a boxed char8. More...
 
using xtd::char_object = box_char< char >
 Represent a boxed char. More...
 
using xtd::decimal_object = box_floating_point< decimal >
 Represent a boxed decimal. More...
 
using xtd::double_object = box_floating_point< double >
 Represent a boxed double. More...
 
using xtd::int16_object = box_integer< int16 >
 Represent a boxed int16. More...
 
using xtd::int32_object = box_integer< int32 >
 Represent a boxed int32. More...
 
using xtd::int64_object = box_integer< int64 >
 Represent a boxed int64. More...
 
using xtd::intptr_object = box_integer< intptr >
 Represent a boxed intptr. More...
 
using xtd::sbyte_object = box_integer< sbyte >
 Represent a boxed sbyte. More...
 
using xtd::single_object = box_floating_point< float >
 Represent a boxed single. More...
 
using xtd::size_object = box_integer< size_t >
 Represent a boxed size_t. More...
 
using xtd::uint16_object = box_integer< uint16 >
 Represent a boxed uint16. More...
 
using xtd::uint32_object = box_integer< uint32 >
 Represent a boxed uint32. More...
 
using xtd::uint64_object = box_integer< uint64 >
 Represent a boxed uint64. More...
 
using xtd::uintptr_object = box_integer< uintptr >
 Represent a boxed uintptr. More...
 
using xtd::wchar_object = box_char< wchar >
 Represent a boxed wchar. More...
 

Functions

template<typename type_t >
auto xtd::boxing (const type_t &value) noexcept
 Allows to box an object. More...
 
template<typename type_t , typename ... args_t>
box< type_t > xtd::boxing (args_t &&...args) noexcept
 Allows to box an object. More...
 
template<class type_t , class function_t >
void xtd::register_any_stringer (const function_t &func)
 Register an any stringer method for a specified type. More...
 
template<typename type_t >
type_t xtd::unboxing (const xtd::box< type_t > &value) noexcept
 Allows to unbox an object. More...
 
template<class type_t >
void xtd::unregister_any_stringer ()
 Unregister an any stringer method for a specified type. More...
 

Typedef Documentation

◆ boolean_object

using xtd::boolean_object = typedef box<bool>

#include <xtd.core/include/xtd/box.h>

Represent a boxed bool.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::boolean_object.
auto stringer = [](const object& value) {return value.to_string();};
bool unboxed_object = true;
boolean_object boxed_object = unboxed_bool;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = true;

◆ byte_object

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed byte.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::byte_object.
auto stringer = [](const object& value) {return value.to_string();};
xtd::byte unboxed_object = 42;
byte_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ char16_object

#include <xtd.core/include/xtd/box_char.h>

Represent a boxed char16.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::char16_object.
auto stringer = [](const object& value) {return value.to_string();};
char16 unboxed_object = u'a';
char16_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = a;

◆ char32_object

#include <xtd.core/include/xtd/box_char.h>

Represent a boxed char32.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::char32_object.
auto stringer = [](const object& value) {return value.to_string();};
char32 unboxed_object = U'a';
char32_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = a;

◆ char8_object

using xtd::char8_object = typedef box_char<char8>

#include <xtd.core/include/xtd/box_char.h>

Represent a boxed char8.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::char8_object.
auto stringer = [](const object& value) {return value.to_string();};
char8 unboxed_object = u8'a';
char8_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = a;

◆ char_object

using xtd::char_object = typedef box_char<char>

#include <xtd.core/include/xtd/box_char.h>

Represent a boxed char.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::char_object.
auto stringer = [](const object& value) {return value.to_string();};
char unboxed_object = 'a';
char_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = a;

◆ decimal_object

#include <xtd.core/include/xtd/box_floating_point.h>

Represent a boxed decimal.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::double_object.
auto stringer = [](const object& value) {return value.to_string();};
decimal unboxed_object = 3.14;
decimal_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 3.14;

◆ double_object

using xtd::double_object = typedef box_floating_point<double>

#include <xtd.core/include/xtd/box_floating_point.h>

Represent a boxed double.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::double_object.
auto stringer = [](const object& value) {return value.to_string();};
double unboxed_object = 3.14;
double_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 3.14;

◆ int16_object

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed int16.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::int16_object.
auto stringer = [](const object& value) {return value.to_string();};
int16 unboxed_object = 42;
int16_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ int32_object

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed int32.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::int32_object.
auto stringer = [](const object& value) {return value.to_string();};
int32 unboxed_object = 42;
int32_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ int64_object

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed int64.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::int64_object.
auto stringer = [](const object& value) {return value.to_string();};
int64 unboxed_object = 42;
int64_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ intptr_object

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed intptr.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::intptr_object.
auto stringer = [](const object& value) {return value.to_string();};
intptr unboxed_object = 42;
intptr_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ sbyte_object

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed sbyte.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::sbyte_object.
auto stringer = [](const object& value) {return value.to_string();};
sbyte unboxed_object = 42;
sbyte_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ single_object

using xtd::single_object = typedef box_floating_point<float>

#include <xtd.core/include/xtd/box_floating_point.h>

Represent a boxed single.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::single_object.
auto stringer = [](const object& value) {return value.to_string();};
float unboxed_object = 3.14f;
single_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 3.14;

◆ size_object

using xtd::size_object = typedef box_integer<size_t>

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed size_t.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::size_object.
auto stringer = [](const object& value) {return value.to_string();};
size_t unboxed_object = 42;
size_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ uint16_object

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed uint16.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::uint16_object.
auto stringer = [](const object& value) {return value.to_string();};
uint16 unboxed_object = 42;
uint16_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ uint32_object

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed uint32.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::uint32_object.
auto stringer = [](const object& value) {return value.to_string();};
uint32 unboxed_object = 42;
uint32_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ uint64_object

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed uint64.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::uint64_object.
auto stringer = [](const object& value) {return value.to_string();};
uint64 unboxed_object = 42;
uint64_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ uintptr_object

#include <xtd.core/include/xtd/box_integer.h>

Represent a boxed uintptr.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::uintptr_object.
auto stringer = [](const object& value) {return value.to_string();};
uintptr unboxed_object = 42;
uintptr_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ wchar_object

using xtd::wchar_object = typedef box_char<wchar>

#include <xtd.core/include/xtd/box_char.h>

Represent a boxed wchar.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to create and use xtd::wchar_object.
auto stringer = [](const object& value) {return value.to_string();};
wchar unboxed_object = L'a';
wchar_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = a;

Function Documentation

◆ boxing() [1/2]

template<typename type_t >
auto xtd::boxing ( const type_t &  value)
inlinenoexcept

#include <xtd.core/include/xtd/box.h>

Allows to box an object.

Parameters
valueValue used to initialize object.
Returns
Boxed object.
Remarks
The boxed object must implement operator == and operator < because a xtd::box implement xtd::icomparable and xtd::iequatable interfaces.
Namespace
xtd
Library
xtd.core
Examples:
boxed_info.cpp, and boxing.cpp.

◆ boxing() [2/2]

template<typename type_t , typename ... args_t>
box<type_t> xtd::boxing ( args_t &&...  args)
inlinenoexcept

#include <xtd.core/include/xtd/box.h>

Allows to box an object.

Parameters
...argsParams used to initialize object.
Returns
Boxed object.
Remarks
The boxed object must implement operator == and operator < because a xtd::box implement xtd::icomparable and xtd::iequatable interfaces.
Namespace
xtd
Library
xtd.core

◆ register_any_stringer()

template<class type_t , class function_t >
void xtd::register_any_stringer ( const function_t &  func)
inline

#include <xtd.core/include/xtd/any.h>

Register an any stringer method for a specified type.

Parameters
funcFunction to register any stringer for specified type.
Namespace
xtd
Library
xtd.core
Examples
Show how to register your own class.
#include <xtd/xtd>
using namespace std;
using namespace xtd;
class character {
public:
character(const ustring& name, const ustring& rank) noexcept : name_(name), rank_(rank) {}
const ustring& name() const noexcept {return name_;}
const ustring& rank() const noexcept {return rank_;}
ustring to_string() const noexcept {return name_ + " (" + rank_ + ")";}
private:
ustring name_;
ustring rank_;
};
auto main()->int {
any value = make_any<int>(42);
cout << ustring::format("{}", value) << endl;
value = make_any<ustring>("Star Trek: The Next Generation");
cout << ustring::format("{}", value) << endl;
value = make_any<character>("Jean-Luc Picard", "Captain");
cout << "Before register_any_stringer : " << ustring::format("{}", value) << endl;
register_any_stringer<character>([](auto value) {return value.to_string();});
cout << "After register_any_stringer : " << ustring::format("{}", value) << endl;
unregister_any_stringer<character>();
cout << "After unregister_any_stringer : " << ustring::format("{}", value) << endl;
}
// This code produces the following output :
//
// 42
// Star Trek: The Next Generation
// Before register_any_stringer : (unregistered)
// After register_any_stringer : Jean-Luc Picard (Captain)
// After unregister_any_stringer : (unregistered)

◆ unboxing()

template<typename type_t >
type_t xtd::unboxing ( const xtd::box< type_t > &  value)
inlinenoexcept

#include <xtd.core/include/xtd/box.h>

Allows to unbox an object.

Parameters
valueObject to box.
Returns
Unboxed object.
Namespace
xtd
Library
xtd.core

◆ unregister_any_stringer()

template<class type_t >
void xtd::unregister_any_stringer ( )
inline

#include <xtd.core/include/xtd/any.h>

Unregister an any stringer method for a specified type.

Namespace
xtd
Library
xtd.core
Examples
Show how to register your own class.
#include <xtd/xtd>
using namespace std;
using namespace xtd;
class character {
public:
character(const ustring& name, const ustring& rank) noexcept : name_(name), rank_(rank) {}
const ustring& name() const noexcept {return name_;}
const ustring& rank() const noexcept {return rank_;}
ustring to_string() const noexcept {return name_ + " (" + rank_ + ")";}
private:
ustring name_;
ustring rank_;
};
auto main()->int {
any value = make_any<int>(42);
cout << ustring::format("{}", value) << endl;
value = make_any<ustring>("Star Trek: The Next Generation");
cout << ustring::format("{}", value) << endl;
value = make_any<character>("Jean-Luc Picard", "Captain");
cout << "Before register_any_stringer : " << ustring::format("{}", value) << endl;
register_any_stringer<character>([](auto value) {return value.to_string();});
cout << "After register_any_stringer : " << ustring::format("{}", value) << endl;
unregister_any_stringer<character>();
cout << "After unregister_any_stringer : " << ustring::format("{}", value) << endl;
}
// This code produces the following output :
//
// 42
// Star Trek: The Next Generation
// Before register_any_stringer : (unregistered)
// After register_any_stringer : Jean-Luc Picard (Captain)
// After unregister_any_stringer : (unregistered)