Tencent / wcdb

WCDB is a cross-platform database framework developed by WeChat.
Other
10.78k stars 1.41k forks source link

C++ 如何获取FieldName #1145

Closed Hin-D closed 1 month ago

Hin-D commented 1 month ago

The language of WCDB

e.g. Objective-C, Swift or Java C++

The version of WCDB

e.g. v1.0.5 2.1.6

The platform of WCDB

e.g. iOS, macOS or Android macOS

The installation of WCDB

e.g. Cocoapods, Carthage, Maven, AAR Package or Git clone CMake

What's the issue?

Post the outputs or screenshots for errors.

Explain what you want by example or code in English.

我用 QT 开发,需要用到 WCDB,为了方便拓展,我希望做一个 table的基类实现 json 映射对象; 本来如果可以继承QObject是可以轻松实现对象遍历然后自己实现映射的,但继承QObject会报错,如下图;

WCDB 需要手动声明所有的 Field,应该是有记录到的,现在如何获取到这个 FiledName? 跪谢~

image
Qiuwen-chen commented 1 month ago

for(const auto &field : ObjectType::allFields()) { printf(field.syntax().name.data()) }