[Development] Question about QtSerialPort addons macro like QT_BEGIN(END...)_NAMESPACE_XYZ...
Denis Shienkov
scapig2 at yandex.ru
Sat Feb 25 15:30:44 CET 2012
Hi Marius, Lars, Sergio, and all.
I need your advice.
1) Tell me please, what should be for the addon QtSerialPort namespace macros:
#if defined(QT_NAMESPACE)
# define QT_BEGIN_NAMESPACE_SERIALPORT namespace QT_NAMESPACE { namespace QtAddOn { namespace SerialPort {
# define QT_END_NAMESPACE_SERIALPORT } } }
# define QT_USE_NAMESPACE_SERIALPORT using namespace QT_NAMESPACE::QtAddOn::SerialPort;
# define QT_PREPEND_NAMESPACE_SERIALPORT(name) ::QT_NAMESPACE::QtAddOn::SerialPort::name
#else
# define QT_BEGIN_NAMESPACE_SERIALPORT namespace QtAddOn { namespace SerialPort {
# define QT_END_NAMESPACE_SERIALPORT } }
# define QT_USE_NAMESPACE_SERIALPORT using namespace QtAddOn::SerialPort;
# define QT_PREPEND_NAMESPACE_SERIALPORT(name) ::QtAddOn::SerialPort::name
#endif
on examples of existing addons projects from the playground,
or simply, such as
..
QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
..
and etc, on examples of existing Qt modules QtSensors.
2) If I do, by analogy with QtSensors - then do I need to change the class names addon, adding a prefix to the Q?
As I understand it: if namespace macros are used as examples in the add-ons from the playground - there is no need to
change the class names, because these namespase protect these class names themselves. Otherwise, if i use the
namespace such as QT_BEGIN_NAMESPACE - it is wise to rename the class name, ie added Q prefix.
Please help me in this matter, because these responses, I have not found in:
http://wiki.qt-project.org/Creating_a_new_module_or_tool_for_Qt
Best regards,
Denis
More information about the Development
mailing list