File indexing completed on 2024-05-12 04:39:09
0001 /* 0002 SPDX-FileCopyrightText: 2007 David Nolden <david.nolden.kdevelop@art-master.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #ifndef CODEGENHELPER_H 0008 #define CODEGENHELPER_H 0009 0010 #include <language/duchain/declaration.h> 0011 #include <language/duchain/identifier.h> 0012 #include <language/duchain/types/abstracttype.h> 0013 0014 struct Signature; 0015 0016 namespace CodegenHelper { 0017 ///Returns the type that should be used for shortened printing of the same. 0018 KDevelop::AbstractType::Ptr typeForShortenedString(KDevelop::Declaration* decl); 0019 ///Returns a shortened string version of the type attached to the given declaration. 0020 ///@param desiredLength the desired length. No guarantee that the resulting string will be this short. With the default-value, no shortening will happen in most cases. 0021 ///@param ctx visibility context to consider. All prefixes of types are shortened to the minimum length while staying visible from here 0022 ///@param stripPrefix this prefix will be stripped from qualified identifiers. This is useful to remove parts of the current context. 0023 QString shortenedTypeString(KDevelop::Declaration* decl, KDevelop::DUContext* ctx, int desiredLength = 10000, 0024 const KDevelop::QualifiedIdentifier& stripPrefix = {}); 0025 QString shortenedTypeString(const KDevelop::AbstractType::Ptr& type, KDevelop::DUContext* ctx, int desiredLength = 10000, 0026 const KDevelop::QualifiedIdentifier& stripPrefix = {}); 0027 KDevelop::IndexedTypeIdentifier shortenedTypeIdentifier(const KDevelop::AbstractType::Ptr& type, KDevelop::DUContext* ctx, int desiredLength = 10000, 0028 const KDevelop::QualifiedIdentifier& stripPrefix = {}); 0029 0030 ///Returns a simplified string version of the given type: Template default-parameters are stripped away, qualified identifiers are simplified so they are as short as possible, while staying visible from the given context. 0031 QString simplifiedTypeString(const KDevelop::AbstractType::Ptr& type, KDevelop::DUContext* visibilityFrom); 0032 0033 QString makeSignatureString(const KDevelop::Declaration* functionDecl, const Signature& signature, const bool editingDefinition); 0034 } 0035 0036 #endif // CODEGENHELPER_H