qt - What does the c++ class access keyword "signals" mean? -


i came across declaration similar (names changed per nda):

class foo {     int  bar;   public:     explicit foo (fu *parent = null);   private:     void somefunc (string);   signals:        // ??? ???     void windowclosed(); }; 

this compiled g++ 4.4.7 (from 2012). additionally, vim recognizes keyword similar public , private highlighting them in brown. (dis)similiarly, vim uses green highlight keywords namespace, class, void, int, double, float, char, unsigned, etc.

the stackoverflow code formatter not highlight signals above public , private!

it has proved quite difficult google (lots of noise), haven't found mentioning it, not on so. looked in enhancements section of g++ documentation.

this codebase large (23+ million lines), oldish (~1998), , has distinct accent. example, same class definition has class access private slots: before 2 member functions. possible there #define obfuscation or trickery going on, can't find using grep. possible g++ has been altered, --version output not indicate modification.

it isn't keyword, if you're using framework such qt adds 'keywords' language provide additional functionality isn't part of standard.

in qt example code gets preproccessed moc(meta-object compiler), signals defined in qobjectdefs.h #define signals public, moc checks macro add meta-code , provide actual signal-slot functionality, generated code put file name such 'moc_myclass.cpp'.


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -