Rename example parameter to better reflect its role
The Q_GLOBAL_STATIC docs repeatedly used MyType as the name for an illustrative type but staticType as the name for the variable of that type. While this was surely meant to mean "static of MyType" it made it sound like it was the name of a type. So rename it myGlobal. Pick-to: 6.5 6.2 5.15 Task-number: QTBUG-130613 Change-Id: Ia1bb1dbdb27e45ea84daad5bd5ec77313a53236f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 60962e7a9cd765ac114de3c2eeee4ca2a7a6d21a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b11f2ccc5b
commit
87b6540a08
@ -21,7 +21,7 @@
|
||||
outside of any function bodies):
|
||||
|
||||
\code
|
||||
Q_GLOBAL_STATIC(MyType, staticType)
|
||||
Q_GLOBAL_STATIC(MyType, myGlobal)
|
||||
\endcode
|
||||
|
||||
This macro is intended to replace global static objects that are not POD
|
||||
@ -29,7 +29,7 @@
|
||||
name. For example, the following C++ code creates a global static:
|
||||
|
||||
\code
|
||||
static MyType staticType;
|
||||
static MyType myGlobal;
|
||||
\endcode
|
||||
|
||||
Compared to Q_GLOBAL_STATIC, and assuming that \c MyType is a class or
|
||||
@ -75,7 +75,7 @@
|
||||
|
||||
\code
|
||||
class MyType : public MyOtherType { };
|
||||
Q_GLOBAL_STATIC(MyType, staticType)
|
||||
Q_GLOBAL_STATIC(MyType, myGlobal)
|
||||
\endcode
|
||||
|
||||
No body for \c MyType is required since the destructor is an implicit
|
||||
@ -89,7 +89,7 @@
|
||||
public:
|
||||
MyType(int i) : MyOtherType(i) {}
|
||||
};
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(MyType, staticType, (42))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(MyType, myGlobal, (42))
|
||||
\endcode
|
||||
|
||||
Alternatively, if the compiler supports C++11 inheriting constructors, one could write:
|
||||
@ -100,7 +100,7 @@
|
||||
public:
|
||||
using MyOtherType::MyOtherType;
|
||||
};
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(MyType, staticType, (42))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(MyType, myGlobal, (42))
|
||||
\endcode
|
||||
|
||||
\section1 Placement
|
||||
@ -270,7 +270,7 @@
|
||||
outside of any function bodies):
|
||||
|
||||
\code
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(MyType, staticType, (42, "Hello", "World"))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(MyType, myGlobal, (42, "Hello", "World"))
|
||||
\endcode
|
||||
|
||||
The \a Arguments macro parameter must always include the parentheses or, if
|
||||
@ -278,7 +278,7 @@
|
||||
equivalent to
|
||||
|
||||
\code
|
||||
Q_GLOBAL_STATIC(MyType, staticType, 42, "Hello", "World")
|
||||
Q_GLOBAL_STATIC(MyType, myGlobal, 42, "Hello", "World")
|
||||
\endcode
|
||||
|
||||
Aside from the actual initialization of the contents with the supplied
|
||||
@ -304,11 +304,11 @@
|
||||
follows:
|
||||
|
||||
\code
|
||||
Q_GLOBAL_STATIC(MyType, staticType)
|
||||
Q_GLOBAL_STATIC(MyType, myGlobal)
|
||||
\endcode
|
||||
|
||||
The above example creates an object of type QGlobalStatic called \c
|
||||
staticType. After the above declaration, the \c staticType object may be
|
||||
myGlobal. After the above declaration, the \c myGlobal object may be used as
|
||||
used as if it were a pointer, guaranteed to be initialized exactly once. In
|
||||
addition to the use as a pointer, the object offers two methods to
|
||||
determine the current status of the global: exists() and isDestroyed().
|
||||
|
Loading…
x
Reference in New Issue
Block a user