Represents an include directive for C++ source code, providing control over whether it is a system or local include.
More...
#include <meta_utils.hpp>
|
| | MetaInclude (std::string project_relative_path, Type type=Type::Local) |
| | Constructs a MetaInclude with the given path and type.
|
| |
| std::string | str (const std::filesystem::path &base=".") const |
| | Converts the MetaInclude into a valid C++ #include directive string.
|
| |
Represents an include directive for C++ source code, providing control over whether it is a system or local include.
The MetaInclude class is used to generate standardized C++ include statements. It supports both system includes (#include <...>) and local includes (#include "...") depending on the specified type.
◆ Type
Distinguishes between local and system include types.
| Enumerator |
|---|
| Local | Include file from the project directory (uses quotes: "...")
|
| System | Include file from system paths (uses angle brackets: <...>)
|
◆ MetaInclude()
| meta_utils::MetaInclude::MetaInclude |
( |
std::string | project_relative_path, |
|
|
Type | type = Type::Local ) |
|
inline |
Constructs a MetaInclude with the given path and type.
- Parameters
-
| project_relative_path | The path to the header file, relative to the project root. |
| type | The type of include (Local or System). Defaults to Local. |
Example usage:
MetaInclude local_inc(
"src/utility/glm_meta_types/glm_meta_types.hpp");
std::cout << local_inc.str() << std::endl;
std::cout << system_inc.str() << std::endl;
MetaInclude relative_inc(
"project/src/utility/math.hpp");
std::cout << relative_inc.str("project") << std::endl;
◆ str()
| std::string meta_utils::MetaInclude::str |
( |
const std::filesystem::path & | base = "." | ) |
const |
|
inline |
Converts the MetaInclude into a valid C++ #include directive string.
- Parameters
-
| base | The base directory to which the path should be made relative. Defaults to the current directory ("."). |
- Returns
- A formatted include directive as a string.
The documentation for this class was generated from the following file: