File indexing completed on 2024-05-12 04:37:48
0001 /* 0002 SPDX-FileCopyrightText: 2009 Ramón Zarazúa <killerfox512+kde@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #ifndef KDEVPLATFORM_CODEGEN_UTILITIES_H 0008 #define KDEVPLATFORM_CODEGEN_UTILITIES_H 0009 0010 #include <language/languageexport.h> 0011 0012 #include <QValidator> 0013 0014 namespace KDevelop { 0015 class IndexedString; 0016 class DUContext; 0017 class Declaration; 0018 0019 namespace CodeGenUtils { 0020 /*! 0021 * A validator object that verifies if a string would be an acceptable identifier 0022 * If inserted into the given context, including if it conflicts with any other identifier 0023 */ 0024 class KDEVPLATFORMLANGUAGE_EXPORT IdentifierValidator 0025 : public QValidator 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 explicit IdentifierValidator(DUContext* context); 0031 ~IdentifierValidator() override; 0032 0033 State validate(QString& input, int&) const override; 0034 0035 private: 0036 0037 DUContext* m_context; 0038 }; 0039 0040 /** 0041 * @brief Search for the file that contains the implementation of a specified type 0042 * 0043 * Search for the file that contains the implementation of @p targetClass. For languages that 0044 * allow implementation of a type through multiple files, the file with the most implementations of 0045 * class methods will be chosen, if a tie is found, then the file with the most uses will be chosen. 0046 * Else the file that contains the declaration is chosen. 0047 * 0048 * @note If called with a Forward declaration, the real declaration will be searched for. 0049 * 0050 * @return The file that matched best 0051 */ 0052 KDEVPLATFORMLANGUAGE_EXPORT IndexedString 0053 fetchImplementationFileForClass(const Declaration& targetClass); 0054 } 0055 } 0056 0057 #endif //KDEVPLATFORM_CODEGEN_UTILITIES_H