diff options
author | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2013-01-10 17:11:03 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2013-01-23 14:30:39 +0100 |
commit | 8c3794f9d104a39b7f91764b7725dad8726fbde0 (patch) | |
tree | 0b370c80468fbf185b99cf9a3f4e452ff171d6b3 /src/libs/cplusplus/Overview.h | |
parent | b6a9d58f690834c7629762a21e520f72a282d2a8 (diff) | |
download | qt-creator-8c3794f9d104a39b7f91764b7725dad8726fbde0.tar.gz |
C++: Add star binding to TypePrettyPrinter
Now we can specify if we want to print a whitespace before and/or after
'*'/'&' when printing pointer and reference types.
Task-number: QTCREATORBUG-6169
Change-Id: Ida1b035aa4fd79be9108934b75f236db9f7238af
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/libs/cplusplus/Overview.h')
-rw-r--r-- | src/libs/cplusplus/Overview.h | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/src/libs/cplusplus/Overview.h b/src/libs/cplusplus/Overview.h index 344c976f99..339a6d8fc7 100644 --- a/src/libs/cplusplus/Overview.h +++ b/src/libs/cplusplus/Overview.h @@ -37,6 +37,16 @@ namespace CPlusPlus { +/*! + \class Overview + + \brief Converts a FullySpecifiedType and/or any qualified name, + to its string representation. + + The public data members (except the ones starting with "marked") + determine what exactly and how to print. + */ + class CPLUSPLUS_EXPORT Overview { Overview(const Overview &other); @@ -60,14 +70,57 @@ public: QString prettyType(const FullySpecifiedType &type, const QString &name) const; public: - unsigned markedArgument; - int markedArgumentBegin; - int markedArgumentEnd; + /*! + \enum Overview::StarBindFlag + + The StarBindFlags describe how the '*' and '&' in pointers/references + should be bound in the string representation. + + This also applies to rvalue references ('&&'), but not to + pointers to functions or arrays like in + + void (*p)() + void (*p)[] + + since it seems to be quite uncommon to use spaces there. + + See the examples below. These assume that exactly one + flag is set. That is, it may look different with + flag combinations. + + \value BindToIdentifier + e.g. "char *foo", but not "char * foo" + \value BindToTypeName + e.g. "char*", but not "char *" + \value BindToLeftSpecifier + e.g. "char * const* const", but not "char * const * const" + \value BindToRightSpecifier + e.g. "char *const", but not "char * const" + */ + enum StarBindFlag { + BindToIdentifier = 0x1, + BindToTypeName = 0x2, + BindToLeftSpecifier = 0x4, + BindToRightSpecifier = 0x8 + }; + Q_DECLARE_FLAGS(StarBindFlags, StarBindFlag) + + StarBindFlags starBindFlags; bool showArgumentNames: 1; bool showReturnTypes: 1; bool showFunctionSignatures: 1; bool showDefaultArguments: 1; bool showTemplateParameters: 1; + + /*! + You can get the start and end position of a function argument + in the resulting string. Set "markedArgument" to the desired + argument. After processing, "markedArgumentBegin" and + "markedArgumentEnd" will contain the positions. + */ + unsigned markedArgument; + int markedArgumentBegin; + int markedArgumentEnd; }; } // namespace CPlusPlus |