[Interest] Three-file modules vs. moc

Bernhard Lindner private at bernhard-lindner.de
Thu Aug 27 14:42:03 CEST 2020


Hi!

> Can you make an example of your structure (what's exactly in each of the 
> three files)? It's not entirely clear.

Ok, I attached an example of a module containing some pseudo code. Please tell me if you
need more information.

> You might also use a custom extra compiler -- that still invokes moc, 
> but for each foo.h also tells moc to include foo.inl, bar.h -> bar.inl, 
> and so on...

Hm, I see. Has something like that been done before, is there code I could reuse?

-- 
Best Regards,
Bernhard Lindner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spinbox.cpp
Type: text/x-c++src
Size: 118 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200827/2f87d424/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spinbox.hpp
Type: text/x-c++hdr
Size: 919 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200827/2f87d424/attachment.hpp>
-------------- next part --------------
#ifndef SPINBOX_INL
#define SPINBOX_INL

#include "spinbox.hpp"

template <typename T>
AbstractSpinBox<T>::AbstractSpinBox(QWidget* pParent) noexcept :
   QAbstractSpinBox(pParent)
{
   ....
}

template <typename T>
void AbstractSpinBox<T>::setMinimum(const T& pMinimum) noexcept
{
   ....
}

template <typename T>
void AbstractSpinBox<T>::setMaximum(const T& pMaximum) noexcept
{
   ....
}

template <typename T>
void AbstractSpinBox<T>::setValue(const T& pValue) noexcept
{
   ....
}

template <typename T>
inline T AbstractSpinBox<T>::minimum() const noexcept
{
   ....
}

template <typename T>
inline T AbstractSpinBox<T>::maximum() const noexcept
{
   ....
}

template <typename T>
inline T AbstractSpinBox<T>::value() const noexcept
{
   ....
}

#endif // SPINBOX_INL


More information about the Interest mailing list