https://github.com/klappdev/property
C++ property library
https://github.com/klappdev/property
cpp cpp14 property setter-getter
Last synced: 3 months ago
JSON representation
C++ property library
- Host: GitHub
- URL: https://github.com/klappdev/property
- Owner: klappdev
- License: mit
- Created: 2023-02-11T13:32:25.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-11T14:11:15.000Z (almost 3 years ago)
- Last Synced: 2025-02-08T16:41:33.396Z (11 months ago)
- Topics: cpp, cpp14, property, setter-getter
- Language: C++
- Homepage:
- Size: 311 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# property
This is simple C++ header only library for generate
getters and setters for members class.
Library can generate getter and setter for such members:
> primitive members
> object members
> enum members
> array members
> pointer members
> reference members
> pointer to array members
> reference to array members
> pointer to function members
> reference to function members
When generate getter, setter for members classes occur in compile
time check types, name members, equals types kind members using
type traits library C++11/C++14.
Developer can write less code and to be sure that code write correct.
```C++
#include "property.hpp"
class person {
public:
person() = default;
~person() = default;
SETTER_PRIM(int, id);
SETTER_FLAG(bool, merried);
SETTER_ENUM(human, type);
SETTER_PTR(int, next);
SETTER_ARR(std::string, address, 3);
SETTER_OBJ_LR(std::string, name);
SETTER_OBJ_CLR(std::string, name);
SETTER_OBJ_RR(std::string, name);
GETTER_PRIM(int, id);
GETTER_FLAG(bool, merried);
GETTER_ENUM(human, type);
GETTER_OBJ_LR(std::string, name);
GETTER_OBJ_CLR(std::string, name);
GETTER_PTR(int, next);
GETTER_ARR(std::string, address);
private:
int id;
human type;
std::string name;
std::string address[5];
bool merried;
int* next;
};
```
Requirements:
Standard: C++14