[ 
https://issues.apache.org/jira/browse/THRIFT-1712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Vogt updated THRIFT-1712:
--------------------------------

    Description: 
The generated c++ classes for struct's does not have a common base class.

The patch adds a "base" option to the compiler:

- thrift --gen cpp:base

this will use a TBase in the thrift installation.

Another option allows to replace the baseclass with an arbitrary one:

-thrift --gen cpp:base=MyBase,inc=\\</path/MyBase.h\\>\n"

With this it's possible to extend the TBase class in the thrift installation.

I like to use this TBase class in QT, as a signal, for example:

signals:
       void update(const TBase& tBase);

And in the receiver slot I then can check which kind of message was send:
    // compare static pointers
    if (tBase.ascii_fingerprint == User::ascii_fingerprint) {
            User* user=(User*)&tBase;
            processUserMessage(user);
   }

  was:The generated c++ classes for struct does not have a common base class.


> Add TBase class for c++
> -----------------------
>
>                 Key: THRIFT-1712
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1712
>             Project: Thrift
>          Issue Type: New Feature
>          Components: C++ - Compiler
>    Affects Versions: 0.8
>            Reporter: Martin Vogt
>            Priority: Minor
>              Labels: base, c++, class
>
> The generated c++ classes for struct's does not have a common base class.
> The patch adds a "base" option to the compiler:
> - thrift --gen cpp:base
> this will use a TBase in the thrift installation.
> Another option allows to replace the baseclass with an arbitrary one:
> -thrift --gen cpp:base=MyBase,inc=\\</path/MyBase.h\\>\n"
> With this it's possible to extend the TBase class in the thrift installation.
> I like to use this TBase class in QT, as a signal, for example:
> signals:
>        void update(const TBase& tBase);
> And in the receiver slot I then can check which kind of message was send:
>     // compare static pointers
>     if (tBase.ascii_fingerprint == User::ascii_fingerprint) {
>             User* user=(User*)&tBase;
>             processUserMessage(user);
>    }



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to