Clang: Flatten code completion chunks

Avoid the sub vector for performance reason and use an flag for every
optional argument because there can be no recursion.

Change-Id: Iae1eaa1f164e4129e30358a1719582e5231f0385
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Marco Bubke
2015-12-11 11:45:05 +01:00
parent 466fa9636e
commit 8d6c10b241
8 changed files with 101 additions and 97 deletions

View File

@@ -49,7 +49,7 @@ class CMBIPC_EXPORT CodeCompletionChunk
friend CMBIPC_EXPORT bool operator==(const CodeCompletionChunk &first, const CodeCompletionChunk &second);
public:
enum Kind : quint32 {
enum Kind : quint8 {
Optional,
TypedText,
Text,
@@ -71,25 +71,25 @@ public:
Equal,
HorizontalSpace,
VerticalSpace,
Invalid = 255};
Invalid = 255
};
CodeCompletionChunk();
CodeCompletionChunk() = default;
CodeCompletionChunk(Kind kind,
const Utf8String &text,
const CodeCompletionChunks &optionalChunks = CodeCompletionChunks());
bool isOptional = false);
Kind kind() const;
const Utf8String &text() const;
const CodeCompletionChunks &optionalChunks() const;
bool isOptional() const;
private:
quint32 &kindAsInt();
quint8 &kindAsInt();
private:
Utf8String text_;
CodeCompletionChunks optionalChunks_;
Kind kind_ = Invalid;
bool isOptional_ = false;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletionChunk &chunk);