xtd 0.2.0
Loading...
Searching...
No Matches
keywords

Definition

Keywords are predefined, reserved identifiers that have special meanings to the compiler.

Macros

#define abstract_
 This keyword is used to represents an abstract class.
 
#define abstract_object_
 This keyword is used to represents an abstract class.
 
#define add_csf_
 Add current stack frame to the VA_ARGS with a comma separator.
 
#define add_current_stack_frame_(...)
 Add current stack frame to the VA_ARGS with a comma separator.
 
#define assembly_company_(company)
 Sets the assembly company information. Must be called once in your application.
 
#define assembly_configuration_(configuration)
 Sets the assembly configuration information. Must be called once in your application.
 
#define assembly_copyright_(copyright)
 Sets the assembly copoyright information. Must be called once in your application.
 
#define assembly_culture_(culture)
 Sets the assembly culture information. Must be called once in your application.
 
#define assembly_description_(description)
 Sets the assembly description information. Must be called once in your application.
 
#define assembly_file_version_(version)
 Sets the assembly file version information. Must be called once in your application.
 
#define assembly_guid_(guid)
 Sets the assembly guid information. Must be called once in your application.
 
#define assembly_identifier_(identifier)
 Sets the assembly identifier information. Must be called once in your application.
 
#define assembly_name_(name)
 Sets the assembly name information. Must be called once in your application.
 
#define assembly_product_(product)
 Sets the assembly product information. Must be called once in your application.
 
#define assembly_title_(title)
 Sets the assembly title information. Must be called once in your application.
 
#define assembly_trademark_(trademark)
 Sets the assembly trademark information. Must be called once in your application.
 
#define assembly_version_(version)
 Sets the assembly version information. Must be called once in your application.
 
#define block_scope_(...)
 The specified expression is cleared automatically when the scope is ended.
 
#define call_once_
 The xtd keyword call_once_ can be used to execute a routine exactly once. This can be used to initialise data in a thread-safe way.
 
#define core_export_
 Define shared library export.
 
#define csf_
 Provides information about the current stack frame.
 
#define current_stack_frame_
 Provides information about the current stack frame.
 
#define drawing_export_
 Define shared library export.
 
#define enum_(namespace_name, enum_t, ...)
 Provides the registration struct for enum.
 
#define enum_class_(namespace_name, enum_class_t, ...)
 Provides the registration struct for enum class.
 
#define enum_class_ut_(namespace_name, enum_class_t, underlying_t, ...)
 Provides the registration struct for enum class with specified underlying type.
 
#define enum_struct_(namespace_name, enum_struct_t, ...)
 Provides the registration struct for enum struct.
 
#define enum_struct_ut_(namespace_name, enum_struct_t, underlying_t, ...)
 Provides the registration struct for enum with specified underlying type.
 
#define enum_ut_(namespace_name, enum_t, underlying_t, ...)
 Provides the registration struct for enum with specified underlying type.
 
#define export_
 Define shared library export.
 
#define flags_attribute_(namespace_name, enum_type)
 Provides the set attribute struct for enumerations helper.
 
#define forms_export_
 Define shared library export.
 
#define interface_
 This keyword is use to represent an interface.
 
#define lock_(object)
 The lock_ keyword marks a statement block as a critical section by obtaining the mutual-exclusion lock for a given object, executing a statement, and then releasing the lock. The following example includes a lock statement.
 
#define lock_guard_(object)
 The lock_guard_ keyword marks a statement block as a critical section by obtaining the mutual-exclusion lock for a given object, executing a statement, and then releasing the lock. The following example includes a lock statement.
 
#define nameof_(...)
 Used to obtain the simple (unqualified) string name of a variable, type, or member.
 
#define scope_exit_
 Nowadays, every C++ developer is familiar with the Resource Acquisition Is Initialization (RAII) technique. It binds resource acquisition and release to initialization and destruction of a variable that holds the resource. There are times when writing a special class for such a variable is not worth the effort. This is when xtd scope_exit_ comes into play.
 
#define self_
 The self_ expression is a reference value expression whose value is the reference of the implicit object parameter (the object on which the non-static member function (up to C++23) implicit object member function (since C++23) is called).
 
#define startup_(main_method)
 Defines the entry point to be called when the application loads. Generally this is set either to the main form in your application or to the main procedure that should run when the application starts.
 
#define startup_class_(main_class)
 Defines the entry point to be called when the application loads. Generally this is set either to the main form in your application or to the main procedure that should run when the application starts.
 
#define static_
 This keyword is use to represent a static object. A static object can't be instantiated (constructors are deleted).
 
#define static_object_
 This keyword is use to represent a static object. A static object can't be instantiated (constructors are deleted).
 
#define tunit_export_
 Define shared library export.
 
#define typeof_
 Used to obtain the type object of a specified type or object.
 
#define unused_
 It may be used to suppress the "unused variable" or "unused local typedefs" compiler warnings when the variable or typedef can't be removed or commented out, e.g. when some blocks of the code are conditionally activated.
 
#define using_(...)
 The specified expression is cleared automatically when the scope is ended.
 

Macro Definition Documentation

◆ abstract_

#define abstract_

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

This keyword is used to represents an abstract class.

Header
#include <xtd/abstract>
Library
xtd.core
Remarks
This keyword has no other use than to tag a class to abstract.
Examples
class foo abstract_ {
public:
virtual std::string to_string() = 0;
};
#define abstract_
This keyword is used to represents an abstract class.
Definition abstract.h:25
Examples
console_firework.cpp, and graph_control.cpp.

◆ abstract_object_

#define abstract_object_

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

This keyword is used to represents an abstract class.

Header
#include <xtd/abstract_object>
Library
xtd.core
Remarks
This keyword has no other use than to tag a class to abstract.
Examples
class foo abstract_object_ {
public:
virtual std::string to_string() = 0;
};
#define abstract_object_
This keyword is used to represents an abstract class.
Definition abstract_object.h:58

◆ add_csf_

#define add_csf_

#include <xtd.core/include/xtd/diagnostics/current_stack_frame.h>

Add current stack frame to the VA_ARGS with a comma separator.

Header
#include <xtd/diagnostics/stack_frame>
Library
xtd.core
Returns
VA_ARGS with comma and current stack frame.
Examples
Remarks
same as add_current_stack_frame_

◆ add_current_stack_frame_

#define add_current_stack_frame_ (   ...)

#include <xtd.core/include/xtd/diagnostics/current_stack_frame.h>

Add current stack frame to the VA_ARGS with a comma separator.

Header
#include <xtd/diagnostics/stack_frame>
Library
xtd.core
Returns
VA_ARGS with comma and current stack frame.
Examples
Remarks
same as add_csf_

◆ assembly_company_

#define assembly_company_ (   company)

#include <xtd.core/include/xtd/reflection/assembly_company_attribute.h>

Sets the assembly company information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_company_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
Represents a standard Windows label.
Definition label.h:38
Represents a standard Windows text box.
Definition text_box.h:31
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.h:110
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.h:175
@ text
The xtd::forms::status_bar_panel displays text in the standard font.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion
#define assembly_product_(product)
Sets the assembly product information. Must be called once in your application.
Definition assembly_product_attribute.h:74
#define assembly_title_(title)
Sets the assembly title information. Must be called once in your application.
Definition assembly_title_attribute.h:74
#define assembly_description_(description)
Sets the assembly description information. Must be called once in your application.
Definition assembly_description_attribute.h:78
#define assembly_culture_(culture)
Sets the assembly culture information. Must be called once in your application.
Definition assembly_culture_attribute.h:76
#define assembly_version_(version)
Sets the assembly version information. Must be called once in your application.
Definition assembly_version_attribute.h:79
#define assembly_guid_(guid)
Sets the assembly guid information. Must be called once in your application.
Definition assembly_guid_attribute.h:74
#define assembly_trademark_(trademark)
Sets the assembly trademark information. Must be called once in your application.
Definition assembly_trademark_attribute.h:72
#define assembly_company_(company)
Sets the assembly company information. Must be called once in your application.
Definition assembly_company_attribute.h:76
#define assembly_configuration_(configuration)
Sets the assembly configuration information. Must be called once in your application.
Definition assembly_configuration_attribute.h:76
#define assembly_copyright_(copyright)
Sets the assembly copoyright information. Must be called once in your application.
Definition assembly_copyright_attribute.h:76

◆ assembly_configuration_

#define assembly_configuration_ (   configuration)

#include <xtd.core/include/xtd/reflection/assembly_configuration_attribute.h>

Sets the assembly configuration information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_configuration_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_copyright_

#define assembly_copyright_ (   copyright)

#include <xtd.core/include/xtd/reflection/assembly_copyright_attribute.h>

Sets the assembly copoyright information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_copyright_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_culture_

#define assembly_culture_ (   culture)

#include <xtd.core/include/xtd/reflection/assembly_culture_attribute.h>

Sets the assembly culture information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_culture_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_description_

#define assembly_description_ (   description)

#include <xtd.core/include/xtd/reflection/assembly_description_attribute.h>

Sets the assembly description information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_description_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_file_version_

#define assembly_file_version_ (   version)

#include <xtd.core/include/xtd/reflection/assembly_file_version_attribute.h>

Sets the assembly file version information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_file_version_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_guid_

#define assembly_guid_ (   guid)

#include <xtd.core/include/xtd/reflection/assembly_guid_attribute.h>

Sets the assembly guid information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_guid_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_identifier_

#define assembly_identifier_ (   identifier)

#include <xtd.core/include/xtd/reflection/assembly_identifier_attribute.h>

Sets the assembly identifier information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_identifier_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_name_

#define assembly_name_ (   name)

#include <xtd.core/include/xtd/reflection/assembly_name_attribute.h>

Sets the assembly name information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_name_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_product_

#define assembly_product_ (   product)

#include <xtd.core/include/xtd/reflection/assembly_product_attribute.h>

Sets the assembly product information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_product_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_title_

#define assembly_title_ (   title)

#include <xtd.core/include/xtd/reflection/assembly_title_attribute.h>

Sets the assembly title information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_title_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_trademark_

#define assembly_trademark_ (   trademark)

#include <xtd.core/include/xtd/reflection/assembly_trademark_attribute.h>

Sets the assembly trademark information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_trademark_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ assembly_version_

#define assembly_version_ (   version)

#include <xtd.core/include/xtd/reflection/assembly_version_attribute.h>

Sets the assembly version information. Must be called once in your application.

Remarks
Use this keyword if you create create assembly informations manually.
Use CMake assembly macro if you want create assembly informations with CMake scripts.
Parameters
versionThe version information.
Header
#include <xtd/reflection/assembly_version_attribute>
Library
xtd.core
Examples
The following example shows how to use assembly information manually.
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/text_box>
#include <xtd/startup>
using namespace xtd::forms;
class form1 : public form {
public:
static auto main() {
application::run(form1 {});
}
form1() {
text("Form with manual assembly info");
controls().push_back_range({company, product, version, company_name, product_name, product_version});
client_size({350, 105});
company.auto_size(true);
company.text("Company name");
company.location({10, 10});
company.text_align(content_alignment::middle_left);
product.auto_size(true);
product.text("Product name");
product.location({10, 40});
product.text_align(content_alignment::middle_left);
version.auto_size(true);
version.text("Product version");
version.location({10, 70});
version.text_align(content_alignment::middle_left);
company_name.text(application::company_name());
company_name.read_only(true);
company_name.location({120, 10});
company_name.width(220);
product_name.text(application::product_name());
product_name.read_only(true);
product_name.location({120, 40});
product_name.width(220);
product_version.text(application::product_version());
product_version.read_only(true);
product_version.location({120, 70});
product_version.width(220);
}
private:
label company;
label product;
text_box company_name;
text_box product_name;
text_box product_version;
};
startup_(form1::main);
#pragma region xtd generated code
// This code was generated by CMake script.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// Remarks : If this file was manually created, you need re-run cmake generator after creating
// or modifying any parameter bellow.
#include <xtd/reflection/assembly_info>
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
assembly_title_("Forms with CMake assembly information");
assembly_description_("This example shows how to use xtd assembly informations");
assembly_company_("Gammasoft");
assembly_product_("form_with_cmake_assembly_info");
assembly_copyright_("Copyright © Gammasoft 2024");
// The following GUID is for the ID of the typelib if this project is exposed to COM
assembly_guid_("9b363484-3d19-40a5-b5ac-eeebd391163b");
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// In not specify or empty or "*" the cmake project version is used.
#pragma endregion

◆ block_scope_

#define block_scope_ (   ...)

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

The specified expression is cleared automatically when the scope is ended.

Header
#include <xtd/block_scope>
Namespace
xtd
Library
xtd.core
Examples
// values is released automatically after the end closure }.
block_scope_(auto values = {1, 2, 3, 4, 5}) {
cout << ustring::join(", ", values) << endl;
}
#define block_scope_(...)
The specified expression is cleared automatically when the scope is ended.
Definition block_scope.h:25
Remarks
same as using_
Examples
binary_reader.cpp, binary_reader2.cpp, block_scope.cpp, file_info.cpp, file_info_append_text.cpp, file_info_open.cpp, file_info_open_read.cpp, file_info_open_text.cpp, file_info_open_write.cpp, jthread.cpp, lock_guard.cpp, and process.cpp.

◆ call_once_

#define call_once_

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

The xtd keyword call_once_ can be used to execute a routine exactly once. This can be used to initialise data in a thread-safe way.

Namespace
xtd
Library
xtd.core
Remarks
See also xtd::call_once struct.
Examples
The following example shows how to use call_once_ keyword.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::threading;
auto main() -> int {
console::write_line("(main) begin");
auto mre = manual_reset_event {};
auto thread_proc = [&] {
static auto cpt = 0;
console::write_line(" (thread_proc) call once {} times", cpt + 1);
};
console::write_line(" (thread_proc) running {} times", ++cpt);
if (cpt == 3) mre.set();
};
thread_pool::register_wait_for_single_object(mre, thread_proc, {}, 100, false);
mre.wait_one();
thread::join_all();
console::write_line("(main) end");
}
// This code produces the following output:
//
// (main) begin
// (thread_proc) call once 1 times
// (thread_proc) running 1 times
// (thread_proc) running 2 times
// (thread_proc) running 3 times
// (main) end
Represents a thread synchronization event that, when signaled, must be reset manually....
Definition manual_reset_event.h:35
#define call_once_
The xtd keyword call_once_ can be used to execute a routine exactly once. This can be used to initial...
Definition call_once.h:50
The xtd::threading namespace provides classes and interfaces that enable multithreaded programming....
Definition abandoned_mutex_exception.h:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Examples
call_once.cpp.

◆ core_export_

#define core_export_

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

Define shared library export.

Warning
Internal use only

◆ csf_

#define csf_

#include <xtd.core/include/xtd/diagnostics/current_stack_frame.h>

Provides information about the current stack frame.

Header
#include <xtd/diagnostics/stack_frame>
Library
xtd.core
Returns
Informations about the current stack frame.
Examples
The following example shows how to use the csf_.
#include <xtd/diagnostics/stack_frame>
#include <xtd/console>
using namespace xtd;
void trace_message(const ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
console::write_line("stack_frame: {}\n", stack_frame);
console::write_line("Message: {}", message);
console::write_line("Method: {}", stack_frame.get_method());
console::write_line("File name: {}", stack_frame.get_file_name());
console::write_line("File line number: {}", stack_frame.get_file_line_number());
}
auto main() -> int {
trace_message("Something has happened.", csf_);
// trace_message("Something has happened.", csf_); is same as :
//
// trace_message("Something has happened.", {__FILE__, __LINE__, __func__});
}
// This code can produce the following output:
//
// stack_frame: /!---OMITTED---!/csf.cpp:15:0
//
// Message: Something happened.
// Method name: main
// File name: /!---OMITTED---!/csf.cpp
// File line number: 15
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:40
virtual uint32 get_file_line_number() const noexcept
Gets the line number in the file that contains the code that is executing. This information is typica...
virtual const xtd::ustring & get_file_name() const noexcept
Gets the file name that contains the code that is executing. This information is typically extracted ...
virtual const xtd::ustring & get_method() const noexcept
Gets the method in which the frame is executing.
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:52
#define csf_
Provides information about the current stack frame.
Definition current_stack_frame.h:30
Remarks
same as current_stack_frame_
Examples
assert_box.cpp, assert_dialog.cpp, barrier.cpp, csf.cpp, exception_ptr.cpp, line_info.cpp, lock.cpp, lock_guard_keyword.cpp, system_exception.cpp, and test_tunit.cpp.

◆ current_stack_frame_

#define current_stack_frame_

#include <xtd.core/include/xtd/diagnostics/current_stack_frame.h>

Provides information about the current stack frame.

Library
xtd.core
Returns
Informations about the current stack frame.
Examples
The following example shows how to use the current_stack_frame_.
#include <xtd/diagnostics/stack_frame>
#include <xtd/console>
using namespace xtd;
void trace_message(const ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
console::write_line("stack_frame: {}\n", stack_frame);
console::write_line("Message: {}", message);
console::write_line("Method: {}", stack_frame.get_method());
console::write_line("File name: {}", stack_frame.get_file_name());
console::write_line("File line number: {}", stack_frame.get_file_line_number());
}
auto main() -> int {
trace_message("Something has happened.", current_stack_frame_);
// trace_message("Something has happened.", current_stack_frame_); is same as :
//
// trace_message("Something has happened.", {__FILE__, __LINE__, __func__});
}
// This code can produce the following output:
//
// stack_frame: /!---OMITTED---!/current_stack_frame.cpp:15:0
//
// Message: Something happened.
// Method name: main
// File name: /!---OMITTED---!/current_stack_frame.cpp
// File line number: 15
#define current_stack_frame_
Provides information about the current stack frame.
Definition current_stack_frame.h:16
Remarks
same as csf_
Examples
application_and_exception.cpp, current_stack_frame.cpp, exception_box.cpp, exception_dialog.cpp, format_class_with_specified_formating.cpp, format_class_with_specified_formating_with_to_string.cpp, sprintf_class_with_specified_formating.cpp, and sprintf_class_with_specified_formating_with_to_string.cpp.

◆ drawing_export_

#define drawing_export_

#include <xtd.drawing/include/xtd/drawing_export.h>

Define shared library export.

Warning
Internal use only

◆ enum_

#define enum_ (   namespace_name,
  enum_t,
  ... 
)

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

Provides the registration struct for enum.

Header
#include <xtd/enum>
Library
xtd.core
Parameters
namespace_nameThe name of the the namespace. Empty if no namespace.
enum_typeThe name of the enum.
...The enumeration list.
Remarks
This helper is created to facilitate to set the xtd::enum_register with the enumeration identifiers.
Warning
The helper has one limitiation :
  • The enumeration's cannot be in a class or struct. The enum must be in the global namespace or in a namespace hierarchy. If the enumeration is in a class or struct, add operators manually and use xtd::enum_register to register the enumeration identifiers.
Examples
The following code show how to use enum_ helper.
#include <xtd/as>
#include <xtd/console>
#include <xtd/enum>
using namespace xtd;
enum_(, enum_test,
value_one,
value_two,
value_three,
value_four
);
auto main() -> int {
console::write_line("name = {}", enum_test::value_four);
console::write_line("value = {}", enum_object(enum_test::value_four).to_int32());
console::write_line("as<int> = {}", as<int>(enum_test::value_four));
console::write_line("values = {}", enum_object<>::get_values_as_int32<enum_test>());
console::write_line("names = {}", enum_object<>::get_names<enum_test>());
console::write_line("entries = {}", enum_object<>::get_entries_as_int32<enum_test>());
}
// This code produces the following output :
//
// name = value_four
// value = 3
// as<int> = 3
// values = [0, 1, 2, 3]
// names = [value_one, value_two, value_three, value_four]
// entries = [(0, value_one), (1, value_two), (2, value_three), (3, value_four)]
Provides the base class for enumerations.
Definition enum_object.h:41
#define enum_(namespace_name, enum_t,...)
Provides the registration struct for enum.
Definition enum.h:52
Examples
enum.cpp, and parse_enum.cpp.

◆ enum_class_

#define enum_class_ (   namespace_name,
  enum_class_t,
  ... 
)

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

Provides the registration struct for enum class.

Header
#include <xtd/enum>
Library
xtd.core
Parameters
namespace_nameThe name of the the namespace. Empty if no namespace.
enum_class_typeThe name of the enum class.
...The enumeration list.
Remarks
This helper is created to facilitate to set the xtd::enum_register with the enumeration identifiers.
Warning
The helper has one limitiation :
  • The enumeration's cannot be in a class or struct. The enum must be in the global namespace or in a namespace hierarchy. If the enumeration is in a class or struct, add operators manually and use xtd::enum_register to register the enumeration identifiers.
Examples
The following code show how to use enum_ helper.
#include <xtd/as>
#include <xtd/console>
#include <xtd/enum_class>
using namespace xtd;
enum_class_(, enum_test,
value_one,
value_two,
value_three,
value_four
);
auto main() -> int {
console::write_line("name = {}", enum_test::value_four);
console::write_line("value = {}", enum_object(enum_test::value_four).to_int32());
console::write_line("as<int> = {}", as<int>(enum_test::value_four));
console::write_line("values = {}", enum_object<>::get_values_as_int32<enum_test>());
console::write_line("names = {}", enum_object<>::get_names<enum_test>());
console::write_line("entries = {}", enum_object<>::get_entries_as_int32<enum_test>());
}
// This code produces the following output :
//
// name = value_four
// value = 3
// as<int> = 3
// values = [0, 1, 2, 3]
// names = [value_one, value_two, value_three, value_four]
// entries = [(0, value_one), (1, value_two), (2, value_three), (3, value_four)]
#define enum_class_(namespace_name, enum_class_t,...)
Provides the registration struct for enum class.
Definition enum_class.h:52
Examples
enum_class.cpp, enum_class_flags.cpp, enum_class_flags_introspection.cpp, enum_class_parse.cpp, and parse_enum_class.cpp.

◆ enum_class_ut_

#define enum_class_ut_ (   namespace_name,
  enum_class_t,
  underlying_t,
  ... 
)

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

Provides the registration struct for enum class with specified underlying type.

Header
#include <xtd/enum>
Library
xtd.core
Parameters
namespace_nameThe name of the the namespace. Empty if no namespace.
enum_class_typeThe name of the enum class.
underlying_typeThe underying type.
...The enumeration list.
Remarks
This helper is created to facilitate to set the xtd::enum_register with the enumeration identifiers.
Warning
The helper has one limitiation :
  • The enumeration's cannot be in a class or struct. The enum must be in the global namespace or in a namespace hierarchy. If the enumeration is in a class or struct, add operators manually and use xtd::enum_register to register the enumeration identifiers.
Examples
The following code show how to use enum_class_ut_ helper.
#include <xtd/as>
#include <xtd/console>
#include <xtd/enum_class>
using namespace xtd;
enum_class_ut_(, enum_test, byte,
value_one,
value_two,
value_three,
value_four
);
auto main() -> int {
console::write_line("name = {}", enum_test::value_four);
console::write_line("value = {}", enum_object(enum_test::value_four).to_int32());
console::write_line("as<int> = {}", as<int>(enum_test::value_four));
console::write_line("values = {}", enum_object<>::get_values_as_int32<enum_test>());
console::write_line("names = {}", enum_object<>::get_names<enum_test>());
console::write_line("entries = {}", enum_object<>::get_entries_as_int32<enum_test>());
}
// This code produces the following output :
//
// name = value_four
// value = 3
// as<int> = 3
// values = [0, 1, 2, 3]
// names = [value_one, value_two, value_three, value_four]
// entries = [(0, value_one), (1, value_two), (2, value_three), (3, value_four)]
#define enum_class_ut_(namespace_name, enum_class_t, underlying_t,...)
Provides the registration struct for enum class with specified underlying type.
Definition enum_class.h:30
Examples
enum_class_ut.cpp.

◆ enum_struct_

#define enum_struct_ (   namespace_name,
  enum_struct_t,
  ... 
)

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

Provides the registration struct for enum struct.

Header
#include <xtd/enum>
Library
xtd.core
Parameters
namespace_nameThe name of the the namespace. Empty if no namespace.
enum_struct_typeThe name of the enum struct.
...The enumeration list.
Remarks
This helper is created to facilitate to set the xtd::enum_register with the enumeration identifiers.
Warning
The helper has one limitiation :
  • The enumeration's cannot be in a class or struct. The enum must be in the global namespace or in a namespace hierarchy. If the enumeration is in a class or struct, add operators manually and use xtd::enum_register to register the enumeration identifiers.
Examples
The following code show how to use enum_ helper.
#include <xtd/as>
#include <xtd/console>
#include <xtd/enum_struct>
using namespace xtd;
enum_struct_(, enum_test,
value_one,
value_two,
value_three,
value_four
);
auto main() -> int {
console::write_line("name = {}", enum_test::value_four);
console::write_line("value = {}", enum_object(enum_test::value_four).to_int32());
console::write_line("as<int> = {}", as<int>(enum_test::value_four));
console::write_line("values = {}", enum_object<>::get_values_as_int32<enum_test>());
console::write_line("names = {}", enum_object<>::get_names<enum_test>());
console::write_line("entries = {}", enum_object<>::get_entries_as_int32<enum_test>());
}
// This code produces the following output :
//
// name = value_four
// value = 3
// as<int> = 3
// values = [0, 1, 2, 3]
// names = [value_one, value_two, value_three, value_four]
// entries = [(0, value_one), (1, value_two), (2, value_three), (3, value_four)]
#define enum_struct_(namespace_name, enum_struct_t,...)
Provides the registration struct for enum struct.
Definition enum_struct.h:52
Examples
enum_struct.cpp, and parse_enum_struct.cpp.

◆ enum_struct_ut_

#define enum_struct_ut_ (   namespace_name,
  enum_struct_t,
  underlying_t,
  ... 
)

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

Provides the registration struct for enum with specified underlying type.

Header
#include <xtd/enum>
Library
xtd.core
Parameters
namespace_nameThe name of the the namespace. Empty if no namespace.
enum_struct_typeThe name of the enum struct.
underlying_typeThe underying type.
...The enumeration list.
Remarks
This helper is created to facilitate to set the xtd::enum_register with the enumeration identifiers.
Warning
The helper has one limitiation :
  • The enumeration's cannot be in a class or struct. The enum must be in the global namespace or in a namespace hierarchy. If the enumeration is in a class or struct, add operators manually and use xtd::enum_register to register the enumeration identifiers.
Examples
The following code show how to use enum_struct_ut_ helper.
#include <xtd/as>
#include <xtd/console>
#include <xtd/enum_struct>
using namespace xtd;
enum_struct_ut_(, enum_test, byte,
value_one,
value_two,
value_three,
value_four
);
auto main() -> int {
console::write_line("name = {}", enum_test::value_four);
console::write_line("value = {}", enum_object(enum_test::value_four).to_int32());
console::write_line("as<int> = {}", as<int>(enum_test::value_four));
console::write_line("values = {}", enum_object<>::get_values_as_int32<enum_test>());
console::write_line("names = {}", enum_object<>::get_names<enum_test>());
console::write_line("entries = {}", enum_object<>::get_entries_as_int32<enum_test>());
}
// This code produces the following output :
//
// name = value_four
// value = 3
// as<int> = 3
// values = [0, 1, 2, 3]
// names = [value_one, value_two, value_three, value_four]
// entries = [(0, value_one), (1, value_two), (2, value_three), (3, value_four)]
#define enum_struct_ut_(namespace_name, enum_struct_t, underlying_t,...)
Provides the registration struct for enum with specified underlying type.
Definition enum_struct.h:30
Examples
enum_struct_ut.cpp.

◆ enum_ut_

#define enum_ut_ (   namespace_name,
  enum_t,
  underlying_t,
  ... 
)

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

Provides the registration struct for enum with specified underlying type.

Header
#include <xtd/enum>
Library
xtd.core
Parameters
namespace_nameThe name of the the namespace. Empty if no namespace.
enum_typeThe name of the enum.
underlying_typeThe underying type.
...The enumeration list.
Remarks
This helper is created to facilitate to set the xtd::enum_register with the enumeration identifiers.
Warning
The helper has one limitiation :
  • The enumeration's cannot be in a class or struct. The enum must be in the global namespace or in a namespace hierarchy. If the enumeration is in a class or struct, add operators manually and use xtd::enum_register to register the enumeration identifiers.
Examples
The following code show how to use enum_ut_ helper.
#include <xtd/as>
#include <xtd/console>
#include <xtd/enum>
using namespace xtd;
enum_ut_(, enum_test, byte,
value_one,
value_two,
value_three,
value_four
);
auto main() -> int {
console::write_line("name = {}", enum_test::value_four);
console::write_line("value = {}", enum_object(enum_test::value_four).to_byte());
console::write_line("as<byte> = {}", as<byte>(enum_test::value_four));
console::write_line("values = {}", enum_object<>::get_values_as_int32<enum_test>());
console::write_line("names = {}", enum_object<>::get_names<enum_test>());
console::write_line("entries = {}", enum_object<>::get_entries_as_int32<enum_test>());
}
// This code produces the following output :
//
// name = value_four
// value = 3
// as<byte> = 3
// values = [0, 1, 2, 3]
// names = [value_one, value_two, value_three, value_four]
// entries = [(0, value_one), (1, value_two), (2, value_three), (3, value_four)]
#define enum_ut_(namespace_name, enum_t, underlying_t,...)
Provides the registration struct for enum with specified underlying type.
Definition enum.h:30
Examples
enum_ut.cpp.

◆ export_

#define export_

#include <xtd/include/xtd/export.h>

Define shared library export.

Warning
Internal use only

◆ flags_attribute_

#define flags_attribute_ (   namespace_name,
  enum_type 
)

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

Provides the set attribute struct for enumerations helper.

Namespace
xtd
Library
xtd.core
Parameters
namespace_nameThe name of the the namespace. Empty if no namespace.
enum_typeThe name of the enum flags.
Remarks
This helper is created to facilitate to set the xtd::enum_set_attribute with the xtd::enum_attribute::flags atribute and the implementation of the following operators for enum flags:
Operator Name
^= Bitwise XOR assignment
&= Bitwise AND assignment
|= Bitwise OR assignment
+= Addition assignment
-= Subtraction assignment
Bitwise XOR
& Bitwise AND
| Bitwise OR
+ Addition
- Subtraction
~ Bitwise NOT
Warning
The helper as one limitiation :
  • The enum's flags cannot be in a class or struct. The enum must be in the global namespace or in a namespace hierarchy. If the enum flags is in a class or struct, add operators manually and use xtd::enum_set_attribute to register the xtd::enum_attribute::flags attribute.
Examples
The following code show how to use flags_attribute_ helper.
#include <xtd/enum_class>
#include <xtd/ustring>
using namespace std;
using namespace xtd;
enum class text_styles {
normal = 0b0,
bold = 0b1,
italic = 0b10,
underline = 0b100,
strikeout = 0b1000,
};
// Add text_style enum class flags operators and register flags attribute.
flags_attribute_(, text_styles);
// Only this operator is needed for text_styles enum class to be recognized by xtd::ustring::format().
template<> struct xtd::enum_register<text_styles> {
explicit operator auto() const noexcept {return xtd::enum_collection<text_styles> {{text_styles::normal, "normal"}, {text_styles::bold, "bold"}, {text_styles::italic, "italic"}, {text_styles::underline, "underline"}, {text_styles::strikeout, "strikeout"}};}
};
auto main() -> int {
cout << ustring::format("{}", text_styles::bold | text_styles::italic) << endl;
cout << ustring::format("0b{:b}", text_styles::bold | text_styles::italic) << endl;
cout << ustring::format("0b{:B}", text_styles::bold | text_styles::italic) << endl;
cout << ustring::format("{:d}", text_styles::bold | text_styles::italic) << endl;
cout << ustring::format("{:D}", text_styles::bold | text_styles::italic) << endl;
cout << ustring::format("{:g}", text_styles::bold | text_styles::italic) << endl;
cout << ustring::format("{:G}", text_styles::bold | text_styles::italic) << endl;
cout << ustring::format("0{:o}", text_styles::bold | text_styles::italic) << endl;
cout << ustring::format("0{:O}", text_styles::bold | text_styles::italic) << endl;
cout << ustring::format("0x{:x}", text_styles::bold | text_styles::italic) << endl;
cout << ustring::format("0x{:X}", text_styles::bold | text_styles::italic) << endl;
}
// This code produces the following output :
//
// saturday
// 0b101
// 0b101
// 5
// 5
// saturday
// saturday
// 05
// 05
// 0x5
// 0x5
#define flags_attribute_(namespace_name, enum_type)
Provides the set attribute struct for enumerations helper.
Definition flags_attribute.h:34
std::vector< xtd::collections::generic::key_value_pair< enum_t, xtd::ustring > > enum_collection
Represents a pair of an enum_t value and a string of an enum of type enum_t.
Definition enum_collection.h:22
Provides the registration struct for enumerations.
Definition enum_register.h:38
Examples
enum_class_flags.cpp, enum_class_flags_introspection.cpp, and format_enum_class_flags.cpp.

◆ forms_export_

#define forms_export_

#include <xtd.forms/include/xtd/forms_export.h>

Define shared library export.

Warning
Internal use only

◆ interface_

#define interface_

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

This keyword is use to represent an interface.

Library
xtd.core
Examples
@include <xtd/interface>
class istringable interface_ {
public:
virtual std::string to_string() const = 0;
};
class foo : public istringable {
public:
Foo() = default;
std:::string to_string() const override {return "foo";}
};
#define interface_
This keyword is use to represent an interface.
Definition interface.h:58
Examples
interface.cpp.

◆ lock_

#define lock_ (   object)

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

The lock_ keyword marks a statement block as a critical section by obtaining the mutual-exclusion lock for a given object, executing a statement, and then releasing the lock. The following example includes a lock statement.

class account : public object {
public:
void withdraw(decimal amount) {
lock_ (balance) {
if (amount > balance)
throw system_exception("Insufficient funds");
balance -= amount;
}
}
private:
decimal balance;
};
#define lock_(object)
The lock_ keyword marks a statement block as a critical section by obtaining the mutual-exclusion loc...
Definition lock.h:85
long double decimal
Represents a decimal-precision floating-point number.
Definition decimal.h:23

For more information, see Thread Synchronization.

Namespace
xtd
Library
xtd.core
Remarks
The lock_ keyword ensures that one thread does not enter a critical section of code while another thread is in the critical section. If another thread tries to enter a locked code, it will wait, block, until the object is released.
The section Threading discusses threading.
The lock_ keyword calls Enter at the start of the block and Exit at the end of the block. A xtd::threading::thread_interrupted_exception is thrown if xtd::threading::thread::interrupt interrupts a thread that is waiting to enter a lock statement.
In general, avoid locking on a public type, or instances beyond your code's control. The common constructs lock_ (*this), lock_ (typeof_<my_type>()), and lock_ ("myLock") violate this guideline:
  • lock_ (*this) is a problem if the instance can be accessed publicly.
  • lock_ (typeof_<my_type>()) is a problem if my_type is publicly accessible.
  • lock_ ("my_lock") is a problem because any other code in the process using the same string, will share the same lock.
Best practice is to define a private object to lock on, or a private static object variable to protect data common to all instances.
You can't use the await_ keyword in the body of a lock_ statement.
Examples
The following sample shows a simple use of threads without locking in C++.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::rhreading;
class thread_test {
public:
void run_me() {
console::write_line("run_me called");
}
static void main() {
thread_test b;
auto t = thread {thread_start {b, &thread_test::run_me));
t.start();
}
};
startup_(thread_test::main)
// Output: run_me called
Examples
The following sample uses threads and lock_. As long as the lock statement is present, the statement block is a critical section and balance will never become a negative number.
#include <xtd/threading/thread_pool>
#include <xtd/console>
#include <xtd/lock>
#include <xtd/random>
#include <xtd/startup>
using namespace xtd;
using namespace xtd::threading;
namespace examples {
class account : public object {
public:
explicit account(int initial) : balance(initial) {}
void do_transactions() {
for (auto i = 0; i < 100; ++i)
withdraw(random.next(1, 100));
}
private:
int withdraw(int amount) {
// This condition never is true unless the lock statement is commented out.
if (balance < 0) throw system_exception {"Negative Balance", csf_};
// Comment out the next line to see the effect of leaving out the lock keyword.
lock_(balance) {
if (balance < amount) return 0;
console::write_line("Balance before Withdrawal : {0}", balance);
console::write_line("Amount to Withdraw : -{0}", amount);
balance = balance - amount;
console::write_line("Balance after Withdrawal : {0}", balance);
return amount;
}
return 0;
}
int balance = 0;
};
class program {
public:
static void main() {
auto account = examples::account {1000};
for (auto i = 0; i < 10; ++i)
thread_pool::queue_user_work_item({account, &account::do_transactions});
thread_pool::close();
}
};
}
startup_(examples::program::main);
// This code can produce the following output:
//
// Balance before Withdrawal : 1000
// Amount to Withdraw : -75
// Balance after Withdrawal : 925
// Balance before Withdrawal : 925
// Amount to Withdraw : -84
// Balance after Withdrawal : 841
// Balance before Withdrawal : 841
// Amount to Withdraw : -69
// Balance after Withdrawal : 772
// Balance before Withdrawal : 772
// Amount to Withdraw : -71
// Balance after Withdrawal : 701
// Balance before Withdrawal : 701
// Amount to Withdraw : -84
// Balance after Withdrawal : 617
// Balance before Withdrawal : 617
// Amount to Withdraw : -81
// Balance after Withdrawal : 536
// Balance before Withdrawal : 536
// Amount to Withdraw : -15
// Balance after Withdrawal : 521
// Balance before Withdrawal : 521
// Amount to Withdraw : -93
// Balance after Withdrawal : 428
// Balance before Withdrawal : 428
// Amount to Withdraw : -6
// Balance after Withdrawal : 422
// Balance before Withdrawal : 422
// Amount to Withdraw : -54
// Balance after Withdrawal : 368
// Balance before Withdrawal : 368
// Amount to Withdraw : -52
// Balance after Withdrawal : 316
// Balance before Withdrawal : 316
// Amount to Withdraw : -67
// Balance after Withdrawal : 249
// Balance before Withdrawal : 249
// Amount to Withdraw : -93
// Balance after Withdrawal : 156
// Balance before Withdrawal : 156
// Amount to Withdraw : -60
// Balance after Withdrawal : 96
// Balance before Withdrawal : 96
// Amount to Withdraw : -7
// Balance after Withdrawal : 89
// Balance before Withdrawal : 89
// Amount to Withdraw : -42
// Balance after Withdrawal : 47
// Balance before Withdrawal : 47
// Amount to Withdraw : -1
// Balance after Withdrawal : 46
// Balance before Withdrawal : 46
// Amount to Withdraw : -22
// Balance after Withdrawal : 24
// Balance before Withdrawal : 24
// Amount to Withdraw : -18
// Balance after Withdrawal : 6
// Balance before Withdrawal : 6
// Amount to Withdraw : -2
// Balance after Withdrawal : 4
// Balance before Withdrawal : 4
// Amount to Withdraw : -2
// Balance after Withdrawal : 2
// Balance before Withdrawal : 2
// Amount to Withdraw : -2
// Balance after Withdrawal : 0
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:40
Represents a pseudo-random number generator, a device that produces a sequence of numbers that meet c...
Definition random.h:40
virtual int32 next() const
Returns a nonnegative random number.
Defines the base class for predefined exceptions in the xtd namespace.
Definition system_exception.h:24
@ i
The I key.
Examples
lock.cpp, monitor_lock.cpp, monitor_pulse.cpp, and monitor_pulse_all.cpp.

◆ lock_guard_

#define lock_guard_ (   object)

#include <xtd.core/include/xtd/threading/lock_guard.h>

The lock_guard_ keyword marks a statement block as a critical section by obtaining the mutual-exclusion lock for a given object, executing a statement, and then releasing the lock. The following example includes a lock statement.

class account : public object {
public:
void withdraw(decimal amount) {
lock_guard_ (balance) {
if (amount > balance)
throw system_exception("Insufficient funds");
balance -= amount;
}
}
private:
decimal balance;
};
#define lock_guard_(object)
The lock_guard_ keyword marks a statement block as a critical section by obtaining the mutual-exclusi...
Definition lock_guard.h:181

For more information, see Thread Synchronization.

Namespace
xtd
Library
xtd.core
Remarks
The lock_guard_ keyword ensures that one thread does not enter a critical section of code while another thread is in the critical section. If another thread tries to enter a locked code, it will wait, block, until the object is released.
The section Threading discusses threading.
The lock_guard_ keyword calls Enter at the start of the block and Exit at the end of the block. A xtd::threading::thread_interrupted_exception is thrown if xtd::threading::thread::interrupt interrupts a thread that is waiting to enter a lock statement.
In general, avoid locking on a public type, or instances beyond your code's control. The common constructs lock_guard_ (*this), lock_guard_ (typeof_<my_type>()), and lock_guard_ ("myLock") violate this guideline:
  • lock_guard_ (*this) is a problem if the instance can be accessed publicly.
  • lock_guard_ (typeof_<my_type>()) is a problem if my_type is publicly accessible.
  • lock_guard_ ("my_lock") is a problem because any other code in the process using the same string, will share the same lock.
Best practice is to define a private object to lock on, or a private static object variable to protect data common to all instances.
You can't use the await_ keyword in the body of a lock_guard_ statement.
Examples
The following sample shows a simple use of threads without locking in C++.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::rhreading;
class thread_test {
public:
void run_me() {
console::write_line("run_me called");
}
static void main() {
thread_test b;
auto t = thread {thread_start {b, &thread_test::run_me));
t.start();
}
};
startup_(thread_test::main)
// Output: run_me called
Examples
The following sample uses threads and lock_guard_. As long as the lock statement is present, the statement block is a critical section and balance will never become a negative number.
#include <xtd/threading/lock_guard>
#include <xtd/threading/thread_pool>
#include <xtd/console>
#include <xtd/random>
#include <xtd/startup>
using namespace xtd;
using namespace xtd::threading;
namespace examples {
class account : public object {
public:
explicit account(int initial) : balance(initial) {}
void do_transactions() {
for (auto i = 0; i < 100; ++i)
withdraw(random.next(1, 100));
}
private:
int withdraw(int amount) {
// This condition never is true unless the lock statement is commented out.
if (balance < 0) throw system_exception {"Negative Balance", csf_};
// Comment out the next line to see the effect of leaving out the lock keyword.
lock_guard_(balance) {
if (balance < amount) return 0;
console::write_line("Balance before Withdrawal : {0}", balance);
console::write_line("Amount to Withdraw : -{0}", amount);
balance = balance - amount;
console::write_line("Balance after Withdrawal : {0}", balance);
return amount;
}
return 0;
}
int balance = 0;
};
class program {
public:
static void main() {
auto account = examples::account {1000};
for (auto i = 0; i < 10; ++i)
thread_pool::queue_user_work_item({account, &account::do_transactions});
thread_pool::close();
}
};
}
startup_(examples::program::main);
// This code can produce the following output:
//
// Balance before Withdrawal : 1000
// Amount to Withdraw : -75
// Balance after Withdrawal : 925
// Balance before Withdrawal : 925
// Amount to Withdraw : -84
// Balance after Withdrawal : 841
// Balance before Withdrawal : 841
// Amount to Withdraw : -69
// Balance after Withdrawal : 772
// Balance before Withdrawal : 772
// Amount to Withdraw : -71
// Balance after Withdrawal : 701
// Balance before Withdrawal : 701
// Amount to Withdraw : -84
// Balance after Withdrawal : 617
// Balance before Withdrawal : 617
// Amount to Withdraw : -81
// Balance after Withdrawal : 536
// Balance before Withdrawal : 536
// Amount to Withdraw : -15
// Balance after Withdrawal : 521
// Balance before Withdrawal : 521
// Amount to Withdraw : -93
// Balance after Withdrawal : 428
// Balance before Withdrawal : 428
// Amount to Withdraw : -6
// Balance after Withdrawal : 422
// Balance before Withdrawal : 422
// Amount to Withdraw : -54
// Balance after Withdrawal : 368
// Balance before Withdrawal : 368
// Amount to Withdraw : -52
// Balance after Withdrawal : 316
// Balance before Withdrawal : 316
// Amount to Withdraw : -67
// Balance after Withdrawal : 249
// Balance before Withdrawal : 249
// Amount to Withdraw : -93
// Balance after Withdrawal : 156
// Balance before Withdrawal : 156
// Amount to Withdraw : -60
// Balance after Withdrawal : 96
// Balance before Withdrawal : 96
// Amount to Withdraw : -7
// Balance after Withdrawal : 89
// Balance before Withdrawal : 89
// Amount to Withdraw : -42
// Balance after Withdrawal : 47
// Balance before Withdrawal : 47
// Amount to Withdraw : -1
// Balance after Withdrawal : 46
// Balance before Withdrawal : 46
// Amount to Withdraw : -22
// Balance after Withdrawal : 24
// Balance before Withdrawal : 24
// Amount to Withdraw : -18
// Balance after Withdrawal : 6
// Balance before Withdrawal : 6
// Amount to Withdraw : -2
// Balance after Withdrawal : 4
// Balance before Withdrawal : 4
// Amount to Withdraw : -2
// Balance after Withdrawal : 2
// Balance before Withdrawal : 2
// Amount to Withdraw : -2
// Balance after Withdrawal : 0
Examples
lock_guard_keyword.cpp.

◆ nameof_

#define nameof_ (   ...)

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

Used to obtain the simple (unqualified) string name of a variable, type, or member.

Namespace
xtd
Library
xtd.core

When reporting errors in code, hooking up model-view-controller (MVC) links, firing property changed events, etc., you often want to capture the string name of a method. Using nameof helps keep your code valid when renaming definitions. Before, you had to use string literals to refer to definitions, which is brittle when renaming code elements because tools do not know to check these string literals.

A nameof expression has this form:

if (x == null) throw std::argument_error(nameof_(x));
write_line(nameof_(person.address().zip_code())); // prints "person.address().zip_code()"
#define nameof_(...)
Used to obtain the simple (unqualified) string name of a variable, type, or member.
Definition nameof.h:34
Examples
Some C++ examples:
Remarks
The argument to nameof must be a simple name, qualified name, member access, base access with a specified member, or this access with a specified member. The argument expression identifies a code definition, but it is never evaluated.
Because the argument needs to be an expression syntactically, there are many things disallowed that are not useful to list. The following are worth mentioning that produce errors: predefined types (for example, int or void), nullable types (Point?), array types (Customer[,]), pointer types (Buffer*), qualified alias (A::B), and unbound generic types (Dictionary<,>), preprocessing symbols (DEBUG), and labels (loop:).
If you need to get the fully-qualified name, you can use the typeof_ expression along with nameof. For example:
class c {
public:
void f(int i) {
log(xtd::ustring::format("{0}.{1}", typeof_(C), nameof_(f)), "method entry");
}
}
static ustring format(const ustring &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition ustring.h:1068
#define typeof_
Used to obtain the type object of a specified type or object.
Definition typeof.h:45

◆ scope_exit_

#define scope_exit_

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

Nowadays, every C++ developer is familiar with the Resource Acquisition Is Initialization (RAII) technique. It binds resource acquisition and release to initialization and destruction of a variable that holds the resource. There are times when writing a special class for such a variable is not worth the effort. This is when xtd scope_exit_ comes into play.

Namespace
xtd
Library
xtd.core
Remarks
See also xtd::scope_exit struct.
Warning
Prefer use RAII then scope_exit_.
#include <xtd/xtd>
using namespace xtd;
auto main() -> int {
console::write_line("scope_exit");
};
console::write_line("begin");
//...
console::write_line();
console::write_line("do something...");
console::write_line();
//...
console::write_line("end");
}
// This code produces the following output:
//
// begin
//
// do something...
//
// end
// scope_exit
#define scope_exit_
Nowadays, every C++ developer is familiar with the Resource Acquisition Is Initialization (RAII) tech...
Definition scope_exit.h:103

◆ self_

#define self_

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

The self_ expression is a reference value expression whose value is the reference of the implicit object parameter (the object on which the non-static member function (up to C++23) implicit object member function (since C++23) is called).

Namespace
xtd
Library
xtd.core
Remarks
self_ is equivalent to *this.

◆ startup_

#define startup_ (   main_method)

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

Defines the entry point to be called when the application loads. Generally this is set either to the main form in your application or to the main procedure that should run when the application starts.

Namespace
xtd
Library
xtd.core
Parameters
main_methodThe main method.
Examples
This example show a main method without arguments and without return code
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
using namespace xtd;
namespace main1_example {
class program {
public:
static void main() {
// Write arguments to the console output
for (auto arg : environment::get_command_line_args())
console::write_line(arg);
// return 42
environment::exit_code(42);
}
};
}
startup_(main1_example::program::main);
// Is the same as :
//
// auto main() -> int {
// return startup::safe_run(main1_example::program::main);
// }
// This code produces the following output if one two "three four" five are entered on command line:
//
// /!---OMITTED---!/main1
// one
// two
// three four
// five
Represents the standard input, output, and error streams for console applications.
Definition console.h:36
The environment class.
Definition environment.h:66
This example show a main method with a return code and without arguments
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
using namespace xtd;
namespace main2_example {
class program {
public:
static int main() {
// Write arguments to the console output
for (auto arg : environment::get_command_line_args())
console::write_line(arg);
return 42;
}
};
}
startup_(main2_example::program::main);
// Is the same as :
//
// auto main() -> int {
// return startup::safe_run(main2_example::program::main);
// }
// This code produces the following output if one two "three four" five are entered on command line:
//
// /!---OMITTED---!/main2
// one
// two
// three four
// five
This example show a main method with argument and without return code
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
using namespace xtd;
namespace main3_example {
class program {
public:
static void main(const string_collection& args) {
// Write arguments to the console output
for (auto arg : args)
console::write_line(arg);
// return 42
environment::exit_code(42);
}
};
}
startup_(main3_example::program::main);
// Is the same as :
//
// auto main() -> int {
// return startup::safe_run(main3_example::program::main);
// }
// This code produces the following output if one two "three four" five are entered on command line:
//
// one
// two
// three four
// five
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.h:33
The xtd::collections::specialized namespace contains specialized and strongly-typed collections; for ...
Definition string_collection.h:13
This example show a main method with argument and return code
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
using namespace xtd;
namespace main4_example {
class program {
public:
static int main(const string_collection& args) {
// Write arguments to the console output
for (auto arg : args)
console::write_line(arg);
return 42;
}
};
}
startup_(main4_example::program::main);
// Is the same as :
//
// auto main() -> int {
// return startup::safe_run(main4_example::program::main);
// }
// This code produces the following output if one two "three four" five are entered on command line:
//
// one
// two
// three four
// five
Examples
application_and_assert.cpp, application_and_exception.cpp, application_enable_dark_mode.cpp, application_enable_light_mode.cpp, application_with_cmake_assembly_info.cpp, application_with_manual_assembly_info.cpp, auto_reset_event.cpp, background_worker.cpp, barrier.cpp, barrier_simple.cpp, binary_reader.cpp, binary_reader2.cpp, binary_reader3.cpp, bit_converter_endianness.cpp, bit_converter_is_big_endian.cpp, bit_converter_is_little_endian.cpp, bit_converter_round_trips.cpp, border_style.cpp, calculator.cpp, change_parent.cpp, circular_form.cpp, console_clear.cpp, console_firework.cpp, countdown_event.cpp, countries.cpp, date_time.cpp, date_time_add.cpp, date_time_add_days.cpp, date_time_add_hours.cpp, date_time_add_milliseconds.cpp, date_time_add_minutes.cpp, date_time_add_months.cpp, date_time_add_seconds.cpp, date_time_add_years.cpp, date_time_date.cpp, date_time_day_of_week.cpp, date_time_day_of_year.cpp, date_time_days_in_month.cpp, date_time_days_in_month2.cpp, date_time_max_value.cpp, date_time_min_value.cpp, date_time_now.cpp, date_time_now2.cpp, date_time_specify_kind.cpp, date_time_sprintf.cpp, date_time_subtract.cpp, date_time_ticks.cpp, date_time_ticks2.cpp, date_time_time_of_day.cpp, date_time_to_string_format.cpp, date_time_today.cpp, debug_message_box.cpp, default_trace_listener.cpp, drive_info.cpp, environment_cancel_signal.cpp, environment_exit.cpp, environment_exit_code.cpp, environment_program_exit.cpp, event_wait_handle.cpp, file_info.cpp, file_info_append_text.cpp, file_info_move_to.cpp, file_info_open.cpp, file_info_open_read.cpp, file_info_open_text.cpp, file_info_open_write.cpp, file_info_replace.cpp, form_and_main.cpp, form_background_image.cpp, form_show.cpp, graph_control.cpp, horizontal_layout_panel.cpp, interlocked.cpp, interlocked_decrement.cpp, ip_address.cpp, lcd_label3.cpp, lock.cpp, lock_guard.cpp, lock_guard_keyword.cpp, main.cpp, main1.cpp, main2.cpp, main3.cpp, main4.cpp, manual_reset_event.cpp, math.cpp, mixing_std_and_xtd_threads.cpp, monitor.cpp, monitor_lock.cpp, monitor_pulse.cpp, monitor_pulse_all.cpp, mutex.cpp, semaphore.cpp, send_message_to_form.cpp, some_controls.cpp, some_system_controls.cpp, stack_trace.cpp, system_sound.cpp, system_sounds.cpp, target_default_namespace.cpp, test_console.cpp, test_forms.cpp, themes.cpp, thread.cpp, thread_pool.cpp, time_span.cpp, timeout.cpp, timer.cpp, timers_timer.cpp, timers_timer_synchronizing_object.cpp, trace_message_box.cpp, track_bar2.cpp, tutorial_application_icon.cpp, tutorial_button.cpp, tutorial_communicate.cpp, tutorial_simple_application.cpp, uri.cpp, version.cpp, version_os.cpp, vertical_layout_panel.cpp, and wait_handle.cpp.

◆ startup_class_

#define startup_class_ (   main_class)

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

Defines the entry point to be called when the application loads. Generally this is set either to the main form in your application or to the main procedure that should run when the application starts.

Namespace
xtd
Library
xtd.core
Warning
The main_class must ba have a static member main method. For other entry point that main use startup_ keyword.

◆ static_

#define static_

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

This keyword is use to represent a static object. A static object can't be instantiated (constructors are deleted).

Namespace
xtd
Library
xtd.core
Examples
class foo static_ {
public:
static std::string to_string() {return "foo";}
};
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:37
Examples
console_firework.cpp, environment_cancel_signal.cpp, environment_program_exit.cpp, and static.cpp.

◆ static_object_

#define static_object_

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

This keyword is use to represent a static object. A static object can't be instantiated (constructors are deleted).

Namespace
xtd
Library
xtd.core
Examples
class foo static_object_ {
public:
static std::string to_string() {return "foo";}
};
#define static_object_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:53
Examples
static_object.cpp.

◆ tunit_export_

#define tunit_export_

#include <xtd.tunit/include/xtd/tunit_export.h>

Define shared library export.

Warning
Internal use only

◆ typeof_

#define typeof_

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

Used to obtain the type object of a specified type or object.

Returns
THe xtd::type_object that represent the type or the object.
Namespace
xtd
Library
xtd.core
Examples
// Get the type object of a type :
xtd::type_object type1 = typeof_<int32>();
int32 i = 42;
// Get the type object of an object :
Represents type declarations: class types, interface types, array types, value types,...
Definition type_object.h:39
Remarks
The typeof_ operator cannot be overloaded.
Examples
boxed_info.cpp, file_info_move_to.cpp, iclonable.cpp, and object_get_type.cpp.

◆ unused_

#define unused_

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

It may be used to suppress the "unused variable" or "unused local typedefs" compiler warnings when the variable or typedef can't be removed or commented out, e.g. when some blocks of the code are conditionally activated.

Namespace
xtd
Library
xtd_core
Parameters
argsvariables to suppress the unused warning
Examples
This example sho how to use Unused():

◆ using_

#define using_ (   ...)

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

The specified expression is cleared automatically when the scope is ended.

Namespace
xtd
Library
xtd.core
Examples
// values is released automatically after the end closure }.
using_(auto values = {1, 2, 3, 4, 5}) {
cout << ustring::join(", ", values) << endl;
}
#define using_(...)
The specified expression is cleared automatically when the scope is ended.
Definition using.h:33
same as :
using_(auto values = {1, 2, 3, 4, 5})
cout << ustring::join(", ", values) << endl;
same as :
{
auto values = {1, 2, 3, 4, 5};
cout << ustring::join(", ", values) << endl;
}
Remarks
same as block_scope_
Examples
binary_reader3.cpp, and using.cpp.