xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Modules | Classes | Typedefs | Functions
system

Definition

Contains system classes.

Modules

 collections
 collections definitions.
 
 diagnostics
 diagnostics definitions.
 
 io
 io definitions.
 
 media
 media definitions.
 
 net
 Network definitions.
 
 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_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::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::time_zone_info
 Represents any time zone in the world. More...
 
class  xtd::time_zone_info::adjustement_rule
 Provides information about a time zone adjustment, such as the transition to and from daylight saving time. More...
 
class  xtd::time_zone_info::transition_time
 Provides information about a specific time change, such as the change from daylight saving time to standard time or vice versa, in a particular time zone. 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< byte_t >
 Represent a boxed byte. More...
 
using xtd::char16_object = box_integer< char16_t >
 Represent a boxed char16. More...
 
using xtd::char32_object = box_integer< char32_t >
 Represent a boxed char32. More...
 
using xtd::char8_object = box_integer< char8_t >
 Represent a boxed char8. More...
 
using xtd::char_object = box_integer< char >
 Represent a boxed char. More...
 
using xtd::decimal_object = box_floating_point< decimal_t >
 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_t >
 Represent a boxed int16. More...
 
using xtd::int32_object = box_integer< int32_t >
 Represent a boxed int32. More...
 
using xtd::int64_object = box_integer< int64_t >
 Represent a boxed int64. More...
 
using xtd::intptr_object = box_integer< intptr_t >
 Represent a boxed intptr. More...
 
using xtd::sbyte_object = box_integer< sbyte_t >
 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_t >
 Represent a boxed uint16. More...
 
using xtd::uint32_object = box_integer< uint32_t >
 Represent a boxed uint32. More...
 
using xtd::uint64_object = box_integer< uint64_t >
 Represent a boxed uint64. More...
 
using xtd::uintptr_object = box_integer< uintptr_t >
 Represent a boxed uintptr. More...
 
using xtd::wchar_object = box_integer< wchar_t >
 Represent a boxed wchar. More...
 

Functions

template<typename type_t >
box< type_t > xtd::boxing (const type_t &value)
 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)
 Allows to unbox an object. 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

using xtd::byte_object = typedef box_integer<byte_t>

#include <xtd.core/include/xtd/box.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();};
byte_t unboxed_object = 42;
byte_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ char16_object

using xtd::char16_object = typedef box_integer<char16_t>

#include <xtd.core/include/xtd/box.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_t 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

using xtd::char32_object = typedef box_integer<char32_t>

#include <xtd.core/include/xtd/box.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_t 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_integer<char8_t>

#include <xtd.core/include/xtd/box.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_t 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_integer<char>

#include <xtd.core/include/xtd/box.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

using xtd::decimal_object = typedef box_floating_point<decimal_t>

#include <xtd.core/include/xtd/box.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.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

using xtd::int16_object = typedef box_integer<int16_t>

#include <xtd.core/include/xtd/box.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_t unboxed_object = 42;
int16_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ int32_object

using xtd::int32_object = typedef box_integer<int32_t>

#include <xtd.core/include/xtd/box.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_t unboxed_object = 42;
int32_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ int64_object

using xtd::int64_object = typedef box_integer<int64_t>

#include <xtd.core/include/xtd/box.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_t unboxed_object = 42;
int64_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ intptr_object

using xtd::intptr_object = typedef box_integer<intptr_t>

#include <xtd.core/include/xtd/box.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_t unboxed_object = 42;
intptr_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ sbyte_object

using xtd::sbyte_object = typedef box_integer<sbyte_t>

#include <xtd.core/include/xtd/box.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_t 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.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.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

using xtd::uint16_object = typedef box_integer<uint16_t>

#include <xtd.core/include/xtd/box.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_t unboxed_object = 42;
uint16_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ uint32_object

using xtd::uint32_object = typedef box_integer<uint32_t>

#include <xtd.core/include/xtd/box.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_t unboxed_object = 42;
uint32_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ uint64_object

using xtd::uint64_object = typedef box_integer<uint64_t>

#include <xtd.core/include/xtd/box.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_t unboxed_object = 42;
uint64_object boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 42;

◆ uintptr_object

using xtd::uintptr_object = typedef box_integer<uintptr_t>

#include <xtd.core/include/xtd/box.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_t 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_integer<wchar_t>

#include <xtd.core/include/xtd/box.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_t 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()

template<typename type_t >
box<type_t> xtd::boxing ( const type_t &  value)
inline

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

Allows to box an object.

Parameters
valueObject to box.
Returns
Boxed object.
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_;
};
int main() {
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 = character("Jean-Luc Picard", "Captain");
cout << ustring::format("{}", value) << endl;
register_any_stringer<character>([](character value) {return value.to_string();});
cout << ustring::format("{}", value) << endl;
}
// This code produces the following output :
//

◆ unboxing()

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

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

Allows to unbox an object.

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