Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
Description
Currently, ENUM{} can only be applied inside a class{}. Consequently, the enum is not accessible to other Sources and Replicas; the following .rep file produces a compilation error:
class Aaa { ENUM Color{Blue=0, Red=1}; PROP(Color colorOfA=Blue); }; class Bbb { PROP(Aaa::Color colorOfB=Aaa::Red); // error: C2653: 'Aaa': is not a class or namespace name };
This is because the generated C++ files contain AaaSource::Color and AaaReplica::Color.
Suggestion
Let REPC handle namespaces (and enums in namespaces). Take advantage of the existing Q_NAMESPACE and Q_ENUM_NS() macros (https://doc.qt.io/qt-6/qobject.html#Q_ENUM_NS ) to support constructs like this:
namespace NS { ENUM Color{Blue=0, Red=1}; } class Aaa { PROP(NS::Color colorOfA=NS::Blue); }; class Bbb { PROP(NS::Color colorOfB=NS::Red); };
This should be easy to add, since the namespace can have the same name on both the Source and Replica side (like a POD/Q_GADGET)