An open API service indexing awesome lists of open source software.

https://github.com/jaytwolab/cpp.define_member_and_setter

Define Member and Setter Macro for C++ :kr: C++용 멤버 변수 및 Setter 매크로 정의
https://github.com/jaytwolab/cpp.define_member_and_setter

Last synced: 5 months ago
JSON representation

Define Member and Setter Macro for C++ :kr: C++용 멤버 변수 및 Setter 매크로 정의

Awesome Lists containing this project

README

          


English |
Korean

# C++용 멤버 변수 및 Setter 매크로 정의

이 프로젝트는 C++17 이상에서 멤버 변수와 체이닝 가능한 setter 함수를 동시에 정의할 수 있는 간단한 매크로를 제공합니다.

## 주요 기능

- 매크로 한 줄로 멤버 변수와 setter를 정의
- 코드 가독성과 유지보수성 향상
- C++17 이상에서 동작

## 사용 예시

```cpp
#include "DefineMemeberAndSetter.hpp"

struct Config {
DEFINE_MEMBER_AND_SETTER(std::string, name)
DEFINE_MEMBER_AND_SETTER(int, width)
DEFINE_MEMBER_AND_SETTER(int, height)
};
```

사용법:

```cpp
Config cfg;

// Setter
cfg.name("Main Window")
.width(1280)
.height(720);

// Getter
std::cout << "Name: " << cfg.name() << "\n";
std::cout << "Width: " << cfg.width() << "\n";
std::cout << "Fullscreen: " << std::boolalpha << cfg.fullscreen() << "\n";

```

## 빌드 방법

```bash
mkdir build && cd build
cmake ..
make
```

## 라이선스

- MIT License
- https://github.com/JayTwoLab/cpp.define_member_and_setter