Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement tool to convert proto to struct pb #323

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

helintongh
Copy link
Contributor

proto file to struct pb.

#pragma once
#include <ylt/struct_pb.hpp>

#define PUBLIC(T) : public iguana::base_impl<T>
Copy link
Owner

@qicosmos qicosmos Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要用PUBLIC,使用完整的public iguana::base_impl。
另外可以增加一个参数:enable_reflection,如果设置为true,才从 iguana::base_impl派生。
默认情况下,不需要派生。
默认情况下构造函数也是不需要的,只有派生的时候才需要增加构造函数。

}
Color color = 6;
repeated Weapon weapons = 7;
Weapon equipped = 8;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

非数字类型的字段生成结构体字段时需要加std::optional。
或者再增加一个参数add_optional来控制这一行为。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants