| 35 | using namespace KTextEditor; |
| 36 | |
| 37 | CodeCompletionModel::CompletionProperties DUChainUtils::completionProperties(const Declaration* dec) |
| 38 | { |
| 39 | CodeCompletionModel::CompletionProperties p; |
| 40 | |
| 41 | if(dec->context()->type() == DUContext::Class) { |
| 42 | if (const auto* member = dynamic_cast<const ClassMemberDeclaration*>(dec)) { |
| 43 | switch (member->accessPolicy()) { |
| 44 | case Declaration::Public: |
| 45 | p |= CodeCompletionModel::Public; |
| 46 | break; |
| 47 | case Declaration::Protected: |
| 48 | p |= CodeCompletionModel::Protected; |
| 49 | break; |
| 50 | case Declaration::Private: |
| 51 | p |= CodeCompletionModel::Private; |
| 52 | break; |
| 53 | default: |
| 54 | break; |
| 55 | } |
| 56 | |
| 57 | if (member->isStatic()) |
| 58 | p |= CodeCompletionModel::Static; |
| 59 | if (member->isAuto()) |
| 60 | {}//TODO |
| 61 | if (member->isFriend()) |
| 62 | p |= CodeCompletionModel::Friend; |
| 63 | if (member->isRegister()) |
| 64 | {}//TODO |
| 65 | if (member->isExtern()) |
| 66 | {}//TODO |
| 67 | if (member->isMutable()) |
| 68 | {}//TODO |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | if (const auto* function = dynamic_cast<const AbstractFunctionDeclaration*>(dec)) { |
| 73 | p |= CodeCompletionModel::Function; |
| 74 | if (function->isVirtual()) |
| 75 | p |= CodeCompletionModel::Virtual; |
| 76 | if (function->isInline()) |
| 77 | p |= CodeCompletionModel::Inline; |
| 78 | if (function->isExplicit()) |
| 79 | {}//TODO |
| 80 | } |
| 81 | |
| 82 | if( dec->isTypeAlias() ) |
| 83 | p |= CodeCompletionModel::TypeAlias; |
| 84 | |
| 85 | if (dec->abstractType()) { |
| 86 | switch (dec->abstractType()->whichType()) { |
| 87 | case AbstractType::TypeIntegral: |
| 88 | p |= CodeCompletionModel::Variable; |
| 89 | break; |
| 90 | case AbstractType::TypePointer: |
| 91 | p |= CodeCompletionModel::Variable; |
| 92 | break; |
| 93 | case AbstractType::TypeReference: |
| 94 | p |= CodeCompletionModel::Variable; |
nothing calls this directly
no test coverage detected