1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2018 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of Qt Creator. 7 ** 8 ** Commercial License Usage 9 ** Licensees holding valid commercial Qt licenses may use this file in 10 ** accordance with the commercial license agreement provided with the 11 ** Software or, alternatively, in accordance with the terms contained in 12 ** a written agreement between you and The Qt Company. For licensing terms 13 ** and conditions see https://www.qt.io/terms-conditions. For further 14 ** information use the contact form at https://www.qt.io/contact-us. 15 ** 16 ** GNU General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU 18 ** General Public License version 3 as published by the Free Software 19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 20 ** included in the packaging of this file. Please review the following 21 ** information to ensure the GNU General Public License requirements will 22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 23 ** 24 ****************************************************************************/ 25 26 #pragma once 27 28 #include <utf8string.h> 29 #include <utf8stringvector.h> 30 31 #include <QVariant> 32 33 #include "clangsupport_global.h" 34 35 namespace ClangBackEnd { 36 37 class ToolTipInfo 38 { 39 public: 40 enum QdocCategory : quint8 { 41 Unknown, 42 ClassOrNamespace, 43 Enum, 44 Typedef, 45 Macro, 46 Brief, 47 Function, 48 }; 49 50 public: 51 ToolTipInfo() = default; ToolTipInfo(const Utf8String & text)52 ToolTipInfo(const Utf8String &text) : text(text) {} 53 54 friend QDataStream &operator<<(QDataStream &out, const ToolTipInfo &message) 55 { 56 out << message.text; 57 out << message.briefComment; 58 out << message.qdocIdCandidates; 59 out << message.qdocMark; 60 out << static_cast<quint8>(message.qdocCategory); 61 out << message.value; 62 out << message.sizeInBytes; 63 64 return out; 65 } 66 67 friend QDataStream &operator>>(QDataStream &in, ToolTipInfo &message) 68 { 69 quint8 qdocCategory; 70 71 in >> message.text; 72 in >> message.briefComment; 73 in >> message.qdocIdCandidates; 74 in >> message.qdocMark; 75 in >> qdocCategory; 76 in >> message.value; 77 in >> message.sizeInBytes; 78 79 message.qdocCategory = static_cast<QdocCategory>(qdocCategory); 80 81 return in; 82 } 83 84 friend bool operator==(const ToolTipInfo &first, const ToolTipInfo &second) 85 { 86 return first.text == second.text 87 && first.briefComment == second.briefComment 88 && first.qdocIdCandidates == second.qdocIdCandidates 89 && first.qdocMark == second.qdocMark 90 && first.qdocCategory == second.qdocCategory 91 && first.value == second.value 92 && first.sizeInBytes == second.sizeInBytes; 93 } 94 95 public: 96 Utf8String text; 97 Utf8String briefComment; 98 99 Utf8StringVector qdocIdCandidates; 100 Utf8String qdocMark; 101 QdocCategory qdocCategory = Unknown; 102 QVariant value; 103 104 // For class definition and for class fields. 105 Utf8String sizeInBytes; 106 }; 107 108 QDebug operator<<(QDebug debug, const ToolTipInfo &message); 109 std::ostream &operator<<(std::ostream &os, const ToolTipInfo &message); 110 111 CLANGSUPPORT_EXPORT const char *qdocCategoryToString(ToolTipInfo::QdocCategory category); 112 113 } // namespace ClangBackEnd 114