cmakepp_lang/class/class_decl

Defines functions to declare a user-defined CMakePPLang class.

cmakepp_lang/class/class_decl.__CMAKEPP_LANG_CLASS_TEMPLATE__

Template file for creating a class.

Default value:

${CMAKE_CURRENT_LIST_DIR}/detail/class.cmake.in

Type:

str

cmakepp_lang/class/class_decl.cpp_class(type)

Note

This is a macro, and so does not introduce a new scope.

Creates a new class of the specified type.

This command is used to start the declaration of a new user-defined type. The resulting user-defined type will automatically inherit from Object if no base classes are provided, otherwise it will inherit from the specified base classes (users of this command should never explicitly specify inheritance from Object).

Parameters:
  • type (desc) – The name of the class whose declaration is being started.

  • *args – The various base classes that the class should inherit from.

Variables:

CMAKEPP_LANG_DEBUG_MODE (bool) – Used to determine if CMakePP is being run in debug mode or not.

Note

This command is a macro to ensure that the functions generated by this command are in scope to the caller.

Error Checking

If CMakePP is run in debug mode (and only if it is run in debug mode) this function will assert that it was called with at least one argument and that the arguments have the correct types.

cmakepp_lang/class/class_decl.cpp_end_class()

Note

This is a macro, and so does not introduce a new scope.

Denotes that we are done declaring a class.

This function is a no-op that completes the fencing associated with declaring a class.

Error Checking

None. This function is a no-op and has no errors to check for.

cmakepp_lang/class/class_decl._cpp_class_guts(type wrapper)

Creates the new class

This function is factored out of cpp_class and contains the logic required to actually create the class. This logic is factored out primarily to avoid contaminating the caller’s namespace with intermediate results.

Parameters:
  • type (desc) – The name of the class being created.

  • wrapper (desc) – Name for variable which will hold the path to the class’s implementation.

  • *args – The base classes that this class derives from.

Returns:

_cg_wrapper will be set to the absolute file path for the generated module which implements the class.

Return type:

path