language/duchain
codemodel.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CODEMODEL_H
00020 #define CODEMODEL_H
00021
00022 #include "identifier.h"
00023
00024 namespace KDevelop {
00025
00026 class Declaration;
00027 class IndexedDeclaration;
00028 class DeclarationId;
00029 class TopDUContext;
00030 class QualifiedIdentifier;
00031 class IndexedString;
00032
00033
00034 struct CodeModelItem {
00035 CodeModelItem() : referenceCount(0), kind(Unknown) {
00036 }
00037 enum Kind {
00038 Unknown = 0,
00039 Function = 1,
00040 Variable = 2,
00041 Class = 4,
00042 ForwardDeclaration = 8,
00043 Namespace = 16
00044 };
00045 IndexedQualifiedIdentifier id;
00046 uint referenceCount;
00047 union {
00048 Kind kind;
00049 uint uKind;
00050 };
00051 bool operator<(const CodeModelItem& rhs) const {
00052 return id < rhs.id;
00053 }
00054 };
00055
00059 class KDEVPLATFORMLANGUAGE_EXPORT CodeModel {
00060 public:
00062 CodeModel();
00064 ~CodeModel();
00065
00068 void addItem(const IndexedString& file, const IndexedQualifiedIdentifier& id, CodeModelItem::Kind kind);
00069
00070 void removeItem(const IndexedString& file, const IndexedQualifiedIdentifier& id);
00071
00073 void updateItem(const IndexedString& file, const IndexedQualifiedIdentifier& id, CodeModelItem::Kind kind);
00074
00080 void items(const IndexedString& file, uint& count, const CodeModelItem*& items) const;
00081
00082 static CodeModel& self();
00083
00084 private:
00085 class CodeModelPrivate* d;
00086 };
00087 }
00088
00089 #endif