Skip to content

cmProp: refactoring: transform alias in class

Marc Chevrier requested to merge marc.chevrier/cmake:cmProp-class into master

To handle safely the values used by CMake variables and properties, introduce the class cmProp as a replacement from the simple pointer to std::string instance.

The class cmProp can be used, safely, as a pointer to std::string: a pointer to empty std::string is used if value is nullptr. Constructors are explicit because the cmProp object store only a pointer to another object. Moreover, to facilitate usability, cast operators are available to transform the instance in cm::string_view and std::string objects.

Multiple methods are available to query state of the object: IsOn(), IsOff(), IsEmpty(), IsNOTFOUND().

And it is also possible to use internal pointer by methods Get() and GetCStr().

Edited by Marc Chevrier

Merge request reports