[Qt-interest] How does qfontdatabase_qws.cpp access private data from qfontdatabase.h?
Andreas Pakulat
apaku at gmx.de
Thu Jul 9 14:30:18 CEST 2009
On 09.07.09 11:38:45, Linda Maria wrote:
> Hi
>
> I thought I knew how to read C++ code, but obviously I was wrong. I cannot
> figure out how private data from qfontdatabase.cpp can be accessed from
> qfontdatabase.h. For example:
>
>
> QFontDatabasePrivate is delclared and partly implemented in
> qfontdatabase.cpp and only forward declared in qfontdatabase.h. Then,
> qfontdatabase_qws.cpp starts accessing the QFontDatabasePrivate
> implementation. How is this done?
>
> It would be nice if Qt used more of pure C++ code rather than showing off
> with macro definitions.
There is no macro magic done here, no idea where you get that from.
qfontdatabase_x11.cpp (and presumably all others) use a simple privateDb()
function to get access to the FondDataBasePrivate instance.
And that works without forward declaration because the platform-specific
cpp files are #include'ed into qfontdatabase.cpp.
Andreas
--
You will forget that you ever knew me.
More information about the Qt-interest-old
mailing list