diff options
author | Marco Bubke <marco.bubke@theqtcompany.com> | 2015-05-13 13:35:52 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2015-05-21 10:07:43 +0000 |
commit | c5a0e257884c1d9f26f7242692be46871bbfad6b (patch) | |
tree | e665793a05fa63e8fd6e2848bd8f51edf5ec71de | |
parent | b056d4ef7a56ce31750f6fd552a1983954a389d8 (diff) | |
download | qt-creator-c5a0e257884c1d9f26f7242692be46871bbfad6b.tar.gz |
improve naming
Change-Id: Idc81457549660ed23b5de1b7355b63c7450ee019
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
61 files changed, 686 insertions, 694 deletions
diff --git a/src/libs/codemodelbackendipc/source/cmbcommands.cpp b/src/libs/codemodelbackendipc/source/cmbcommands.cpp index cd292d807d..0edc3630d3 100644 --- a/src/libs/codemodelbackendipc/source/cmbcommands.cpp +++ b/src/libs/codemodelbackendipc/source/cmbcommands.cpp @@ -39,8 +39,8 @@ #include "cmbunregisterprojectsforcodecompletioncommand.h" #include "cmbcompletecodecommand.h" #include "cmbcodecompletedcommand.h" -#include "projectdoesnotexistscommand.h" -#include "translationunitdoesnotexistscommand.h" +#include "projectpartsdonotexistcommand.h" +#include "translationunitdoesnotexistcommand.h" #include <QDataStream> @@ -83,25 +83,25 @@ void Commands::registerCommands() qRegisterMetaTypeStreamOperators<CodeCompletedCommand>(); QMetaType::registerComparators<CodeCompletedCommand>(); - qRegisterMetaType<RegisterProjectsForCodeCompletionCommand>(); - qRegisterMetaTypeStreamOperators<RegisterProjectsForCodeCompletionCommand>(); - QMetaType::registerComparators<RegisterProjectsForCodeCompletionCommand>(); + qRegisterMetaType<RegisterProjectPartsForCodeCompletionCommand>(); + qRegisterMetaTypeStreamOperators<RegisterProjectPartsForCodeCompletionCommand>(); + QMetaType::registerComparators<RegisterProjectPartsForCodeCompletionCommand>(); - qRegisterMetaType<ProjectContainer>(); - qRegisterMetaTypeStreamOperators<ProjectContainer>(); - QMetaType::registerComparators<ProjectContainer>(); + qRegisterMetaType<ProjectPartContainer>(); + qRegisterMetaTypeStreamOperators<ProjectPartContainer>(); + QMetaType::registerComparators<ProjectPartContainer>(); - qRegisterMetaType<UnregisterProjectsForCodeCompletionCommand>(); - qRegisterMetaTypeStreamOperators<UnregisterProjectsForCodeCompletionCommand>(); - QMetaType::registerComparators<UnregisterProjectsForCodeCompletionCommand>(); + qRegisterMetaType<UnregisterProjectPartsForCodeCompletionCommand>(); + qRegisterMetaTypeStreamOperators<UnregisterProjectPartsForCodeCompletionCommand>(); + QMetaType::registerComparators<UnregisterProjectPartsForCodeCompletionCommand>(); qRegisterMetaType<TranslationUnitDoesNotExistCommand>(); qRegisterMetaTypeStreamOperators<TranslationUnitDoesNotExistCommand>(); QMetaType::registerComparators<TranslationUnitDoesNotExistCommand>(); - qRegisterMetaType<ProjectDoesNotExistCommand>(); - qRegisterMetaTypeStreamOperators<ProjectDoesNotExistCommand>(); - QMetaType::registerComparators<ProjectDoesNotExistCommand>(); + qRegisterMetaType<ProjectPartsDoNotExistCommand>(); + qRegisterMetaTypeStreamOperators<ProjectPartsDoNotExistCommand>(); + QMetaType::registerComparators<ProjectPartsDoNotExistCommand>(); } } // namespace CodeModelBackEnd diff --git a/src/libs/codemodelbackendipc/source/cmbcompletecodecommand.cpp b/src/libs/codemodelbackendipc/source/cmbcompletecodecommand.cpp index d141c0b629..77a424ca42 100644 --- a/src/libs/codemodelbackendipc/source/cmbcompletecodecommand.cpp +++ b/src/libs/codemodelbackendipc/source/cmbcompletecodecommand.cpp @@ -38,9 +38,9 @@ namespace CodeModelBackEnd { quint64 CompleteCodeCommand::ticketCounter = 0; -CompleteCodeCommand::CompleteCodeCommand(const Utf8String &filePath, quint32 line, quint32 column, const Utf8String &projectFilePath) +CompleteCodeCommand::CompleteCodeCommand(const Utf8String &filePath, quint32 line, quint32 column, const Utf8String &projectPartId) : filePath_(filePath), - projectFilePath_(projectFilePath), + projectPartId_(projectPartId), ticketNumber_(++ticketCounter), line_(line), column_(column) @@ -52,9 +52,9 @@ const Utf8String &CompleteCodeCommand::filePath() const return filePath_; } -const Utf8String &CompleteCodeCommand::projectFilePath() const +const Utf8String &CompleteCodeCommand::projectPartId() const { - return projectFilePath_; + return projectPartId_; } quint32 CompleteCodeCommand::line() const @@ -75,7 +75,7 @@ quint64 CompleteCodeCommand::ticketNumber() const QDataStream &operator<<(QDataStream &out, const CompleteCodeCommand &command) { out << command.filePath_; - out << command.projectFilePath_; + out << command.projectPartId_; out << command.ticketNumber_; out << command.line_; out << command.column_; @@ -86,7 +86,7 @@ QDataStream &operator<<(QDataStream &out, const CompleteCodeCommand &command) QDataStream &operator>>(QDataStream &in, CompleteCodeCommand &command) { in >> command.filePath_; - in >> command.projectFilePath_; + in >> command.projectPartId_; in >> command.ticketNumber_; in >> command.line_; in >> command.column_; @@ -98,7 +98,7 @@ bool operator == (const CompleteCodeCommand &first, const CompleteCodeCommand &s { return first.ticketNumber_ == second.ticketNumber_ && first.filePath_ == second.filePath_ - && first.projectFilePath_ == second.projectFilePath_ + && first.projectPartId_ == second.projectPartId_ && first.line_ == second.line_ && first.column_ == second.column_; } @@ -107,7 +107,7 @@ bool operator < (const CompleteCodeCommand &first, const CompleteCodeCommand &se { return first.ticketNumber_ < second.ticketNumber_ && first.filePath_ < second.filePath_ - && first.projectFilePath_ < second.projectFilePath_ + && first.projectPartId_ < second.projectPartId_ && first.line_ < second.line_ && first.column_ < second.column_; } @@ -119,7 +119,7 @@ QDebug operator <<(QDebug debug, const CompleteCodeCommand &command) debug.nospace() << command.filePath_ << ", "; debug.nospace() << command.line_<< ", "; debug.nospace() << command.column_<< ", "; - debug.nospace() << command.projectFilePath_ << ", "; + debug.nospace() << command.projectPartId_ << ", "; debug.nospace() << command.ticketNumber_; debug.nospace() << ")"; @@ -134,7 +134,7 @@ void PrintTo(const CompleteCodeCommand &command, ::std::ostream* os) *os << command.filePath_.constData() << ", "; *os << command.line_ << ", "; *os << command.column_ << ", "; - *os << command.projectFilePath_.constData() << ", "; + *os << command.projectPartId_.constData() << ", "; *os << command.ticketNumber_; *os << ")"; diff --git a/src/libs/codemodelbackendipc/source/cmbcompletecodecommand.h b/src/libs/codemodelbackendipc/source/cmbcompletecodecommand.h index b600c1f400..7cb30ccca9 100644 --- a/src/libs/codemodelbackendipc/source/cmbcompletecodecommand.h +++ b/src/libs/codemodelbackendipc/source/cmbcompletecodecommand.h @@ -52,10 +52,10 @@ public: CompleteCodeCommand(const Utf8String &filePath, quint32 line, quint32 column, - const Utf8String &projectFilePath); + const Utf8String &projectPartId); const Utf8String &filePath() const; - const Utf8String &projectFilePath() const; + const Utf8String &projectPartId() const; quint32 line() const; quint32 column() const; @@ -64,7 +64,7 @@ public: private: Utf8String filePath_; - Utf8String projectFilePath_; + Utf8String projectPartId_; static quint64 ticketCounter; quint64 ticketNumber_; quint32 line_ = 0; diff --git a/src/libs/codemodelbackendipc/source/cmbregisterprojectsforcodecompletioncommand.cpp b/src/libs/codemodelbackendipc/source/cmbregisterprojectsforcodecompletioncommand.cpp index 2327f0c901..8ec3d19db3 100644 --- a/src/libs/codemodelbackendipc/source/cmbregisterprojectsforcodecompletioncommand.cpp +++ b/src/libs/codemodelbackendipc/source/cmbregisterprojectsforcodecompletioncommand.cpp @@ -36,45 +36,45 @@ namespace CodeModelBackEnd { -RegisterProjectsForCodeCompletionCommand::RegisterProjectsForCodeCompletionCommand(const QVector<ProjectContainer> &projectContainers) +RegisterProjectPartsForCodeCompletionCommand::RegisterProjectPartsForCodeCompletionCommand(const QVector<ProjectPartContainer> &projectContainers) :projectContainers_(projectContainers) { } -const QVector<ProjectContainer> &RegisterProjectsForCodeCompletionCommand::projectContainers() const +const QVector<ProjectPartContainer> &RegisterProjectPartsForCodeCompletionCommand::projectContainers() const { return projectContainers_; } -QDataStream &operator<<(QDataStream &out, const RegisterProjectsForCodeCompletionCommand &command) +QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForCodeCompletionCommand &command) { out << command.projectContainers_; return out; } -QDataStream &operator>>(QDataStream &in, RegisterProjectsForCodeCompletionCommand &command) +QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForCodeCompletionCommand &command) { in >> command.projectContainers_; return in; } -bool operator == (const RegisterProjectsForCodeCompletionCommand &first, const RegisterProjectsForCodeCompletionCommand &second) +bool operator == (const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second) { return first.projectContainers_ == second.projectContainers_; } -bool operator < (const RegisterProjectsForCodeCompletionCommand &first, const RegisterProjectsForCodeCompletionCommand &second) +bool operator < (const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second) { return first.projectContainers_ < second.projectContainers_; } -QDebug operator <<(QDebug debug, const RegisterProjectsForCodeCompletionCommand &command) +QDebug operator <<(QDebug debug, const RegisterProjectPartsForCodeCompletionCommand &command) { - debug.nospace() << "RegisterProjectsForCodeCompletion("; + debug.nospace() << "RegisterProjectPartsForCodeCompletion("; - for (const ProjectContainer &projectContainer : command.projectContainers()) + for (const ProjectPartContainer &projectContainer : command.projectContainers()) debug.nospace() << projectContainer<< ", "; debug.nospace() << ")"; @@ -82,11 +82,11 @@ QDebug operator <<(QDebug debug, const RegisterProjectsForCodeCompletionCommand return debug; } -void PrintTo(const RegisterProjectsForCodeCompletionCommand &command, ::std::ostream* os) +void PrintTo(const RegisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os) { - *os << "RegisterProjectsForCodeCompletion("; + *os << "RegisterProjectPartsForCodeCompletion("; - for (const ProjectContainer &projectContainer : command.projectContainers()) + for (const ProjectPartContainer &projectContainer : command.projectContainers()) PrintTo(projectContainer, os); *os << ")"; diff --git a/src/libs/codemodelbackendipc/source/cmbregisterprojectsforcodecompletioncommand.h b/src/libs/codemodelbackendipc/source/cmbregisterprojectsforcodecompletioncommand.h index 7d5a88f4dc..d1ffa784a5 100644 --- a/src/libs/codemodelbackendipc/source/cmbregisterprojectsforcodecompletioncommand.h +++ b/src/libs/codemodelbackendipc/source/cmbregisterprojectsforcodecompletioncommand.h @@ -34,36 +34,36 @@ #include <QMetaType> #include <QVector> -#include "projectcontainer.h" +#include "projectpartcontainer.h" namespace CodeModelBackEnd { -class CMBIPC_EXPORT RegisterProjectsForCodeCompletionCommand +class CMBIPC_EXPORT RegisterProjectPartsForCodeCompletionCommand { - friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectsForCodeCompletionCommand &command); - friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectsForCodeCompletionCommand &command); - friend CMBIPC_EXPORT bool operator == (const RegisterProjectsForCodeCompletionCommand &first, const RegisterProjectsForCodeCompletionCommand &second); - friend CMBIPC_EXPORT bool operator < (const RegisterProjectsForCodeCompletionCommand &first, const RegisterProjectsForCodeCompletionCommand &second); - friend void PrintTo(const RegisterProjectsForCodeCompletionCommand &command, ::std::ostream* os); + friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForCodeCompletionCommand &command); + friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForCodeCompletionCommand &command); + friend CMBIPC_EXPORT bool operator == (const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second); + friend CMBIPC_EXPORT bool operator < (const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second); + friend void PrintTo(const RegisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os); public: - RegisterProjectsForCodeCompletionCommand() = default; - RegisterProjectsForCodeCompletionCommand(const QVector<ProjectContainer> &projectContainers); + RegisterProjectPartsForCodeCompletionCommand() = default; + RegisterProjectPartsForCodeCompletionCommand(const QVector<ProjectPartContainer> &projectContainers); - const QVector<ProjectContainer> &projectContainers() const; + const QVector<ProjectPartContainer> &projectContainers() const; private: - QVector<ProjectContainer> projectContainers_; + QVector<ProjectPartContainer> projectContainers_; }; -CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectsForCodeCompletionCommand &command); -CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectsForCodeCompletionCommand &command); -CMBIPC_EXPORT bool operator == (const RegisterProjectsForCodeCompletionCommand &first, const RegisterProjectsForCodeCompletionCommand &second); -CMBIPC_EXPORT bool operator < (const RegisterProjectsForCodeCompletionCommand &first, const RegisterProjectsForCodeCompletionCommand &second); +CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForCodeCompletionCommand &command); +CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForCodeCompletionCommand &command); +CMBIPC_EXPORT bool operator == (const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second); +CMBIPC_EXPORT bool operator < (const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second); -CMBIPC_EXPORT QDebug operator <<(QDebug debug, const RegisterProjectsForCodeCompletionCommand &command); -void PrintTo(const RegisterProjectsForCodeCompletionCommand &command, ::std::ostream* os); +CMBIPC_EXPORT QDebug operator <<(QDebug debug, const RegisterProjectPartsForCodeCompletionCommand &command); +void PrintTo(const RegisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os); } // namespace CodeModelBackEnd -Q_DECLARE_METATYPE(CodeModelBackEnd::RegisterProjectsForCodeCompletionCommand) +Q_DECLARE_METATYPE(CodeModelBackEnd::RegisterProjectPartsForCodeCompletionCommand) #endif // CODEMODELBACKEND_REGISTERPROJECTSFORCODECOMPLETIONCOMAND_H diff --git a/src/libs/codemodelbackendipc/source/cmbunregisterprojectsforcodecompletioncommand.cpp b/src/libs/codemodelbackendipc/source/cmbunregisterprojectsforcodecompletioncommand.cpp index 57ba6d31a3..c17c9d5ab9 100644 --- a/src/libs/codemodelbackendipc/source/cmbunregisterprojectsforcodecompletioncommand.cpp +++ b/src/libs/codemodelbackendipc/source/cmbunregisterprojectsforcodecompletioncommand.cpp @@ -37,43 +37,43 @@ namespace CodeModelBackEnd { -UnregisterProjectsForCodeCompletionCommand::UnregisterProjectsForCodeCompletionCommand(const Utf8StringVector &filePaths) +UnregisterProjectPartsForCodeCompletionCommand::UnregisterProjectPartsForCodeCompletionCommand(const Utf8StringVector &filePaths) : filePaths_(filePaths) { } -const Utf8StringVector &UnregisterProjectsForCodeCompletionCommand::filePaths() const +const Utf8StringVector &UnregisterProjectPartsForCodeCompletionCommand::filePaths() const { return filePaths_; } -QDataStream &operator<<(QDataStream &out, const UnregisterProjectsForCodeCompletionCommand &command) +QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForCodeCompletionCommand &command) { out << command.filePaths_; return out; } -QDataStream &operator>>(QDataStream &in, UnregisterProjectsForCodeCompletionCommand &command) +QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForCodeCompletionCommand &command) { in >> command.filePaths_; return in; } -bool operator == (const UnregisterProjectsForCodeCompletionCommand &first, const UnregisterProjectsForCodeCompletionCommand &second) +bool operator == (const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second) { return first.filePaths_ == second.filePaths_; } -bool operator < (const UnregisterProjectsForCodeCompletionCommand &first, const UnregisterProjectsForCodeCompletionCommand &second) +bool operator < (const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second) { return first.filePaths_ < second.filePaths_; } -QDebug operator <<(QDebug debug, const UnregisterProjectsForCodeCompletionCommand &command) +QDebug operator <<(QDebug debug, const UnregisterProjectPartsForCodeCompletionCommand &command) { - debug.nospace() << "UnregisterProjectsForCodeCompletionCommand("; + debug.nospace() << "UnregisterProjectPartsForCodeCompletionCommand("; for (const Utf8String &fileNames_ : command.filePaths()) debug.nospace() << fileNames_ << ", "; @@ -83,9 +83,9 @@ QDebug operator <<(QDebug debug, const UnregisterProjectsForCodeCompletionComman return debug; } -void PrintTo(const UnregisterProjectsForCodeCompletionCommand &command, ::std::ostream* os) +void PrintTo(const UnregisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os) { - *os << "UnregisterProjectsForCodeCompletionCommand("; + *os << "UnregisterProjectPartsForCodeCompletionCommand("; for (const Utf8String &fileNames_ : command.filePaths()) *os << fileNames_.constData() << ", "; diff --git a/src/libs/codemodelbackendipc/source/cmbunregisterprojectsforcodecompletioncommand.h b/src/libs/codemodelbackendipc/source/cmbunregisterprojectsforcodecompletioncommand.h index 3c390ebaa8..0f63bdab89 100644 --- a/src/libs/codemodelbackendipc/source/cmbunregisterprojectsforcodecompletioncommand.h +++ b/src/libs/codemodelbackendipc/source/cmbunregisterprojectsforcodecompletioncommand.h @@ -39,17 +39,17 @@ namespace CodeModelBackEnd { -class CMBIPC_EXPORT UnregisterProjectsForCodeCompletionCommand +class CMBIPC_EXPORT UnregisterProjectPartsForCodeCompletionCommand { - friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectsForCodeCompletionCommand &command); - friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectsForCodeCompletionCommand &command); - friend CMBIPC_EXPORT bool operator == (const UnregisterProjectsForCodeCompletionCommand &first, const UnregisterProjectsForCodeCompletionCommand &second); - friend CMBIPC_EXPORT bool operator < (const UnregisterProjectsForCodeCompletionCommand &first, const UnregisterProjectsForCodeCompletionCommand &second); - friend void PrintTo(const UnregisterProjectsForCodeCompletionCommand &command, ::std::ostream* os); + friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForCodeCompletionCommand &command); + friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForCodeCompletionCommand &command); + friend CMBIPC_EXPORT bool operator == (const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second); + friend CMBIPC_EXPORT bool operator < (const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second); + friend void PrintTo(const UnregisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os); public: - UnregisterProjectsForCodeCompletionCommand() = default; - UnregisterProjectsForCodeCompletionCommand(const Utf8StringVector &filePaths); + UnregisterProjectPartsForCodeCompletionCommand() = default; + UnregisterProjectPartsForCodeCompletionCommand(const Utf8StringVector &filePaths); const Utf8StringVector &filePaths() const; @@ -57,15 +57,15 @@ private: Utf8StringVector filePaths_; }; -CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectsForCodeCompletionCommand &command); -CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectsForCodeCompletionCommand &command); -CMBIPC_EXPORT bool operator == (const UnregisterProjectsForCodeCompletionCommand &first, const UnregisterProjectsForCodeCompletionCommand &second); -CMBIPC_EXPORT bool operator < (const UnregisterProjectsForCodeCompletionCommand &first, const UnregisterProjectsForCodeCompletionCommand &second); +CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForCodeCompletionCommand &command); +CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForCodeCompletionCommand &command); +CMBIPC_EXPORT bool operator == (const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second); +CMBIPC_EXPORT bool operator < (const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second); -CMBIPC_EXPORT QDebug operator <<(QDebug debug, const UnregisterProjectsForCodeCompletionCommand &command); -void PrintTo(const UnregisterProjectsForCodeCompletionCommand &command, ::std::ostream* os); +CMBIPC_EXPORT QDebug operator <<(QDebug debug, const UnregisterProjectPartsForCodeCompletionCommand &command); +void PrintTo(const UnregisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os); } // namespace CodeModelBackEnd -Q_DECLARE_METATYPE(CodeModelBackEnd::UnregisterProjectsForCodeCompletionCommand) +Q_DECLARE_METATYPE(CodeModelBackEnd::UnregisterProjectPartsForCodeCompletionCommand) #endif // CODEMODELBACKEND_UNREGISTERPROJECTSFORCODECOMPLETION_H diff --git a/src/libs/codemodelbackendipc/source/codemodelbackendipc-source.pri b/src/libs/codemodelbackendipc/source/codemodelbackendipc-source.pri index d47d3b7aa6..3db6f7ffa3 100644 --- a/src/libs/codemodelbackendipc/source/codemodelbackendipc-source.pri +++ b/src/libs/codemodelbackendipc/source/codemodelbackendipc-source.pri @@ -1,67 +1,66 @@ #------------------------------------------------- # -# Project created by QtCreator 2014-12-17T12:23:46 +# ProjectPart created by QtCreator 2014-12-17T12:23:46 # #------------------------------------------------- INCLUDEPATH += $$PWD -VPATH += $$PWD -SOURCES += ipcserverinterface.cpp \ - ipcserverproxy.cpp \ - ipcserver.cpp \ - ipcclientinterface.cpp \ - cmbendcommand.cpp \ - cmbalivecommand.cpp \ - ipcclientproxy.cpp \ - cmbcommands.cpp \ - writecommandblock.cpp \ - readcommandblock.cpp \ - ipcinterface.cpp \ - connectionserver.cpp \ - connectionclient.cpp \ - cmbechocommand.cpp \ - ipcclientdispatcher.cpp \ - cmbregistertranslationunitsforcodecompletioncommand.cpp \ - filecontainer.cpp \ - cmbunregistertranslationunitsforcodecompletioncommand.cpp \ - cmbcompletecodecommand.cpp \ - cmbcodecompletedcommand.cpp \ - codecompletion.cpp \ - codemodelbackendipc_global.cpp \ - $$PWD/projectcontainer.cpp \ +SOURCES += $$PWD/ipcserverinterface.cpp \ + $$PWD/ipcserverproxy.cpp \ + $$PWD/ipcserver.cpp \ + $$PWD/ipcclientinterface.cpp \ + $$PWD/cmbendcommand.cpp \ + $$PWD/cmbalivecommand.cpp \ + $$PWD/ipcclientproxy.cpp \ + $$PWD/cmbcommands.cpp \ + $$PWD/writecommandblock.cpp \ + $$PWD/readcommandblock.cpp \ + $$PWD/ipcinterface.cpp \ + $$PWD/connectionserver.cpp \ + $$PWD/connectionclient.cpp \ + $$PWD/cmbechocommand.cpp \ + $$PWD/ipcclientdispatcher.cpp \ + $$PWD/cmbregistertranslationunitsforcodecompletioncommand.cpp \ + $$PWD/filecontainer.cpp \ + $$PWD/cmbunregistertranslationunitsforcodecompletioncommand.cpp \ + $$PWD/cmbcompletecodecommand.cpp \ + $$PWD/cmbcodecompletedcommand.cpp \ + $$PWD/codecompletion.cpp \ + $$PWD/codemodelbackendipc_global.cpp \ $$PWD/cmbregisterprojectsforcodecompletioncommand.cpp \ $$PWD/cmbunregisterprojectsforcodecompletioncommand.cpp \ - translationunitdoesnotexistscommand.cpp \ - $$PWD/projectdoesnotexistscommand.cpp \ - $$PWD/codecompletionchunk.cpp + $$PWD/translationunitdoesnotexistcommand.cpp \ + $$PWD/codecompletionchunk.cpp \ + $$PWD/projectpartcontainer.cpp \ + $$PWD/projectpartsdonotexistcommand.cpp -HEADERS += codemodelbackendipc_global.h \ - ipcserverinterface.h \ - ipcserverproxy.h \ - ipcserver.h \ - ipcclientinterface.h \ - cmbendcommand.h \ - cmbalivecommand.h \ - ipcclientproxy.h \ - cmbcommands.h \ - writecommandblock.h \ - readcommandblock.h \ - ipcinterface.h \ - connectionserver.h \ - connectionclient.h \ - cmbechocommand.h \ - ipcclientdispatcher.h \ - cmbregistertranslationunitsforcodecompletioncommand.h \ - filecontainer.h \ - cmbunregistertranslationunitsforcodecompletioncommand.h \ - cmbcompletecodecommand.h \ - cmbcodecompletedcommand.h \ - codecompletion.h \ - $$PWD/projectcontainer.h \ +HEADERS += $$PWD/codemodelbackendipc_global.h \ + $$PWD/ipcserverinterface.h \ + $$PWD/ipcserverproxy.h \ + $$PWD/ipcserver.h \ + $$PWD/ipcclientinterface.h \ + $$PWD/cmbendcommand.h \ + $$PWD/cmbalivecommand.h \ + $$PWD/ipcclientproxy.h \ + $$PWD/cmbcommands.h \ + $$PWD/writecommandblock.h \ + $$PWD/readcommandblock.h \ + $$PWD/ipcinterface.h \ + $$PWD/connectionserver.h \ + $$PWD/connectionclient.h \ + $$PWD/cmbechocommand.h \ + $$PWD/ipcclientdispatcher.h \ + $$PWD/cmbregistertranslationunitsforcodecompletioncommand.h \ + $$PWD/filecontainer.h \ + $$PWD/cmbunregistertranslationunitsforcodecompletioncommand.h \ + $$PWD/cmbcompletecodecommand.h \ + $$PWD/cmbcodecompletedcommand.h \ + $$PWD/codecompletion.h \ $$PWD/cmbregisterprojectsforcodecompletioncommand.h \ $$PWD/cmbunregisterprojectsforcodecompletioncommand.h \ - translationunitdoesnotexistscommand.h \ - $$PWD/projectdoesnotexistscommand.h \ - $$PWD/codecompletionchunk.h + $$PWD/translationunitdoesnotexistcommand.h \ + $$PWD/codecompletionchunk.h \ + $$PWD/projectpartcontainer.h \ + $$PWD/projectpartsdonotexistcommand.h diff --git a/src/libs/codemodelbackendipc/source/filecontainer.cpp b/src/libs/codemodelbackendipc/source/filecontainer.cpp index 4a71086f3d..907f3eb698 100644 --- a/src/libs/codemodelbackendipc/source/filecontainer.cpp +++ b/src/libs/codemodelbackendipc/source/filecontainer.cpp @@ -37,11 +37,11 @@ namespace CodeModelBackEnd { FileContainer::FileContainer(const Utf8String &fileName, - const Utf8String &projectFilePath, + const Utf8String &projectPartId, const Utf8String &unsavedFileContent, bool hasUnsavedFileContent) : filePath_(fileName), - projectFilePath_(projectFilePath), + projectPartId_(projectPartId), unsavedFileContent_(unsavedFileContent), hasUnsavedFileContent_(hasUnsavedFileContent) { @@ -52,9 +52,9 @@ const Utf8String &FileContainer::filePath() const return filePath_; } -const Utf8String &FileContainer::projectFilePath() const +const Utf8String &FileContainer::projectPartId() const { - return projectFilePath_; + return projectPartId_; } const Utf8String &FileContainer::unsavedFileContent() const @@ -70,7 +70,7 @@ bool FileContainer::hasUnsavedFileContent() const QDataStream &operator<<(QDataStream &out, const FileContainer &container) { out << container.filePath_; - out << container.projectFilePath_; + out << container.projectPartId_; out << container.unsavedFileContent_; out << container.hasUnsavedFileContent_; @@ -80,7 +80,7 @@ QDataStream &operator<<(QDataStream &out, const FileContainer &container) QDataStream &operator>>(QDataStream &in, FileContainer &container) { in >> container.filePath_; - in >> container.projectFilePath_; + in >> container.projectPartId_; in >> container.unsavedFileContent_; in >> container.hasUnsavedFileContent_; @@ -89,13 +89,13 @@ QDataStream &operator>>(QDataStream &in, FileContainer &container) bool operator == (const FileContainer &first, const FileContainer &second) { - return first.filePath_ == second.filePath_ && first.projectFilePath_ == second.projectFilePath_; + return first.filePath_ == second.filePath_ && first.projectPartId_ == second.projectPartId_; } bool operator < (const FileContainer &first, const FileContainer &second) { if (first.filePath_ == second.filePath_) - return first.projectFilePath_ < second.projectFilePath_; + return first.projectPartId_ < second.projectPartId_; return first.filePath_ < second.filePath_; } @@ -105,7 +105,7 @@ QDebug operator <<(QDebug debug, const FileContainer &container) debug.nospace() << "FileContainer(" << container.filePath() << ", " - << container.projectFilePath(); + << container.projectPartId(); if (container.hasUnsavedFileContent()) debug.nospace() << ", " @@ -121,7 +121,7 @@ void PrintTo(const FileContainer &container, ::std::ostream* os) *os << "FileContainer(" << container.filePath().constData() << ", " - << container.projectFilePath().constData(); + << container.projectPartId().constData(); if (container.hasUnsavedFileContent()) *os << ", " diff --git a/src/libs/codemodelbackendipc/source/filecontainer.h b/src/libs/codemodelbackendipc/source/filecontainer.h index bc4150acda..6ead9441f8 100644 --- a/src/libs/codemodelbackendipc/source/filecontainer.h +++ b/src/libs/codemodelbackendipc/source/filecontainer.h @@ -48,18 +48,18 @@ class CMBIPC_EXPORT FileContainer public: FileContainer() = default; FileContainer(const Utf8String &filePath, - const Utf8String &projectFilePath, + const Utf8String &projectPartId, const Utf8String &unsavedFileContent = Utf8String(), bool hasUnsavedFileContent = false); const Utf8String &filePath() const; - const Utf8String &projectFilePath() const; + const Utf8String &projectPartId() const; const Utf8String &unsavedFileContent() const; bool hasUnsavedFileContent() const; private: Utf8String filePath_; - Utf8String projectFilePath_; + Utf8String projectPartId_; Utf8String unsavedFileContent_; bool hasUnsavedFileContent_ = false; }; diff --git a/src/libs/codemodelbackendipc/source/ipcclientdispatcher.cpp b/src/libs/codemodelbackendipc/source/ipcclientdispatcher.cpp index 8d32248ac8..f29d9c5573 100644 --- a/src/libs/codemodelbackendipc/source/ipcclientdispatcher.cpp +++ b/src/libs/codemodelbackendipc/source/ipcclientdispatcher.cpp @@ -68,10 +68,10 @@ void IpcClientDispatcher::translationUnitDoesNotExist(const TranslationUnitDoesN client->translationUnitDoesNotExist(command); } -void IpcClientDispatcher::projectDoesNotExist(const ProjectDoesNotExistCommand &command) +void IpcClientDispatcher::projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command) { for (auto *client : clients) - client->projectDoesNotExist(command); + client->projectPartsDoNotExist(command); } } // namespace CodeModelBackEnd diff --git a/src/libs/codemodelbackendipc/source/ipcclientdispatcher.h b/src/libs/codemodelbackendipc/source/ipcclientdispatcher.h index 731364b842..263341dfbd 100644 --- a/src/libs/codemodelbackendipc/source/ipcclientdispatcher.h +++ b/src/libs/codemodelbackendipc/source/ipcclientdispatcher.h @@ -47,7 +47,7 @@ public: void echo(const EchoCommand &command) override; void codeCompleted(const CodeCompletedCommand &command) override; void translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command) override; - void projectDoesNotExist(const ProjectDoesNotExistCommand &command) override; + void projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command) override; private: QVector<IpcClientInterface*> clients; diff --git a/src/libs/codemodelbackendipc/source/ipcclientinterface.cpp b/src/libs/codemodelbackendipc/source/ipcclientinterface.cpp index df820491a2..f436d0b958 100644 --- a/src/libs/codemodelbackendipc/source/ipcclientinterface.cpp +++ b/src/libs/codemodelbackendipc/source/ipcclientinterface.cpp @@ -35,8 +35,8 @@ #include "cmbechocommand.h" #include "cmbcodecompletedcommand.h" -#include "translationunitdoesnotexistscommand.h" -#include "projectdoesnotexistscommand.h" +#include "translationunitdoesnotexistcommand.h" +#include "projectpartsdonotexistcommand.h" namespace CodeModelBackEnd { @@ -47,7 +47,7 @@ void IpcClientInterface::dispatch(const QVariant &command) static const int echoCommandType = QMetaType::type("CodeModelBackEnd::EchoCommand"); static const int codeCompletedCommandType = QMetaType::type("CodeModelBackEnd::CodeCompletedCommand"); static const int translationUnitDoesNotExistCommand = QMetaType::type("CodeModelBackEnd::TranslationUnitDoesNotExistCommand"); - static const int projectDoesNotExistCommand = QMetaType::type("CodeModelBackEnd::ProjectDoesNotExistCommand"); + static const int projectPartsDoNotExistCommand = QMetaType::type("CodeModelBackEnd::ProjectPartsDoNotExistCommand"); int type = command.userType(); @@ -59,8 +59,8 @@ void IpcClientInterface::dispatch(const QVariant &command) codeCompleted(command.value<CodeCompletedCommand>()); else if (type == translationUnitDoesNotExistCommand) translationUnitDoesNotExist(command.value<TranslationUnitDoesNotExistCommand>()); - else if (type == projectDoesNotExistCommand) - projectDoesNotExist(command.value<ProjectDoesNotExistCommand>()); + else if (type == projectPartsDoNotExistCommand) + projectPartsDoNotExist(command.value<ProjectPartsDoNotExistCommand>()); else qWarning() << "Unknown IpcClientCommand"; } diff --git a/src/libs/codemodelbackendipc/source/ipcclientinterface.h b/src/libs/codemodelbackendipc/source/ipcclientinterface.h index f8bd542b97..b9f5d8d449 100644 --- a/src/libs/codemodelbackendipc/source/ipcclientinterface.h +++ b/src/libs/codemodelbackendipc/source/ipcclientinterface.h @@ -37,14 +37,14 @@ namespace CodeModelBackEnd { class IpcServerInterface; class RegisterTranslationUnitForCodeCompletionCommand; -class RegisterProjectsForCodeCompletionCommand; +class RegisterProjectPartsForCodeCompletionCommand; class UnregisterTranslationUnitsForCodeCompletionCommand; -class UnregisterProjectsForCodeCompletionCommand; +class UnregisterProjectPartsForCodeCompletionCommand; class EchoCommand; class CompleteCodeCommand; class CodeCompletedCommand; class TranslationUnitDoesNotExistCommand; -class ProjectDoesNotExistCommand; +class ProjectPartsDoNotExistCommand; class CMBIPC_EXPORT IpcClientInterface : public IpcInterface { @@ -55,7 +55,7 @@ public: virtual void echo(const EchoCommand &command) = 0; virtual void codeCompleted(const CodeCompletedCommand &command) = 0; virtual void translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command) = 0; - virtual void projectDoesNotExist(const ProjectDoesNotExistCommand &command) = 0; + virtual void projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command) = 0; }; } // namespace CodeModelBackEnd diff --git a/src/libs/codemodelbackendipc/source/ipcclientproxy.cpp b/src/libs/codemodelbackendipc/source/ipcclientproxy.cpp index 3531ffd585..7e99572d91 100644 --- a/src/libs/codemodelbackendipc/source/ipcclientproxy.cpp +++ b/src/libs/codemodelbackendipc/source/ipcclientproxy.cpp @@ -41,8 +41,8 @@ #include "cmbechocommand.h" #include "cmbregistertranslationunitsforcodecompletioncommand.h" #include "cmbcodecompletedcommand.h" -#include "translationunitdoesnotexistscommand.h" -#include "projectdoesnotexistscommand.h" +#include "translationunitdoesnotexistcommand.h" +#include "projectpartsdonotexistcommand.h" namespace CodeModelBackEnd { @@ -94,7 +94,7 @@ void IpcClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExi writeCommandBlock.write(QVariant::fromValue(command)); } -void IpcClientProxy::projectDoesNotExist(const ProjectDoesNotExistCommand &command) +void IpcClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command) { writeCommandBlock.write(QVariant::fromValue(command)); } diff --git a/src/libs/codemodelbackendipc/source/ipcclientproxy.h b/src/libs/codemodelbackendipc/source/ipcclientproxy.h index 9a910e3d3e..896b03f327 100644 --- a/src/libs/codemodelbackendipc/source/ipcclientproxy.h +++ b/src/libs/codemodelbackendipc/source/ipcclientproxy.h @@ -62,7 +62,7 @@ public: void echo(const EchoCommand &command) override; void codeCompleted(const CodeCompletedCommand &command) override; void translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command) override; - void projectDoesNotExist(const ProjectDoesNotExistCommand &command) override; + void projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command) override; void readCommands(); diff --git a/src/libs/codemodelbackendipc/source/ipcserverinterface.cpp b/src/libs/codemodelbackendipc/source/ipcserverinterface.cpp index 1dbfc12692..c3bcc9f8e4 100644 --- a/src/libs/codemodelbackendipc/source/ipcserverinterface.cpp +++ b/src/libs/codemodelbackendipc/source/ipcserverinterface.cpp @@ -46,8 +46,8 @@ void IpcServerInterface::dispatch(const QVariant &command) static const int endCommandType = QMetaType::type("CodeModelBackEnd::EndCommand"); static const int registerTranslationUnitsForCodeCompletionCommandType = QMetaType::type("CodeModelBackEnd::RegisterTranslationUnitForCodeCompletionCommand"); static const int unregisterTranslationUnitsForCodeCompletionCommandType = QMetaType::type("CodeModelBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand"); - static const int registerProjectsForCodeCompletionCommandType = QMetaType::type("CodeModelBackEnd::RegisterProjectsForCodeCompletionCommand"); - static const int unregisterProjectsForCodeCompletionCommandType = QMetaType::type("CodeModelBackEnd::UnregisterProjectsForCodeCompletionCommand"); + static const int registerProjectPartsForCodeCompletionCommandType = QMetaType::type("CodeModelBackEnd::RegisterProjectPartsForCodeCompletionCommand"); + static const int unregisterProjectPartsForCodeCompletionCommandType = QMetaType::type("CodeModelBackEnd::UnregisterProjectPartsForCodeCompletionCommand"); static const int completeCodeCommandType = QMetaType::type("CodeModelBackEnd::CompleteCodeCommand"); int type = command.userType(); @@ -58,10 +58,10 @@ void IpcServerInterface::dispatch(const QVariant &command) registerTranslationUnitsForCodeCompletion(command.value<RegisterTranslationUnitForCodeCompletionCommand>()); else if (type == unregisterTranslationUnitsForCodeCompletionCommandType) unregisterTranslationUnitsForCodeCompletion(command.value<UnregisterTranslationUnitsForCodeCompletionCommand>()); - else if (type == registerProjectsForCodeCompletionCommandType) - registerProjectsForCodeCompletion(command.value<RegisterProjectsForCodeCompletionCommand>()); - else if (type == unregisterProjectsForCodeCompletionCommandType) - unregisterProjectsForCodeCompletion(command.value<UnregisterProjectsForCodeCompletionCommand>()); + else if (type == registerProjectPartsForCodeCompletionCommandType) + registerProjectPartsForCodeCompletion(command.value<RegisterProjectPartsForCodeCompletionCommand>()); + else if (type == unregisterProjectPartsForCodeCompletionCommandType) + unregisterProjectPartsForCodeCompletion(command.value<UnregisterProjectPartsForCodeCompletionCommand>()); else if (type == completeCodeCommandType) completeCode(command.value<CompleteCodeCommand>()); else diff --git a/src/libs/codemodelbackendipc/source/ipcserverinterface.h b/src/libs/codemodelbackendipc/source/ipcserverinterface.h index d4e3375e5d..1b7410a0b8 100644 --- a/src/libs/codemodelbackendipc/source/ipcserverinterface.h +++ b/src/libs/codemodelbackendipc/source/ipcserverinterface.h @@ -47,8 +47,8 @@ public: virtual void end() = 0; virtual void registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionCommand &command) = 0; virtual void unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionCommand &command) = 0; - virtual void registerProjectsForCodeCompletion(const RegisterProjectsForCodeCompletionCommand &command) = 0; - virtual void unregisterProjectsForCodeCompletion(const UnregisterProjectsForCodeCompletionCommand &command) = 0; + virtual void registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command) = 0; + virtual void unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command) = 0; virtual void completeCode(const CompleteCodeCommand &command) = 0; void addClient(IpcClientInterface *client); diff --git a/src/libs/codemodelbackendipc/source/ipcserverproxy.cpp b/src/libs/codemodelbackendipc/source/ipcserverproxy.cpp index 035a36b878..fae81fc1f9 100644 --- a/src/libs/codemodelbackendipc/source/ipcserverproxy.cpp +++ b/src/libs/codemodelbackendipc/source/ipcserverproxy.cpp @@ -81,12 +81,12 @@ void IpcServerProxy::unregisterTranslationUnitsForCodeCompletion(const Unregiste writeCommandBlock.write(QVariant::fromValue(command)); } -void IpcServerProxy::registerProjectsForCodeCompletion(const RegisterProjectsForCodeCompletionCommand &command) +void IpcServerProxy::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command) { writeCommandBlock.write(QVariant::fromValue(command)); } -void IpcServerProxy::unregisterProjectsForCodeCompletion(const UnregisterProjectsForCodeCompletionCommand &command) +void IpcServerProxy::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command) { writeCommandBlock.write(QVariant::fromValue(command)); } diff --git a/src/libs/codemodelbackendipc/source/ipcserverproxy.h b/src/libs/codemodelbackendipc/source/ipcserverproxy.h index 323a0f55df..02295de4bd 100644 --- a/src/libs/codemodelbackendipc/source/ipcserverproxy.h +++ b/src/libs/codemodelbackendipc/source/ipcserverproxy.h @@ -59,8 +59,8 @@ public: void end() override; void registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionCommand &command) override; void unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionCommand &command) override; - void registerProjectsForCodeCompletion(const RegisterProjectsForCodeCompletionCommand &command) override; - void unregisterProjectsForCodeCompletion(const UnregisterProjectsForCodeCompletionCommand &command) override; + void registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command) override; + void unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command) override; void completeCode(const CompleteCodeCommand &command) override; void readCommands(); diff --git a/src/libs/codemodelbackendipc/source/projectcontainer.cpp b/src/libs/codemodelbackendipc/source/projectpartcontainer.cpp index e3defeae54..3fce9c6ebc 100644 --- a/src/libs/codemodelbackendipc/source/projectcontainer.cpp +++ b/src/libs/codemodelbackendipc/source/projectpartcontainer.cpp @@ -28,7 +28,7 @@ ** ****************************************************************************/ -#include "projectcontainer.h" +#include "projectpartcontainer.h" #include <QtDebug> @@ -36,54 +36,54 @@ namespace CodeModelBackEnd { -ProjectContainer::ProjectContainer(const Utf8String &fileName, - const Utf8StringVector &arguments) - : filePath_(fileName), +ProjectPartContainer::ProjectPartContainer(const Utf8String &projectPathId, + const Utf8StringVector &arguments) + : projectPartId_(projectPathId), arguments_(arguments) { } -const Utf8String &ProjectContainer::filePath() const +const Utf8String &ProjectPartContainer::projectPartId() const { - return filePath_; + return projectPartId_; } -const Utf8StringVector &ProjectContainer::arguments() const +const Utf8StringVector &ProjectPartContainer::arguments() const { return arguments_; } -QDataStream &operator<<(QDataStream &out, const ProjectContainer &container) +QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container) { - out << container.filePath_; + out << container.projectPartId_; out << container.arguments_; return out; } -QDataStream &operator>>(QDataStream &in, ProjectContainer &container) +QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container) { - in >> container.filePath_; + in >> container.projectPartId_; in >> container.arguments_; return in; } -bool operator == (const ProjectContainer &first, const ProjectContainer &second) +bool operator == (const ProjectPartContainer &first, const ProjectPartContainer &second) { - return first.filePath_ == second.filePath_; + return first.projectPartId_ == second.projectPartId_; } -bool operator < (const ProjectContainer &first, const ProjectContainer &second) +bool operator < (const ProjectPartContainer &first, const ProjectPartContainer &second) { - return first.filePath_ < second.filePath_; + return first.projectPartId_ < second.projectPartId_; } -QDebug operator <<(QDebug debug, const ProjectContainer &container) +QDebug operator <<(QDebug debug, const ProjectPartContainer &container) { - debug.nospace() << "ProjectContainer(" - << container.filePath() + debug.nospace() << "ProjectPartContainer(" + << container.projectPartId() << "," << container.arguments() << ")"; @@ -91,10 +91,10 @@ QDebug operator <<(QDebug debug, const ProjectContainer &container) return debug; } -void PrintTo(const ProjectContainer &container, ::std::ostream* os) +void PrintTo(const ProjectPartContainer &container, ::std::ostream* os) { - *os << "ProjectContainer(" - << container.filePath().constData() + *os << "ProjectPartContainer(" + << container.projectPartId().constData() << "," << container.arguments().constData() << ")"; diff --git a/src/libs/codemodelbackendipc/source/projectcontainer.h b/src/libs/codemodelbackendipc/source/projectpartcontainer.h index aafad82df6..253074a371 100644 --- a/src/libs/codemodelbackendipc/source/projectcontainer.h +++ b/src/libs/codemodelbackendipc/source/projectpartcontainer.h @@ -39,35 +39,35 @@ namespace CodeModelBackEnd { -class CMBIPC_EXPORT ProjectContainer +class CMBIPC_EXPORT ProjectPartContainer { - friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectContainer &container); - friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectContainer &container); - friend CMBIPC_EXPORT bool operator == (const ProjectContainer &first, const ProjectContainer &second); - friend CMBIPC_EXPORT bool operator < (const ProjectContainer &first, const ProjectContainer &second); + friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container); + friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container); + friend CMBIPC_EXPORT bool operator == (const ProjectPartContainer &first, const ProjectPartContainer &second); + friend CMBIPC_EXPORT bool operator < (const ProjectPartContainer &first, const ProjectPartContainer &second); public: - ProjectContainer() = default; - ProjectContainer(const Utf8String &filePath, - const Utf8StringVector &arguments = Utf8StringVector()); + ProjectPartContainer() = default; + ProjectPartContainer(const Utf8String &projectPartId, + const Utf8StringVector &arguments = Utf8StringVector()); - const Utf8String &filePath() const; + const Utf8String &projectPartId() const; const Utf8StringVector &arguments() const; private: - Utf8String filePath_; + Utf8String projectPartId_; Utf8StringVector arguments_; }; -CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectContainer &container); -CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectContainer &container); -CMBIPC_EXPORT bool operator == (const ProjectContainer &first, const ProjectContainer &second); -CMBIPC_EXPORT bool operator < (const ProjectContainer &first, const ProjectContainer &second); +CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container); +CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container); +CMBIPC_EXPORT bool operator == (const ProjectPartContainer &first, const ProjectPartContainer &second); +CMBIPC_EXPORT bool operator < (const ProjectPartContainer &first, const ProjectPartContainer &second); -QDebug operator <<(QDebug debug, const ProjectContainer &container); -void PrintTo(const ProjectContainer &container, ::std::ostream* os); +QDebug operator <<(QDebug debug, const ProjectPartContainer &container); +void PrintTo(const ProjectPartContainer &container, ::std::ostream* os); } // namespace CodeModelBackEnd -Q_DECLARE_METATYPE(CodeModelBackEnd::ProjectContainer) +Q_DECLARE_METATYPE(CodeModelBackEnd::ProjectPartContainer) #endif // CODEMODELBACKEND_PROJECTCONTAINER_H diff --git a/src/libs/codemodelbackendipc/source/projectdoesnotexistscommand.cpp b/src/libs/codemodelbackendipc/source/projectpartsdonotexistcommand.cpp index 9109db2f8e..2f8f4b843b 100644 --- a/src/libs/codemodelbackendipc/source/projectdoesnotexistscommand.cpp +++ b/src/libs/codemodelbackendipc/source/projectpartsdonotexistcommand.cpp @@ -28,7 +28,7 @@ ** ****************************************************************************/ -#include "projectdoesnotexistscommand.h" +#include "projectpartsdonotexistcommand.h" #include <QDebug> @@ -36,53 +36,53 @@ namespace CodeModelBackEnd { -ProjectDoesNotExistCommand::ProjectDoesNotExistCommand(const Utf8StringVector &projectFilePaths) - : projectFilePaths_(projectFilePaths) +ProjectPartsDoNotExistCommand::ProjectPartsDoNotExistCommand(const Utf8StringVector &projectPartIds) + : projectPartIds_(projectPartIds) { } -const Utf8StringVector &ProjectDoesNotExistCommand::projectFilePaths() const +const Utf8StringVector &ProjectPartsDoNotExistCommand::projectPartIds() const { - return projectFilePaths_; + return projectPartIds_; } -QDataStream &operator<<(QDataStream &out, const ProjectDoesNotExistCommand &command) +QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistCommand &command) { - out << command.projectFilePaths_; + out << command.projectPartIds_; return out; } -QDataStream &operator>>(QDataStream &in, ProjectDoesNotExistCommand &command) +QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistCommand &command) { - in >> command.projectFilePaths_; + in >> command.projectPartIds_; return in; } -bool operator == (const ProjectDoesNotExistCommand &first, const ProjectDoesNotExistCommand &second) +bool operator == (const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second) { - return first.projectFilePaths_ == second.projectFilePaths_; + return first.projectPartIds_ == second.projectPartIds_; } -bool operator < (const ProjectDoesNotExistCommand &first, const ProjectDoesNotExistCommand &second) +bool operator < (const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second) { - return first.projectFilePaths_ < second.projectFilePaths_; + return first.projectPartIds_ < second.projectPartIds_; } -QDebug operator <<(QDebug debug, const ProjectDoesNotExistCommand &command) +QDebug operator <<(QDebug debug, const ProjectPartsDoNotExistCommand &command) { - debug.nospace() << "ProjectDoesNotExistCommand("; + debug.nospace() << "ProjectPartDoesNotExistCommand("; - debug.nospace() << command.projectFilePaths_; + debug.nospace() << command.projectPartIds_; debug.nospace() << ")"; return debug; } -void PrintTo(const ProjectDoesNotExistCommand &command, ::std::ostream* os) +void PrintTo(const ProjectPartsDoNotExistCommand &command, ::std::ostream* os) { QString output; QDebug debug(&output); diff --git a/src/libs/codemodelbackendipc/source/projectdoesnotexistscommand.h b/src/libs/codemodelbackendipc/source/projectpartsdonotexistcommand.h index be40d3a96c..073d148881 100644 --- a/src/libs/codemodelbackendipc/source/projectdoesnotexistscommand.h +++ b/src/libs/codemodelbackendipc/source/projectpartsdonotexistcommand.h @@ -28,8 +28,8 @@ ** ****************************************************************************/ -#ifndef CODEMODELBACKEND_PROJECTDOESNOTEXISTSCOMMAND_H -#define CODEMODELBACKEND_PROJECTDOESNOTEXISTSCOMMAND_H +#ifndef CODEMODELBACKEND_PROJECTPARTSDONOTEXISTCOMMAND_H +#define CODEMODELBACKEND_PROJECTPARTSDONOTEXISTCOMMAND_H #include <QMetaType> @@ -39,34 +39,34 @@ namespace CodeModelBackEnd { -class CMBIPC_EXPORT ProjectDoesNotExistCommand +class CMBIPC_EXPORT ProjectPartsDoNotExistCommand { - friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectDoesNotExistCommand &command); - friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectDoesNotExistCommand &command); - friend CMBIPC_EXPORT bool operator == (const ProjectDoesNotExistCommand &first, const ProjectDoesNotExistCommand &second); - friend CMBIPC_EXPORT bool operator < (const ProjectDoesNotExistCommand &first, const ProjectDoesNotExistCommand &second); - friend CMBIPC_EXPORT QDebug operator <<(QDebug debug, const ProjectDoesNotExistCommand &command); - friend void PrintTo(const ProjectDoesNotExistCommand &command, ::std::ostream* os); + friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistCommand &command); + friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistCommand &command); + friend CMBIPC_EXPORT bool operator == (const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second); + friend CMBIPC_EXPORT bool operator < (const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second); + friend CMBIPC_EXPORT QDebug operator <<(QDebug debug, const ProjectPartsDoNotExistCommand &command); + friend void PrintTo(const ProjectPartsDoNotExistCommand &command, ::std::ostream* os); public: - ProjectDoesNotExistCommand() = default; - ProjectDoesNotExistCommand(const Utf8StringVector &projectFilePaths); + ProjectPartsDoNotExistCommand() = default; + ProjectPartsDoNotExistCommand(const Utf8StringVector &projectPartIds); - const Utf8StringVector &projectFilePaths() const; + const Utf8StringVector &projectPartIds() const; private: - Utf8StringVector projectFilePaths_; + Utf8StringVector projectPartIds_; }; -CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectDoesNotExistCommand &command); -CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectDoesNotExistCommand &command); -CMBIPC_EXPORT bool operator == (const ProjectDoesNotExistCommand &first, const ProjectDoesNotExistCommand &second); -CMBIPC_EXPORT bool operator < (const ProjectDoesNotExistCommand &first, const ProjectDoesNotExistCommand &second); +CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistCommand &command); +CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistCommand &command); +CMBIPC_EXPORT bool operator == (const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second); +CMBIPC_EXPORT bool operator < (const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second); -CMBIPC_EXPORT QDebug operator <<(QDebug debug, const ProjectDoesNotExistCommand &command); -void PrintTo(const ProjectDoesNotExistCommand &command, ::std::ostream* os); +CMBIPC_EXPORT QDebug operator <<(QDebug debug, const ProjectPartsDoNotExistCommand &command); +void PrintTo(const ProjectPartsDoNotExistCommand &command, ::std::ostream* os); } // namespace CodeModelBackEnd -Q_DECLARE_METATYPE(CodeModelBackEnd::ProjectDoesNotExistCommand) +Q_DECLARE_METATYPE(CodeModelBackEnd::ProjectPartsDoNotExistCommand) -#endif // CODEMODELBACKEND_PROJECTDOESNOTEXISTSCOMMAND_H +#endif // CODEMODELBACKEND_PROJECTPARTSDONOTEXISTCOMMAND_H diff --git a/src/libs/codemodelbackendipc/source/translationunitdoesnotexistscommand.cpp b/src/libs/codemodelbackendipc/source/translationunitdoesnotexistcommand.cpp index f979855d33..e998ccfcce 100644 --- a/src/libs/codemodelbackendipc/source/translationunitdoesnotexistscommand.cpp +++ b/src/libs/codemodelbackendipc/source/translationunitdoesnotexistcommand.cpp @@ -28,7 +28,7 @@ ** ****************************************************************************/ -#include "translationunitdoesnotexistscommand.h" +#include "translationunitdoesnotexistcommand.h" #include <QDebug> @@ -41,8 +41,8 @@ TranslationUnitDoesNotExistCommand::TranslationUnitDoesNotExistCommand(const Fil { } -TranslationUnitDoesNotExistCommand::TranslationUnitDoesNotExistCommand(const Utf8String &filePath, const Utf8String &projectFilePath) - : fileContainer_(filePath, projectFilePath) +TranslationUnitDoesNotExistCommand::TranslationUnitDoesNotExistCommand(const Utf8String &filePath, const Utf8String &projectPartId) + : fileContainer_(filePath, projectPartId) { } @@ -56,9 +56,9 @@ const Utf8String &TranslationUnitDoesNotExistCommand::filePath() const return fileContainer_.filePath(); } -const Utf8String &TranslationUnitDoesNotExistCommand::projectFilePath() const +const Utf8String &TranslationUnitDoesNotExistCommand::projectPartId() const { - return fileContainer_.projectFilePath(); + return fileContainer_.projectPartId(); } QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistCommand &command) diff --git a/src/libs/codemodelbackendipc/source/translationunitdoesnotexistscommand.h b/src/libs/codemodelbackendipc/source/translationunitdoesnotexistcommand.h index 32dfcc6251..29e4c26f67 100644 --- a/src/libs/codemodelbackendipc/source/translationunitdoesnotexistscommand.h +++ b/src/libs/codemodelbackendipc/source/translationunitdoesnotexistcommand.h @@ -48,11 +48,11 @@ class CMBIPC_EXPORT TranslationUnitDoesNotExistCommand public: TranslationUnitDoesNotExistCommand() = default; TranslationUnitDoesNotExistCommand(const FileContainer &fileContainer); - TranslationUnitDoesNotExistCommand(const Utf8String &filePath, const Utf8String &projectFilePath); + TranslationUnitDoesNotExistCommand(const Utf8String &filePath, const Utf8String &projectPartId); const FileContainer &fileContainer() const; const Utf8String &filePath() const; - const Utf8String &projectFilePath() const; + const Utf8String &projectPartId() const; private: FileContainer fileContainer_; diff --git a/src/tools/codemodelbackend/ipcsource/clangipcserver.cpp b/src/tools/codemodelbackend/ipcsource/clangipcserver.cpp index e1c9622c5b..d2a9e2dbde 100644 --- a/src/tools/codemodelbackend/ipcsource/clangipcserver.cpp +++ b/src/tools/codemodelbackend/ipcsource/clangipcserver.cpp @@ -8,15 +8,15 @@ #include <cmbunregisterprojectsforcodecompletioncommand.h> #include <cmbcodecompletedcommand.h> #include <cmbcompletecodecommand.h> -#include <translationunitdoesnotexistscommand.h> -#include <projectdoesnotexistscommand.h> +#include <translationunitdoesnotexistcommand.h> +#include <projectpartsdonotexistcommand.h> #include "translationunits.h" #include "codecompleter.h" -#include "translationunitdoesnotexistsexception.h" +#include "translationunitdoesnotexistexception.h" #include "translationunitisnullexception.h" -#include "translationunitfilenotexitsexception.h" -#include "projectdoesnotexistsexception.h" +#include "translationunitfilenotexitexception.h" +#include "projectpartsdonotexistexception.h" #include "translationunitparseerrorexception.h" #include <QDebug> @@ -38,8 +38,8 @@ void ClangIpcServer::registerTranslationUnitsForCodeCompletion(const CodeModelBa try { translationUnits.createOrUpdate(command.fileContainers()); unsavedFiles.createOrUpdate(command.fileContainers()); - } catch (const ProjectDoesNotExistException &exception) { - client()->projectDoesNotExist(ProjectDoesNotExistCommand(exception.projectFilePaths())); + } catch (const ProjectPartDoNotExistException &exception) { + client()->projectPartsDoNotExist(ProjectPartsDoNotExistCommand(exception.projectPartIds())); } catch (const std::exception &exception) { qWarning() << "Error in ClangIpcServer::registerTranslationUnitsForCodeCompletion:" << exception.what(); } @@ -51,47 +51,47 @@ void ClangIpcServer::unregisterTranslationUnitsForCodeCompletion(const CodeModel translationUnits.remove(command.fileContainers()); } catch (const TranslationUnitDoesNotExistException &exception) { client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistCommand(exception.fileContainer())); - } catch (const ProjectDoesNotExistException &exception) { - client()->projectDoesNotExist(ProjectDoesNotExistCommand(exception.projectFilePaths())); + } catch (const ProjectPartDoNotExistException &exception) { + client()->projectPartsDoNotExist(ProjectPartsDoNotExistCommand(exception.projectPartIds())); } catch (const std::exception &exception) { qWarning() << "Error in ClangIpcServer::unregisterTranslationUnitsForCodeCompletion:" << exception.what(); } } -void ClangIpcServer::registerProjectsForCodeCompletion(const RegisterProjectsForCodeCompletionCommand &command) +void ClangIpcServer::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command) { try { projects.createOrUpdate(command.projectContainers()); } catch (const std::exception &exception) { - qWarning() << "Error in ClangIpcServer::registerProjectsForCodeCompletion:" << exception.what(); + qWarning() << "Error in ClangIpcServer::registerProjectPartsForCodeCompletion:" << exception.what(); } } -void ClangIpcServer::unregisterProjectsForCodeCompletion(const UnregisterProjectsForCodeCompletionCommand &command) +void ClangIpcServer::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command) { try { projects.remove(command.filePaths()); - } catch (const ProjectDoesNotExistException &exception) { - client()->projectDoesNotExist(ProjectDoesNotExistCommand(exception.projectFilePaths())); + } catch (const ProjectPartDoNotExistException &exception) { + client()->projectPartsDoNotExist(ProjectPartsDoNotExistCommand(exception.projectPartIds())); } catch (const std::exception &exception) { - qWarning() << "Error in ClangIpcServer::unregisterProjectsForCodeCompletion:" << exception.what(); + qWarning() << "Error in ClangIpcServer::unregisterProjectPartsForCodeCompletion:" << exception.what(); } } void ClangIpcServer::completeCode(const CodeModelBackEnd::CompleteCodeCommand &command) { try { - CodeCompleter codeCompleter(translationUnits.translationUnit(command.filePath(), command.projectFilePath())); + CodeCompleter codeCompleter(translationUnits.translationUnit(command.filePath(), command.projectPartId())); const auto codeCompletions = codeCompleter.complete(command.line(), command.column()); client()->codeCompleted(CodeCompletedCommand(codeCompletions, command.ticketNumber())); } catch (const TranslationUnitDoesNotExistException &exception) { client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistCommand(exception.fileContainer())); - } catch (const ProjectDoesNotExistException &exception) { - client()->projectDoesNotExist(ProjectDoesNotExistCommand(exception.projectFilePaths())); + } catch (const ProjectPartDoNotExistException &exception) { + client()->projectPartsDoNotExist(ProjectPartsDoNotExistCommand(exception.projectPartIds())); } catch (const std::exception &exception) { - qWarning() << "Error in ClangIpcServer::unregisterProjectsForCodeCompletion:" << exception.what(); + qWarning() << "Error in ClangIpcServer::unregisterProjectPartsForCodeCompletion:" << exception.what(); } } diff --git a/src/tools/codemodelbackend/ipcsource/clangipcserver.h b/src/tools/codemodelbackend/ipcsource/clangipcserver.h index aff8024579..142036c67e 100644 --- a/src/tools/codemodelbackend/ipcsource/clangipcserver.h +++ b/src/tools/codemodelbackend/ipcsource/clangipcserver.h @@ -4,7 +4,7 @@ #include "ipcserverinterface.h" #include "translationunit.h" -#include "project.h" +#include "projectpart.h" #include "unsavedfiles.h" #include "projects.h" #include "translationunits.h" @@ -23,12 +23,12 @@ public: void end() override; void registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionCommand &command) override; void unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionCommand &command) override; - void registerProjectsForCodeCompletion(const RegisterProjectsForCodeCompletionCommand &command) override; - void unregisterProjectsForCodeCompletion(const UnregisterProjectsForCodeCompletionCommand &command) override; + void registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command) override; + void unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command) override; void completeCode(const CompleteCodeCommand &command) override; private: - Projects projects; + ProjectParts projects; UnsavedFiles unsavedFiles; TranslationUnits translationUnits; }; diff --git a/src/tools/codemodelbackend/ipcsource/codemodelbackendclangipc-source.pri b/src/tools/codemodelbackend/ipcsource/codemodelbackendclangipc-source.pri index 4cad3e5855..486f91e6fd 100644 --- a/src/tools/codemodelbackend/ipcsource/codemodelbackendclangipc-source.pri +++ b/src/tools/codemodelbackend/ipcsource/codemodelbackendclangipc-source.pri @@ -1,8 +1,7 @@ -VPATH += $$PWD INCLUDEPATH += $$PWD -HEADERS += clangipcserver.h \ - codecompleter.h \ +HEADERS += $$PWD/clangipcserver.h \ + $$PWD/codecompleter.h \ $$PWD/clangstring.h \ $$PWD/translationunit.h \ $$PWD/translationunitisnullexception.h \ @@ -10,16 +9,16 @@ HEADERS += clangipcserver.h \ $$PWD/clangcodecompleteresults.h \ $$PWD/codecompletionsextractor.h \ $$PWD/unsavedfiles.h \ - $$PWD/translationunitfilenotexitsexception.h \ - $$PWD/project.h \ $$PWD/projects.h \ $$PWD/translationunits.h \ $$PWD/translationunitparseerrorexception.h \ - $$PWD/translationunitdoesnotexistsexception.h \ - $$PWD/projectdoesnotexistsexception.h + $$PWD/projectpart.h \ + $$PWD/translationunitfilenotexitexception.h \ + $$PWD/translationunitdoesnotexistexception.h \ + $$PWD/projectpartsdonotexistexception.h -SOURCES += clangipcserver.cpp \ - codecompleter.cpp \ +SOURCES += $$PWD/clangipcserver.cpp \ + $$PWD/codecompleter.cpp \ $$PWD/clangstring.cpp \ $$PWD/translationunit.cpp \ $$PWD/translationunitisnullexception.cpp \ @@ -27,10 +26,10 @@ SOURCES += clangipcserver.cpp \ $$PWD/clangcodecompleteresults.cpp \ $$PWD/codecompletionsextractor.cpp \ $$PWD/unsavedfiles.cpp \ - $$PWD/translationunitfilenotexitsexception.cpp \ - $$PWD/project.cpp \ $$PWD/projects.cpp \ $$PWD/translationunits.cpp \ $$PWD/translationunitparseerrorexception.cpp \ - $$PWD/translationunitdoesnotexistsexception.cpp \ - $$PWD/projectdoesnotexistsexception.cpp + $$PWD/projectpart.cpp \ + $$PWD/translationunitfilenotexitexception.cpp \ + $$PWD/translationunitdoesnotexistexception.cpp \ + $$PWD/projectpartsdonotexistexception.cpp diff --git a/src/tools/codemodelbackend/ipcsource/projectcontainer.cpp b/src/tools/codemodelbackend/ipcsource/projectcontainer.cpp index 31b094c1ba..8d7cff15f8 100644 --- a/src/tools/codemodelbackend/ipcsource/projectcontainer.cpp +++ b/src/tools/codemodelbackend/ipcsource/projectcontainer.cpp @@ -34,63 +34,63 @@ namespace CodeModelBackEnd { -ProjectContainer::ProjectContainer(const Utf8String &fileName, +ProjectPartContainer::ProjectPartContainer(const Utf8String &fileName, const Utf8StringVector &arguments) - : filePath_(fileName), + : projectPartId_(fileName), arguments_(arguments) { } -const Utf8String &ProjectContainer::filePath() const +const Utf8String &ProjectPartContainer::projectPartId() const { - return filePath_; + return projectPartId_; } -const Utf8StringVector &ProjectContainer::arguments() const +const Utf8StringVector &ProjectPartContainer::arguments() const { return arguments_; } -QDataStream &operator<<(QDataStream &out, const ProjectContainer &container) +QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container) { - out << container.filePath_; + out << container.projectPartId_; out << container.arguments_; return out; } -QDataStream &operator>>(QDataStream &in, ProjectContainer &container) +QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container) { - in >> container.filePath_; + in >> container.projectPartId_; in >> container.arguments_; return in; } -bool operator == (const ProjectContainer &first, const ProjectContainer &second) +bool operator == (const ProjectPartContainer &first, const ProjectPartContainer &second) { - return first.filePath_ == second.filePath_; + return first.projectPartId_ == second.projectPartId_; } -bool operator < (const ProjectContainer &first, const ProjectContainer &second) +bool operator < (const ProjectPartContainer &first, const ProjectPartContainer &second) { - return first.filePath_ < second.filePath_; + return first.projectPartId_ < second.projectPartId_; } -QDebug operator <<(QDebug debug, const ProjectContainer &container) +QDebug operator <<(QDebug debug, const ProjectPartContainer &container) { debug.nospace() << "ProjectContainer(" - << container.filePath() + << container.projectPartId() << ")"; return debug; } -void PrintTo(const ProjectContainer &container, ::std::ostream* os) +void PrintTo(const ProjectPartContainer &container, ::std::ostream* os) { *os << "ProjectContainer(" - << container.filePath().constData() + << container.projectPartId().constData() << ")"; } diff --git a/src/tools/codemodelbackend/ipcsource/projectcontainer.h b/src/tools/codemodelbackend/ipcsource/projectcontainer.h index 8c2607bd08..ed2f2f9680 100644 --- a/src/tools/codemodelbackend/ipcsource/projectcontainer.h +++ b/src/tools/codemodelbackend/ipcsource/projectcontainer.h @@ -39,35 +39,35 @@ namespace CodeModelBackEnd { -class CMBIPC_EXPORT ProjectContainer +class CMBIPC_EXPORT ProjectPartContainer { - friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectContainer &container); - friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectContainer &container); - friend CMBIPC_EXPORT bool operator == (const ProjectContainer &first, const ProjectContainer &second); - friend CMBIPC_EXPORT bool operator < (const ProjectContainer &first, const ProjectContainer &second); + friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container); + friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container); + friend CMBIPC_EXPORT bool operator == (const ProjectPartContainer &first, const ProjectPartContainer &second); + friend CMBIPC_EXPORT bool operator < (const ProjectPartContainer &first, const ProjectPartContainer &second); public: - ProjectContainer() = default; - ProjectContainer(const Utf8String &filePath, + ProjectPartContainer() = default; + ProjectPartContainer(const Utf8String &projectPartId, const Utf8StringVector &arguments = Utf8StringVector()); - const Utf8String &filePath() const; + const Utf8String &projectPartId() const; const Utf8StringVector &arguments() const; private: - Utf8String filePath_; + Utf8String projectPartId_; Utf8StringVector arguments_; }; -CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectContainer &container); -CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectContainer &container); -CMBIPC_EXPORT bool operator == (const ProjectContainer &first, const ProjectContainer &second); -CMBIPC_EXPORT bool operator < (const ProjectContainer &first, const ProjectContainer &second); +CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container); +CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container); +CMBIPC_EXPORT bool operator == (const ProjectPartContainer &first, const ProjectPartContainer &second); +CMBIPC_EXPORT bool operator < (const ProjectPartContainer &first, const ProjectPartContainer &second); -CMBIPC_EXPORT QDebug operator <<(QDebug debug, const ProjectContainer &container); -void PrintTo(const ProjectContainer &container, ::std::ostream* os); +CMBIPC_EXPORT QDebug operator <<(QDebug debug, const ProjectPartContainer &container); +void PrintTo(const ProjectPartContainer &container, ::std::ostream* os); } // namespace CodeModelBackEnd -Q_DECLARE_METATYPE(CodeModelBackEnd::ProjectContainer) +Q_DECLARE_METATYPE(CodeModelBackEnd::ProjectPartContainer) #endif // CODEMODELBACKEND_PROJECTCONTAINER_H diff --git a/src/tools/codemodelbackend/ipcsource/project.cpp b/src/tools/codemodelbackend/ipcsource/projectpart.cpp index 7a034e4222..34641315fc 100644 --- a/src/tools/codemodelbackend/ipcsource/project.cpp +++ b/src/tools/codemodelbackend/ipcsource/projectpart.cpp @@ -28,7 +28,7 @@ ** ****************************************************************************/ -#include "project.h" +#include "projectpart.h" #include <cstring> @@ -38,58 +38,58 @@ namespace CodeModelBackEnd { -class ProjectData { +class ProjectPartData { public: - ProjectData(const Utf8String &projectFilePath); + ProjectPartData(const Utf8String &projectPartId); public: time_point lastChangeTimePoint; std::vector<const char*> arguments; - Utf8String projectFilePath; + Utf8String projectPartId; }; -ProjectData::ProjectData(const Utf8String &projectFilePath) +ProjectPartData::ProjectPartData(const Utf8String &projectPartId) : lastChangeTimePoint(std::chrono::high_resolution_clock::now()), - projectFilePath(projectFilePath) + projectPartId(projectPartId) { } -Project::Project(const Utf8String &projectFilePath) - : d(std::make_shared<ProjectData>(projectFilePath)) +ProjectPart::ProjectPart(const Utf8String &projectPartId) + : d(std::make_shared<ProjectPartData>(projectPartId)) { } -Project::Project(const ProjectContainer &projectContainer) - : d(std::make_shared<ProjectData>(projectContainer.filePath())) +ProjectPart::ProjectPart(const ProjectPartContainer &projectContainer) + : d(std::make_shared<ProjectPartData>(projectContainer.projectPartId())) { setArguments(projectContainer.arguments()); } -Project::~Project() = default; +ProjectPart::~ProjectPart() = default; -Project::Project(const Project &) = default; -Project &Project::operator =(const Project &) = default; +ProjectPart::ProjectPart(const ProjectPart &) = default; +ProjectPart &ProjectPart::operator =(const ProjectPart &) = default; -Project::Project(Project &&other) +ProjectPart::ProjectPart(ProjectPart &&other) : d(std::move(other.d)) { } -Project &Project::operator =(Project &&other) +ProjectPart &ProjectPart::operator =(ProjectPart &&other) { d = std::move(other.d); return *this; } -void Project::clearProjectFilePath() +void ProjectPart::clearProjectPartId() { - d->projectFilePath.clear(); + d->projectPartId.clear(); } -const Utf8String &Project::projectFilePath() const +const Utf8String &ProjectPart::projectPartId() const { - return d->projectFilePath; + return d->projectPartId; } static const char *strdup(const Utf8String &utf8String) @@ -100,41 +100,41 @@ static const char *strdup(const Utf8String &utf8String) return cxArgument; } -void Project::setArguments(const Utf8StringVector &arguments) +void ProjectPart::setArguments(const Utf8StringVector &arguments) { d->arguments.resize(arguments.size()); std::transform(arguments.cbegin(), arguments.cend(), d->arguments.begin(), strdup); updateLastChangeTimePoint(); } -const std::vector<const char*> &Project::arguments() const +const std::vector<const char*> &ProjectPart::arguments() const { return d->arguments; } -int Project::argumentCount() const +int ProjectPart::argumentCount() const { return d->arguments.size(); } -const char * const *Project::cxArguments() const +const char * const *ProjectPart::cxArguments() const { return arguments().data(); } -const time_point &Project::lastChangeTimePoint() const +const time_point &ProjectPart::lastChangeTimePoint() const { return d->lastChangeTimePoint; } -void Project::updateLastChangeTimePoint() +void ProjectPart::updateLastChangeTimePoint() { d->lastChangeTimePoint = std::chrono::high_resolution_clock::now(); } -bool operator ==(const Project &first, const Project &second) +bool operator ==(const ProjectPart &first, const ProjectPart &second) { - return first.projectFilePath() == second.projectFilePath(); + return first.projectPartId() == second.projectPartId(); } } // namespace CodeModelBackEnd diff --git a/src/tools/codemodelbackend/ipcsource/project.h b/src/tools/codemodelbackend/ipcsource/projectpart.h index a42330d9cd..199dbe3ab6 100644 --- a/src/tools/codemodelbackend/ipcsource/project.h +++ b/src/tools/codemodelbackend/ipcsource/projectpart.h @@ -40,27 +40,27 @@ class Utf8StringVector; namespace CodeModelBackEnd { -class ProjectContainer; -class ProjectData; +class ProjectPartContainer; +class ProjectPartData; using time_point = std::chrono::high_resolution_clock::time_point; -class Project +class ProjectPart { public: - Project(const Utf8String &projectFilePath); - Project(const ProjectContainer &projectContainer); - ~Project(); + ProjectPart(const Utf8String &projectPartId); + ProjectPart(const ProjectPartContainer &projectContainer); + ~ProjectPart(); - Project(const Project &project); - Project &operator =(const Project &project); + ProjectPart(const ProjectPart &project); + ProjectPart &operator =(const ProjectPart &project); - Project(Project &&project); - Project &operator =(Project &&project); + ProjectPart(ProjectPart &&project); + ProjectPart &operator =(ProjectPart &&project); - void clearProjectFilePath(); + void clearProjectPartId(); - const Utf8String &projectFilePath() const; + const Utf8String &projectPartId() const; void setArguments(const Utf8StringVector &arguments_); @@ -75,10 +75,10 @@ private: void updateLastChangeTimePoint(); private: - std::shared_ptr<ProjectData> d; + std::shared_ptr<ProjectPartData> d; }; -bool operator ==(const Project &first, const Project &second); +bool operator ==(const ProjectPart &first, const ProjectPart &second); } // namespace CodeModelBackEnd diff --git a/src/tools/codemodelbackend/ipcsource/projectdoesnotexistsexception.cpp b/src/tools/codemodelbackend/ipcsource/projectpartsdonotexistexception.cpp index e71593aea8..4ab912f752 100644 --- a/src/tools/codemodelbackend/ipcsource/projectdoesnotexistsexception.cpp +++ b/src/tools/codemodelbackend/ipcsource/projectpartsdonotexistexception.cpp @@ -28,25 +28,25 @@ ** ****************************************************************************/ -#include "projectdoesnotexistsexception.h" +#include "projectpartsdonotexistexception.h" namespace CodeModelBackEnd { -ProjectDoesNotExistException::ProjectDoesNotExistException(const Utf8StringVector &projectFilePaths) - : projectFilePaths_(projectFilePaths) +ProjectPartDoNotExistException::ProjectPartDoNotExistException(const Utf8StringVector &projectPartIds) + : projectPartIds_(projectPartIds) { } -const Utf8StringVector &ProjectDoesNotExistException::projectFilePaths() const +const Utf8StringVector &ProjectPartDoNotExistException::projectPartIds() const { - return projectFilePaths_; + return projectPartIds_; } -const char *ProjectDoesNotExistException::what() const Q_DECL_NOEXCEPT +const char *ProjectPartDoNotExistException::what() const Q_DECL_NOEXCEPT { if (what_.isEmpty()) - what_ += Utf8StringLiteral("Project files ") - + projectFilePaths().join(Utf8StringLiteral(", ")) + what_ += Utf8StringLiteral("ProjectPart files ") + + projectPartIds().join(Utf8StringLiteral(", ")) + Utf8StringLiteral(" does not exist!"); return what_.constData(); diff --git a/src/tools/codemodelbackend/ipcsource/projectdoesnotexistsexception.h b/src/tools/codemodelbackend/ipcsource/projectpartsdonotexistexception.h index 5543472b04..02d0a06b1b 100644 --- a/src/tools/codemodelbackend/ipcsource/projectdoesnotexistsexception.h +++ b/src/tools/codemodelbackend/ipcsource/projectpartsdonotexistexception.h @@ -37,17 +37,17 @@ namespace CodeModelBackEnd { -class ProjectDoesNotExistException : public std::exception +class ProjectPartDoNotExistException : public std::exception { public: - ProjectDoesNotExistException(const Utf8StringVector &projectFilePaths); + ProjectPartDoNotExistException(const Utf8StringVector &projectPartIds); - const Utf8StringVector &projectFilePaths() const; + const Utf8StringVector &projectPartIds() const; const char *what() const Q_DECL_NOEXCEPT override; private: - Utf8StringVector projectFilePaths_; + Utf8StringVector projectPartIds_; mutable Utf8String what_; }; diff --git a/src/tools/codemodelbackend/ipcsource/projects.cpp b/src/tools/codemodelbackend/ipcsource/projects.cpp index 807f80fa25..aa3fba2c1a 100644 --- a/src/tools/codemodelbackend/ipcsource/projects.cpp +++ b/src/tools/codemodelbackend/ipcsource/projects.cpp @@ -32,70 +32,70 @@ #include <QtGlobal> -#include "projectdoesnotexistsexception.h" +#include "projectpartsdonotexistexception.h" namespace CodeModelBackEnd { -void Projects::createOrUpdate(const QVector<ProjectContainer> &projectContainers) +void ProjectParts::createOrUpdate(const QVector<ProjectPartContainer> &projectContainers) { - for (const ProjectContainer &projectContainer : projectContainers) - createOrUpdateProject(projectContainer); + for (const ProjectPartContainer &projectContainer : projectContainers) + createOrUpdateProjectPart(projectContainer); } -void Projects::remove(const Utf8StringVector &projectFilePaths) +void ProjectParts::remove(const Utf8StringVector &projectPartIds) { - Utf8StringVector processedProjectFilePaths = projectFilePaths; + Utf8StringVector processedProjectPartFilePaths = projectPartIds; - auto removeBeginIterator = std::remove_if(projects_.begin(), projects_.end(), [&processedProjectFilePaths] (const Project &project) { - return processedProjectFilePaths.removeFast(project.projectFilePath()); + auto removeBeginIterator = std::remove_if(projects_.begin(), projects_.end(), [&processedProjectPartFilePaths] (const ProjectPart &project) { + return processedProjectPartFilePaths.removeFast(project.projectPartId()); }); - std::for_each(removeBeginIterator, projects_.end(), [](Project &project) { project.clearProjectFilePath(); }); + std::for_each(removeBeginIterator, projects_.end(), [](ProjectPart &project) { project.clearProjectPartId(); }); projects_.erase(removeBeginIterator, projects_.end()); - if (!processedProjectFilePaths.isEmpty()) - throw ProjectDoesNotExistException(processedProjectFilePaths); + if (!processedProjectPartFilePaths.isEmpty()) + throw ProjectPartDoNotExistException(processedProjectPartFilePaths); } -bool Projects::hasProject(const Utf8String &projectFilePath) const +bool ProjectParts::hasProjectPart(const Utf8String &projectPartId) const { - return findProject(projectFilePath) != projects_.cend(); + return findProjectPart(projectPartId) != projects_.cend(); } -const Project &Projects::project(const Utf8String &projectFilePath) const +const ProjectPart &ProjectParts::project(const Utf8String &projectPartId) const { - const auto findIterator = findProject(projectFilePath); + const auto findIterator = findProjectPart(projectPartId); if (findIterator == projects_.cend()) - throw ProjectDoesNotExistException({projectFilePath}); + throw ProjectPartDoNotExistException({projectPartId}); return *findIterator; } -std::vector<Project>::const_iterator Projects::findProject(const Utf8String &projectFilePath) const +std::vector<ProjectPart>::const_iterator ProjectParts::findProjectPart(const Utf8String &projectPartId) const { - return std::find_if(projects_.begin(), projects_.end(), [projectFilePath] (const Project &project) { - return project.projectFilePath() == projectFilePath; + return std::find_if(projects_.begin(), projects_.end(), [projectPartId] (const ProjectPart &project) { + return project.projectPartId() == projectPartId; }); } -std::vector<Project>::iterator Projects::findProject(const Utf8String &projectFilePath) +std::vector<ProjectPart>::iterator ProjectParts::findProjectPart(const Utf8String &projectPartId) { - return std::find_if(projects_.begin(), projects_.end(), [projectFilePath] (const Project &project) { - return project.projectFilePath() == projectFilePath; + return std::find_if(projects_.begin(), projects_.end(), [projectPartId] (const ProjectPart &project) { + return project.projectPartId() == projectPartId; }); } -const std::vector<Project> &Projects::projects() const +const std::vector<ProjectPart> &ProjectParts::projects() const { return projects_; } -void Projects::createOrUpdateProject(const ProjectContainer &projectContainer) +void ProjectParts::createOrUpdateProjectPart(const ProjectPartContainer &projectContainer) { - auto findIterator = findProject(projectContainer.filePath()); + auto findIterator = findProjectPart(projectContainer.projectPartId()); if (findIterator == projects_.cend()) - projects_.push_back(Project(projectContainer)); + projects_.push_back(ProjectPart(projectContainer)); else findIterator->setArguments(projectContainer.arguments()); } diff --git a/src/tools/codemodelbackend/ipcsource/projects.h b/src/tools/codemodelbackend/ipcsource/projects.h index 7b2b262532..19565c820a 100644 --- a/src/tools/codemodelbackend/ipcsource/projects.h +++ b/src/tools/codemodelbackend/ipcsource/projects.h @@ -31,34 +31,34 @@ #ifndef CODEMODELBACKEND_PROJECTS_H #define CODEMODELBACKEND_PROJECTS_H -#include <projectcontainer.h> +#include <projectpartcontainer.h> -#include "project.h" +#include "projectpart.h" #include <vector> namespace CodeModelBackEnd { -class Projects +class ProjectParts { public: - void createOrUpdate(const QVector<ProjectContainer> &projectConainers); - void remove(const Utf8StringVector &projectFilePaths); + void createOrUpdate(const QVector<ProjectPartContainer> &projectConainers); + void remove(const Utf8StringVector &projectPartIds); - bool hasProject(const Utf8String &projectFilePath) const; + bool hasProjectPart(const Utf8String &projectPartId) const; - const Project &project(const Utf8String &projectFilePath) const; + const ProjectPart &project(const Utf8String &projectPartId) const; - std::vector<Project>::const_iterator findProject(const Utf8String &projectFilePath) const; - std::vector<Project>::iterator findProject(const Utf8String &projectFilePath); + std::vector<ProjectPart>::const_iterator findProjectPart(const Utf8String &projectPartId) const; + std::vector<ProjectPart>::iterator findProjectPart(const Utf8String &projectPartId); - const std::vector<Project> &projects() const; + const std::vector<ProjectPart> &projects() const; private: - void createOrUpdateProject(const ProjectContainer &projectConainer); + void createOrUpdateProjectPart(const ProjectPartContainer &projectConainer); private: - std::vector<Project> projects_; + std::vector<ProjectPart> projects_; }; } // namespace CodeModelbackEnd diff --git a/src/tools/codemodelbackend/ipcsource/translationunit.cpp b/src/tools/codemodelbackend/ipcsource/translationunit.cpp index b8f9b7ca07..7a5f734a4d 100644 --- a/src/tools/codemodelbackend/ipcsource/translationunit.cpp +++ b/src/tools/codemodelbackend/ipcsource/translationunit.cpp @@ -37,10 +37,10 @@ #include "codecompleter.h" #include "translationunitisnullexception.h" -#include "translationunitfilenotexitsexception.h" +#include "translationunitfilenotexitexception.h" #include "translationunitparseerrorexception.h" #include "unsavedfiles.h" -#include "project.h" +#include "projectpart.h" namespace CodeModelBackEnd { @@ -49,12 +49,12 @@ class TranslationUnitData public: TranslationUnitData(const Utf8String &filePath, const UnsavedFiles &unsavedFiles, - const Project &project); + const ProjectPart &projectPart); ~TranslationUnitData(); public: time_point lastChangeTimePoint; - Project project; + ProjectPart projectPart; Utf8String filePath; CXTranslationUnit translationUnit = nullptr; CXIndex index = nullptr; @@ -63,9 +63,9 @@ public: TranslationUnitData::TranslationUnitData(const Utf8String &filePath, const UnsavedFiles &unsavedFiles, - const Project &project) + const ProjectPart &projectPart) : lastChangeTimePoint(std::chrono::high_resolution_clock::now()), - project(project), + projectPart(projectPart), filePath(filePath), unsavedFiles(unsavedFiles) { @@ -79,7 +79,7 @@ TranslationUnitData::~TranslationUnitData() TranslationUnit::TranslationUnit(const Utf8String &filePath, const UnsavedFiles &unsavedFiles, - const Project &project) + const ProjectPart &project) : d(std::make_shared<TranslationUnitData>(filePath, unsavedFiles, project)) { checkIfFileExists(); @@ -123,11 +123,11 @@ const Utf8String &TranslationUnit::filePath() const return d->filePath; } -const Utf8String &TranslationUnit::projectFilePath() const +const Utf8String &TranslationUnit::projectPartId() const { checkIfNull(); - return d->project.projectFilePath(); + return d->projectPart.projectPartId(); } const time_point &TranslationUnit::lastChangeTimePoint() const @@ -154,7 +154,7 @@ void TranslationUnit::updateLastChangeTimePoint() const void TranslationUnit::removeOutdatedTranslationUnit() const { - if (d->project.lastChangeTimePoint() > d->lastChangeTimePoint) { + if (d->projectPart.lastChangeTimePoint() > d->lastChangeTimePoint) { clang_disposeTranslationUnit(d->translationUnit); d->translationUnit = nullptr; } @@ -171,8 +171,8 @@ void TranslationUnit::createTranslationUnitIfNeeded() const d->translationUnit = CXTranslationUnit(); CXErrorCode errorCode = clang_parseTranslationUnit2(index(), d->filePath.constData(), - d->project.cxArguments(), - d->project.argumentCount(), + d->projectPart.cxArguments(), + d->projectPart.argumentCount(), d->unsavedFiles.cxUnsavedFiles(), d->unsavedFiles.count(), options, @@ -188,7 +188,7 @@ void TranslationUnit::checkTranslationUnitErrorCode(CXErrorCode errorCode) const { switch (errorCode) { case CXError_Success: break; - default: throw TranslationUnitParseErrorException(d->filePath, d->project.projectFilePath()); + default: throw TranslationUnitParseErrorException(d->filePath, d->projectPart.projectPartId()); } } @@ -221,7 +221,7 @@ TranslationUnit &TranslationUnit::operator =(TranslationUnit &&other) bool operator ==(const TranslationUnit &first, const TranslationUnit &second) { - return first.filePath() == second.filePath() && first.projectFilePath() == second.projectFilePath(); + return first.filePath() == second.filePath() && first.projectPartId() == second.projectPartId(); } } // namespace CodeModelBackEnd diff --git a/src/tools/codemodelbackend/ipcsource/translationunit.h b/src/tools/codemodelbackend/ipcsource/translationunit.h index 2127c34018..ca038c1cc9 100644 --- a/src/tools/codemodelbackend/ipcsource/translationunit.h +++ b/src/tools/codemodelbackend/ipcsource/translationunit.h @@ -45,7 +45,7 @@ namespace CodeModelBackEnd { class TranslationUnitData; class CodeCompleter; class UnsavedFiles; -class Project; +class ProjectPart; using time_point = std::chrono::high_resolution_clock::time_point; @@ -55,7 +55,7 @@ public: TranslationUnit() = default; TranslationUnit(const Utf8String &filePath, const UnsavedFiles &unsavedFiles, - const Project &project); + const ProjectPart &projectPart); ~TranslationUnit(); TranslationUnit(const TranslationUnit &cxTranslationUnit); @@ -74,7 +74,7 @@ public: uint unsavedFilesCount() const; const Utf8String &filePath() const; - const Utf8String &projectFilePath() const; + const Utf8String &projectPartId() const; const time_point &lastChangeTimePoint() const; diff --git a/src/tools/codemodelbackend/ipcsource/translationunitdoesnotexistsexception.cpp b/src/tools/codemodelbackend/ipcsource/translationunitdoesnotexistexception.cpp index 46663866ae..e823bc9d52 100644 --- a/src/tools/codemodelbackend/ipcsource/translationunitdoesnotexistsexception.cpp +++ b/src/tools/codemodelbackend/ipcsource/translationunitdoesnotexistexception.cpp @@ -28,7 +28,7 @@ ** ****************************************************************************/ -#include "translationunitdoesnotexistsexception.h" +#include "translationunitdoesnotexistexception.h" namespace CodeModelBackEnd { @@ -37,8 +37,8 @@ TranslationUnitDoesNotExistException::TranslationUnitDoesNotExistException(const { } -TranslationUnitDoesNotExistException::TranslationUnitDoesNotExistException(const Utf8String filePath, const Utf8String projectFilePath) - : fileContainer_(filePath, projectFilePath) +TranslationUnitDoesNotExistException::TranslationUnitDoesNotExistException(const Utf8String filePath, const Utf8String projectPartId) + : fileContainer_(filePath, projectPartId) { } @@ -53,7 +53,7 @@ const char *TranslationUnitDoesNotExistException::what() const Q_DECL_NOEXCEPT what_ += Utf8StringLiteral("Parse error for file ") + fileContainer_.filePath() + Utf8StringLiteral(" in project ") - + fileContainer_.projectFilePath() + + fileContainer_.projectPartId() + Utf8StringLiteral("!"); return what_.constData(); diff --git a/src/tools/codemodelbackend/ipcsource/translationunitdoesnotexistsexception.h b/src/tools/codemodelbackend/ipcsource/translationunitdoesnotexistexception.h index 8b1f10db81..8e83ccf2d7 100644 --- a/src/tools/codemodelbackend/ipcsource/translationunitdoesnotexistsexception.h +++ b/src/tools/codemodelbackend/ipcsource/translationunitdoesnotexistexception.h @@ -39,7 +39,7 @@ class TranslationUnitDoesNotExistException : public std::exception { public: TranslationUnitDoesNotExistException(const FileContainer &fileContainer); - TranslationUnitDoesNotExistException(const Utf8String filePath, const Utf8String projectFilePath); + TranslationUnitDoesNotExistException(const Utf8String filePath, const Utf8String projectPartId); const FileContainer &fileContainer() const; diff --git a/src/tools/codemodelbackend/ipcsource/translationunitfilenotexitsexception.cpp b/src/tools/codemodelbackend/ipcsource/translationunitfilenotexitexception.cpp index c6a07d5c06..e1a9a67832 100644 --- a/src/tools/codemodelbackend/ipcsource/translationunitfilenotexitsexception.cpp +++ b/src/tools/codemodelbackend/ipcsource/translationunitfilenotexitexception.cpp @@ -28,7 +28,7 @@ ** ****************************************************************************/ -#include "translationunitfilenotexitsexception.h" +#include "translationunitfilenotexitexception.h" namespace CodeModelBackEnd { diff --git a/src/tools/codemodelbackend/ipcsource/translationunitfilenotexitsexception.h b/src/tools/codemodelbackend/ipcsource/translationunitfilenotexitexception.h index 8cb77e038c..8cb77e038c 100644 --- a/src/tools/codemodelbackend/ipcsource/translationunitfilenotexitsexception.h +++ b/src/tools/codemodelbackend/ipcsource/translationunitfilenotexitexception.h diff --git a/src/tools/codemodelbackend/ipcsource/translationunitparseerrorexception.cpp b/src/tools/codemodelbackend/ipcsource/translationunitparseerrorexception.cpp index 3fd8f26817..3f4649c68b 100644 --- a/src/tools/codemodelbackend/ipcsource/translationunitparseerrorexception.cpp +++ b/src/tools/codemodelbackend/ipcsource/translationunitparseerrorexception.cpp @@ -34,9 +34,9 @@ namespace CodeModelBackEnd { -TranslationUnitParseErrorException::TranslationUnitParseErrorException(const Utf8String &filePath, const Utf8String &projectFilePath) +TranslationUnitParseErrorException::TranslationUnitParseErrorException(const Utf8String &filePath, const Utf8String &projectPartId) : filePath_(filePath), - projectFilePath_(projectFilePath) + projectPartId_(projectPartId) { } @@ -45,9 +45,9 @@ const Utf8String &TranslationUnitParseErrorException::filePath() const return filePath_; } -const Utf8String &TranslationUnitParseErrorException::projectFilePath() const +const Utf8String &TranslationUnitParseErrorException::projectPartId() const { - return projectFilePath_; + return projectPartId_; } const char *TranslationUnitParseErrorException::what() const Q_DECL_NOEXCEPT @@ -56,7 +56,7 @@ const char *TranslationUnitParseErrorException::what() const Q_DECL_NOEXCEPT what_ += Utf8StringLiteral("Parse error for file ") + filePath() + Utf8StringLiteral(" in project ") - + projectFilePath() + + projectPartId() + Utf8StringLiteral("!"); return what_.constData(); diff --git a/src/tools/codemodelbackend/ipcsource/translationunitparseerrorexception.h b/src/tools/codemodelbackend/ipcsource/translationunitparseerrorexception.h index 4fbe100784..1d539e52a6 100644 --- a/src/tools/codemodelbackend/ipcsource/translationunitparseerrorexception.h +++ b/src/tools/codemodelbackend/ipcsource/translationunitparseerrorexception.h @@ -40,16 +40,16 @@ namespace CodeModelBackEnd { class TranslationUnitParseErrorException : public std::exception { public: - TranslationUnitParseErrorException(const Utf8String &filePath, const Utf8String &projectFilePath); + TranslationUnitParseErrorException(const Utf8String &filePath, const Utf8String &projectPartId); const Utf8String &filePath() const; - const Utf8String &projectFilePath() const; + const Utf8String &projectPartId() const; const char *what() const Q_DECL_NOEXCEPT override; private: Utf8String filePath_; - Utf8String projectFilePath_; + Utf8String projectPartId_; mutable Utf8String what_; }; diff --git a/src/tools/codemodelbackend/ipcsource/translationunits.cpp b/src/tools/codemodelbackend/ipcsource/translationunits.cpp index 2e9c12cfc8..c20320ad4c 100644 --- a/src/tools/codemodelbackend/ipcsource/translationunits.cpp +++ b/src/tools/codemodelbackend/ipcsource/translationunits.cpp @@ -31,14 +31,14 @@ #include "translationunits.h" #include <projects.h> -#include <translationunitdoesnotexistsexception.h> -#include <projectdoesnotexistsexception.h> +#include <translationunitdoesnotexistexception.h> +#include <projectpartsdonotexistexception.h> namespace CodeModelBackEnd { bool operator ==(const FileContainer &fileContainer, const TranslationUnit &translationUnit) { - return fileContainer.filePath() == translationUnit.filePath() && fileContainer.projectFilePath() == translationUnit.projectFilePath(); + return fileContainer.filePath() == translationUnit.filePath() && fileContainer.projectPartId() == translationUnit.projectPartId(); } bool operator ==(const TranslationUnit &translationUnit, const FileContainer &fileContainer) @@ -47,7 +47,7 @@ bool operator ==(const TranslationUnit &translationUnit, const FileContainer &fi } -TranslationUnits::TranslationUnits(Projects &projects, UnsavedFiles &unsavedFiles) +TranslationUnits::TranslationUnits(ProjectParts &projects, UnsavedFiles &unsavedFiles) : projects(projects), unsavedFiles(unsavedFiles) { @@ -73,7 +73,7 @@ static bool removeFromFileContainer(QVector<FileContainer> &fileContainers, cons void TranslationUnits::remove(const QVector<FileContainer> &fileContainers) { - checkIfProjectsExists(fileContainers); + checkIfProjectPartsExists(fileContainers); QVector<FileContainer> processedFileContainers = fileContainers; @@ -88,14 +88,14 @@ void TranslationUnits::remove(const QVector<FileContainer> &fileContainers) } -const TranslationUnit &TranslationUnits::translationUnit(const Utf8String &filePath, const Utf8String &projectFilePath) const +const TranslationUnit &TranslationUnits::translationUnit(const Utf8String &filePath, const Utf8String &projectPartId) const { - checkIfProjectExists(projectFilePath); + checkIfProjectPartExists(projectPartId); - auto findIterator = findTranslationUnit(filePath, projectFilePath); + auto findIterator = findTranslationUnit(filePath, projectPartId); if (findIterator == translationUnits_.end()) - throw TranslationUnitDoesNotExistException(FileContainer(filePath, projectFilePath)); + throw TranslationUnitDoesNotExistException(FileContainer(filePath, projectPartId)); return *findIterator; } @@ -109,7 +109,7 @@ void TranslationUnits::createOrUpdateTranslationUnit(const FileContainer &fileCo { auto findIterator = findTranslationUnit(fileContainer); if (findIterator == translationUnits_.end()) - translationUnits_.push_back(TranslationUnit(fileContainer.filePath(), unsavedFiles, projects.project(fileContainer.projectFilePath()))); + translationUnits_.push_back(TranslationUnit(fileContainer.filePath(), unsavedFiles, projects.project(fileContainer.projectPartId()))); } std::vector<TranslationUnit>::iterator TranslationUnits::findTranslationUnit(const FileContainer &fileContainer) @@ -117,28 +117,28 @@ std::vector<TranslationUnit>::iterator TranslationUnits::findTranslationUnit(con return std::find(translationUnits_.begin(), translationUnits_.end(), fileContainer); } -std::vector<TranslationUnit>::const_iterator TranslationUnits::findTranslationUnit(const Utf8String &filePath, const Utf8String &projectFilePath) const +std::vector<TranslationUnit>::const_iterator TranslationUnits::findTranslationUnit(const Utf8String &filePath, const Utf8String &projectPartId) const { - FileContainer fileContainer(filePath, projectFilePath); + FileContainer fileContainer(filePath, projectPartId); return std::find(translationUnits_.begin(), translationUnits_.end(), fileContainer); } -void TranslationUnits::checkIfProjectExists(const Utf8String &projectFileName) const +void TranslationUnits::checkIfProjectPartExists(const Utf8String &projectFileName) const { projects.project(projectFileName); } -void TranslationUnits::checkIfProjectsExists(const QVector<FileContainer> &fileContainers) const +void TranslationUnits::checkIfProjectPartsExists(const QVector<FileContainer> &fileContainers) const { - Utf8StringVector notExistingProjects; + Utf8StringVector notExistingProjectParts; for (const FileContainer &fileContainer : fileContainers) { - if (!projects.hasProject(fileContainer.projectFilePath())) - notExistingProjects.push_back(fileContainer.projectFilePath()); + if (!projects.hasProjectPart(fileContainer.projectPartId())) + notExistingProjectParts.push_back(fileContainer.projectPartId()); } - if (!notExistingProjects.isEmpty()) - throw ProjectDoesNotExistException(notExistingProjects); + if (!notExistingProjectParts.isEmpty()) + throw ProjectPartDoNotExistException(notExistingProjectParts); } diff --git a/src/tools/codemodelbackend/ipcsource/translationunits.h b/src/tools/codemodelbackend/ipcsource/translationunits.h index eb370422ae..0245901898 100644 --- a/src/tools/codemodelbackend/ipcsource/translationunits.h +++ b/src/tools/codemodelbackend/ipcsource/translationunits.h @@ -40,32 +40,32 @@ namespace CodeModelBackEnd { -class Projects; +class ProjectParts; class UnsavedFiles; class TranslationUnits { public: - TranslationUnits(Projects &projects, UnsavedFiles &unsavedFiles); + TranslationUnits(ProjectParts &projects, UnsavedFiles &unsavedFiles); void createOrUpdate(const QVector<FileContainer> &fileContainers); void remove(const QVector<FileContainer> &fileContainers); - const TranslationUnit &translationUnit(const Utf8String &filePath, const Utf8String &projectFilePath) const; + const TranslationUnit &translationUnit(const Utf8String &filePath, const Utf8String &projectPartId) const; const std::vector<TranslationUnit> &translationUnits() const; private: void createOrUpdateTranslationUnit(const FileContainer &fileContainer); std::vector<TranslationUnit>::iterator findTranslationUnit(const FileContainer &fileContainer); - std::vector<TranslationUnit>::const_iterator findTranslationUnit(const Utf8String &filePath, const Utf8String &projectFilePath) const; - void checkIfProjectExists(const Utf8String &projectFileName) const; - void checkIfProjectsExists(const QVector<FileContainer> &fileContainers) const; + std::vector<TranslationUnit>::const_iterator findTranslationUnit(const Utf8String &filePath, const Utf8String &projectPartId) const; + void checkIfProjectPartExists(const Utf8String &projectFileName) const; + void checkIfProjectPartsExists(const QVector<FileContainer> &fileContainers) const; private: std::vector<TranslationUnit> translationUnits_; - Projects &projects; + ProjectParts &projects; UnsavedFiles &unsavedFiles; }; diff --git a/tests/unit/codemodelbackend/process/echoipcserver.cpp b/tests/unit/codemodelbackend/process/echoipcserver.cpp index 85f3c72981..669a22f767 100644 --- a/tests/unit/codemodelbackend/process/echoipcserver.cpp +++ b/tests/unit/codemodelbackend/process/echoipcserver.cpp @@ -68,12 +68,12 @@ void EchoIpcServer::unregisterTranslationUnitsForCodeCompletion(const Unregister echoCommand(QVariant::fromValue(command)); } -void EchoIpcServer::registerProjectsForCodeCompletion(const RegisterProjectsForCodeCompletionCommand &command) +void EchoIpcServer::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command) { echoCommand(QVariant::fromValue(command)); } -void EchoIpcServer::unregisterProjectsForCodeCompletion(const UnregisterProjectsForCodeCompletionCommand &command) +void EchoIpcServer::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command) { echoCommand(QVariant::fromValue(command)); } diff --git a/tests/unit/codemodelbackend/process/echoipcserver.h b/tests/unit/codemodelbackend/process/echoipcserver.h index 00204614af..49d71bd804 100644 --- a/tests/unit/codemodelbackend/process/echoipcserver.h +++ b/tests/unit/codemodelbackend/process/echoipcserver.h @@ -42,8 +42,8 @@ public: void end() override; void registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionCommand &command) override; void unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionCommand &command) override; - void registerProjectsForCodeCompletion(const RegisterProjectsForCodeCompletionCommand &command) override; - void unregisterProjectsForCodeCompletion(const UnregisterProjectsForCodeCompletionCommand &command) override; + void registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command) override; + void unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command) override; void completeCode(const CompleteCodeCommand &command) override; private: diff --git a/tests/unit/codemodelbackend/process/process.pro b/tests/unit/codemodelbackend/process/process.pro index a6a8fbb47f..3bef994a72 100644 --- a/tests/unit/codemodelbackend/process/process.pro +++ b/tests/unit/codemodelbackend/process/process.pro @@ -1,9 +1,3 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2014-12-17T14:40:23 -# -#------------------------------------------------- - QT += core network QT -= gui diff --git a/tests/unit/codemodelbackend/unittest/clangcodecompleteresultstest.cpp b/tests/unit/codemodelbackend/unittest/clangcodecompleteresultstest.cpp index 063ea6dd8e..98278fa976 100644 --- a/tests/unit/codemodelbackend/unittest/clangcodecompleteresultstest.cpp +++ b/tests/unit/codemodelbackend/unittest/clangcodecompleteresultstest.cpp @@ -36,7 +36,7 @@ #include <clangcodecompleteresults.h> #include <translationunit.h> -#include <project.h> +#include <projectpart.h> #include <unsavedfiles.h> #include <utf8string.h> @@ -45,13 +45,13 @@ namespace { using CodeModelBackEnd::ClangCodeCompleteResults; using CodeModelBackEnd::TranslationUnit; using CodeModelBackEnd::UnsavedFiles; -using CodeModelBackEnd::Project; +using CodeModelBackEnd::ProjectPart; TEST(ClangCodeCompleteResults, GetData) { - Project project(Utf8StringLiteral("/path/to/projectfile")); + ProjectPart projectPart(Utf8StringLiteral("projectPartId")); UnsavedFiles unsavedFiles; - TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), unsavedFiles, project); + TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), unsavedFiles, projectPart); CXCodeCompleteResults *cxCodeCompleteResults = clang_codeCompleteAt(translationUnit.cxTranslationUnit(), translationUnit.filePath().constData(), 49, 1, 0, 0, 0); ClangCodeCompleteResults codeCompleteResults(cxCodeCompleteResults); @@ -70,9 +70,9 @@ TEST(ClangCodeCompleteResults, GetInvalidData) TEST(ClangCodeCompleteResults, MoveClangCodeCompleteResults) { - Project project(Utf8StringLiteral("/path/to/projectfile")); + ProjectPart projectPart(Utf8StringLiteral("projectPartId")); UnsavedFiles unsavedFiles; - TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), unsavedFiles, project); + TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), unsavedFiles, projectPart); CXCodeCompleteResults *cxCodeCompleteResults = clang_codeCompleteAt(translationUnit.cxTranslationUnit(), translationUnit.filePath().constData(), 49, 1, 0, 0, 0); ClangCodeCompleteResults codeCompleteResults(cxCodeCompleteResults); diff --git a/tests/unit/codemodelbackend/unittest/clangipcservertest.cpp b/tests/unit/codemodelbackend/unittest/clangipcservertest.cpp index ae2af9c2ba..396b4fe8c8 100644 --- a/tests/unit/codemodelbackend/unittest/clangipcservertest.cpp +++ b/tests/unit/codemodelbackend/unittest/clangipcservertest.cpp @@ -37,7 +37,7 @@ #include <ipcclientproxy.h> #include <ipcserverproxy.h> #include <clangipcserver.h> -#include <translationunitdoesnotexistsexception.h> +#include <translationunitdoesnotexistexception.h> #include <translationunitparseerrorexception.h> #include <cmbcodecompletedcommand.h> @@ -47,12 +47,12 @@ #include <cmbunregistertranslationunitsforcodecompletioncommand.h> #include <cmbregisterprojectsforcodecompletioncommand.h> #include <cmbunregisterprojectsforcodecompletioncommand.h> -#include <translationunitdoesnotexistscommand.h> -#include <projectdoesnotexistscommand.h> +#include <translationunitdoesnotexistcommand.h> +#include <projectpartsdonotexistcommand.h> #include <QBuffer> #include <QFile> -#include <projectdoesnotexistscommand.h> +#include <projectpartsdonotexistcommand.h> #include "mockipclient.h" @@ -65,15 +65,15 @@ namespace { using CodeModelBackEnd::RegisterTranslationUnitForCodeCompletionCommand; using CodeModelBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand; -using CodeModelBackEnd::RegisterProjectsForCodeCompletionCommand; -using CodeModelBackEnd::UnregisterProjectsForCodeCompletionCommand; +using CodeModelBackEnd::RegisterProjectPartsForCodeCompletionCommand; +using CodeModelBackEnd::UnregisterProjectPartsForCodeCompletionCommand; using CodeModelBackEnd::CompleteCodeCommand; using CodeModelBackEnd::CodeCompletedCommand; using CodeModelBackEnd::CodeCompletion; using CodeModelBackEnd::FileContainer; -using CodeModelBackEnd::ProjectContainer; +using CodeModelBackEnd::ProjectPartContainer; using CodeModelBackEnd::TranslationUnitDoesNotExistCommand; -using CodeModelBackEnd::ProjectDoesNotExistCommand; +using CodeModelBackEnd::ProjectPartsDoNotExistCommand; class ClangIpcServer : public ::testing::Test { @@ -81,15 +81,15 @@ protected: void SetUp() override; void registerFiles(); - void registerProject(); - void changeProjectArguments(); - void changeProjectArgumentsToWrongValues(); + void registerProjectPart(); + void changeProjectPartArguments(); + void changeProjectPartArgumentsToWrongValues(); static const Utf8String unsavedContent(const QString &unsavedFilePath); protected: MockIpcClient mockIpcClient; CodeModelBackEnd::ClangIpcServer clangServer; - const Utf8String projectFilePath = Utf8StringLiteral("pathToProject.pro"); + const Utf8String projectPartId = Utf8StringLiteral("pathToProjectPart.pro"); const Utf8String functionTestFilePath = Utf8StringLiteral("data/complete_extractor_function.cpp"); const Utf8String variableTestFilePath = Utf8StringLiteral("data/complete_extractor_variable.cpp"); const QString unsavedTestFilePath = QStringLiteral("data/complete_extractor_function_unsaved.cpp"); @@ -101,37 +101,37 @@ protected: void ClangIpcServer::SetUp() { clangServer.addClient(&mockIpcClient); - registerProject(); + registerProjectPart(); registerFiles(); } void ClangIpcServer::registerFiles() { - RegisterTranslationUnitForCodeCompletionCommand command({FileContainer(functionTestFilePath, projectFilePath, unsavedContent(unsavedTestFilePath), true), - FileContainer(variableTestFilePath, projectFilePath)}); + RegisterTranslationUnitForCodeCompletionCommand command({FileContainer(functionTestFilePath, projectPartId, unsavedContent(unsavedTestFilePath), true), + FileContainer(variableTestFilePath, projectPartId)}); clangServer.registerTranslationUnitsForCodeCompletion(command); } -void ClangIpcServer::registerProject() +void ClangIpcServer::registerProjectPart() { - RegisterProjectsForCodeCompletionCommand command({ProjectContainer(projectFilePath)}); + RegisterProjectPartsForCodeCompletionCommand command({ProjectPartContainer(projectPartId)}); - clangServer.registerProjectsForCodeCompletion(command); + clangServer.registerProjectPartsForCodeCompletion(command); } -void ClangIpcServer::changeProjectArguments() +void ClangIpcServer::changeProjectPartArguments() { - RegisterProjectsForCodeCompletionCommand command({ProjectContainer(projectFilePath, {Utf8StringLiteral("-DArgumentDefinition")})}); + RegisterProjectPartsForCodeCompletionCommand command({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-DArgumentDefinition")})}); - clangServer.registerProjectsForCodeCompletion(command); + clangServer.registerProjectPartsForCodeCompletion(command); } -void ClangIpcServer::changeProjectArgumentsToWrongValues() +void ClangIpcServer::changeProjectPartArgumentsToWrongValues() { - RegisterProjectsForCodeCompletionCommand command({ProjectContainer(projectFilePath, {Utf8StringLiteral("-blah")})}); + RegisterProjectPartsForCodeCompletionCommand command({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-blah")})}); - clangServer.registerProjectsForCodeCompletion(command); + clangServer.registerProjectPartsForCodeCompletion(command); } const Utf8String ClangIpcServer::unsavedContent(const QString &unsavedFilePath) @@ -149,7 +149,7 @@ TEST_F(ClangIpcServer, GetCodeCompletion) CompleteCodeCommand completeCodeCommand(functionTestFilePath, 20, 1, - projectFilePath); + projectPartId); CodeCompletion codeCompletion(Utf8StringLiteral("Function"), Utf8String(), Utf8String(), @@ -167,7 +167,7 @@ TEST_F(ClangIpcServer, GetCodeCompletionDependingOnArgumets) CompleteCodeCommand completeCodeCommand(variableTestFilePath, 35, 1, - projectFilePath); + projectPartId); CodeCompletion codeCompletion(Utf8StringLiteral("ArgumentDefinitionVariable"), Utf8String(), Utf8String(), @@ -177,7 +177,7 @@ TEST_F(ClangIpcServer, GetCodeCompletionDependingOnArgumets) EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedCommand::codeCompletions, Contains(codeCompletion)))) .Times(1); - changeProjectArguments(); + changeProjectPartArguments(); clangServer.completeCode(completeCodeCommand); } @@ -186,8 +186,8 @@ TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForCodeCompletionOnNonExist CompleteCodeCommand completeCodeCommand(Utf8StringLiteral("dontexists.cpp"), 34, 1, - projectFilePath); - TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(Utf8StringLiteral("dontexists.cpp"), projectFilePath); + projectPartId); + TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(Utf8StringLiteral("dontexists.cpp"), projectPartId); EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistCommand)) .Times(1); @@ -200,8 +200,8 @@ TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForCompletingUnregisteredFi CompleteCodeCommand completeCodeCommand(parseErrorTestFilePath, 20, 1, - projectFilePath); - TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(parseErrorTestFilePath, projectFilePath); + projectPartId); + TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(parseErrorTestFilePath, projectPartId); EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistCommand)) .Times(1); @@ -214,7 +214,7 @@ TEST_F(ClangIpcServer, GetCodeCompletionForUnsavedFile) CompleteCodeCommand completeCodeCommand(functionTestFilePath, 20, 1, - projectFilePath); + projectPartId); CodeCompletion codeCompletion(Utf8StringLiteral("Method2"), Utf8String(), Utf8String(), @@ -229,11 +229,11 @@ TEST_F(ClangIpcServer, GetCodeCompletionForUnsavedFile) TEST_F(ClangIpcServer, GetNoCodeCompletionAfterRemovingUnsavedFile) { - clangServer.registerTranslationUnitsForCodeCompletion(RegisterTranslationUnitForCodeCompletionCommand({FileContainer(functionTestFilePath, projectFilePath)})); + clangServer.registerTranslationUnitsForCodeCompletion(RegisterTranslationUnitForCodeCompletionCommand({FileContainer(functionTestFilePath, projectPartId)})); CompleteCodeCommand completeCodeCommand(functionTestFilePath, 20, 1, - projectFilePath); + projectPartId); CodeCompletion codeCompletion(Utf8StringLiteral("Method2"), Utf8String(), Utf8String(), @@ -249,13 +249,13 @@ TEST_F(ClangIpcServer, GetNoCodeCompletionAfterRemovingUnsavedFile) TEST_F(ClangIpcServer, GetNewCodeCompletionAfterUpdatingUnsavedFile) { clangServer.registerTranslationUnitsForCodeCompletion(RegisterTranslationUnitForCodeCompletionCommand({FileContainer(functionTestFilePath, - projectFilePath, + projectPartId, unsavedContent(updatedUnsavedTestFilePath), true)})); CompleteCodeCommand completeCodeCommand(functionTestFilePath, 20, 1, - projectFilePath); + projectPartId); CodeCompletion codeCompletion(Utf8StringLiteral("Method3"), Utf8String(), Utf8String(), @@ -270,7 +270,7 @@ TEST_F(ClangIpcServer, GetNewCodeCompletionAfterUpdatingUnsavedFile) TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForUnregisterTranslationUnitWithWrongFilePath) { - FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), projectFilePath); + FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), projectPartId); UnregisterTranslationUnitsForCodeCompletionCommand command({fileContainer}); TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(fileContainer); @@ -282,13 +282,13 @@ TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForUnregisterTranslationUni TEST_F(ClangIpcServer, UnregisterTranslationUnitAndTestFailingCompletion) { - FileContainer fileContainer(functionTestFilePath, projectFilePath); + FileContainer fileContainer(functionTestFilePath, projectPartId); UnregisterTranslationUnitsForCodeCompletionCommand command({fileContainer}); clangServer.unregisterTranslationUnitsForCodeCompletion(command); CompleteCodeCommand completeCodeCommand(functionTestFilePath, 20, 1, - projectFilePath); + projectPartId); TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(fileContainer); EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistCommand)) @@ -297,64 +297,64 @@ TEST_F(ClangIpcServer, UnregisterTranslationUnitAndTestFailingCompletion) clangServer.completeCode(completeCodeCommand); } -TEST_F(ClangIpcServer, GetProjectDoesNotExistUnregisterProjectInexistingProject) +TEST_F(ClangIpcServer, GetProjectPartDoesNotExistUnregisterProjectPartInexistingProjectPart) { - Utf8StringVector inexistingProjectFilePath = {Utf8StringLiteral("projectdoesnotexists.pro"), Utf8StringLiteral("project2doesnotexists.pro")}; - UnregisterProjectsForCodeCompletionCommand unregisterProjectsForCodeCompletionCommand(inexistingProjectFilePath); - ProjectDoesNotExistCommand projectDoesNotExistCommand(inexistingProjectFilePath); + Utf8StringVector inexistingProjectPartFilePath = {Utf8StringLiteral("projectpartsdoesnotexist.pro"), Utf8StringLiteral("project2doesnotexists.pro")}; + UnregisterProjectPartsForCodeCompletionCommand unregisterProjectPartsForCodeCompletionCommand(inexistingProjectPartFilePath); + ProjectPartsDoNotExistCommand projectPartsDoNotExistCommand(inexistingProjectPartFilePath); - EXPECT_CALL(mockIpcClient, projectDoesNotExist(projectDoesNotExistCommand)) + EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistCommand)) .Times(1); - clangServer.unregisterProjectsForCodeCompletion(unregisterProjectsForCodeCompletionCommand); + clangServer.unregisterProjectPartsForCodeCompletion(unregisterProjectPartsForCodeCompletionCommand); } -TEST_F(ClangIpcServer, GetProjectDoesNotExistRegisterTranslationUnitWithInexistingProject) +TEST_F(ClangIpcServer, GetProjectPartDoesNotExistRegisterTranslationUnitWithInexistingProjectPart) { - Utf8String inexistingProjectFilePath = Utf8StringLiteral("projectdoesnotexists.pro"); - RegisterTranslationUnitForCodeCompletionCommand registerFileForCodeCompletionCommand({FileContainer(variableTestFilePath, inexistingProjectFilePath)}); - ProjectDoesNotExistCommand projectDoesNotExistCommand({inexistingProjectFilePath}); + Utf8String inexistingProjectPartFilePath = Utf8StringLiteral("projectpartsdoesnotexist.pro"); + RegisterTranslationUnitForCodeCompletionCommand registerFileForCodeCompletionCommand({FileContainer(variableTestFilePath, inexistingProjectPartFilePath)}); + ProjectPartsDoNotExistCommand projectPartsDoNotExistCommand({inexistingProjectPartFilePath}); - EXPECT_CALL(mockIpcClient, projectDoesNotExist(projectDoesNotExistCommand)) + EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistCommand)) .Times(1); clangServer.registerTranslationUnitsForCodeCompletion(registerFileForCodeCompletionCommand); } -TEST_F(ClangIpcServer, GetProjectDoesNotExistUnregisterTranslationUnitWithInexistingProject) +TEST_F(ClangIpcServer, GetProjectPartDoesNotExistUnregisterTranslationUnitWithInexistingProjectPart) { - Utf8String inexistingProjectFilePath = Utf8StringLiteral("projectdoesnotexists.pro"); - UnregisterTranslationUnitsForCodeCompletionCommand unregisterFileForCodeCompletionCommand({FileContainer(variableTestFilePath, inexistingProjectFilePath)}); - ProjectDoesNotExistCommand projectDoesNotExistCommand({inexistingProjectFilePath}); + Utf8String inexistingProjectPartFilePath = Utf8StringLiteral("projectpartsdoesnotexist.pro"); + UnregisterTranslationUnitsForCodeCompletionCommand unregisterFileForCodeCompletionCommand({FileContainer(variableTestFilePath, inexistingProjectPartFilePath)}); + ProjectPartsDoNotExistCommand projectPartsDoNotExistCommand({inexistingProjectPartFilePath}); - EXPECT_CALL(mockIpcClient, projectDoesNotExist(projectDoesNotExistCommand)) + EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistCommand)) .Times(1); clangServer.unregisterTranslationUnitsForCodeCompletion(unregisterFileForCodeCompletionCommand); } -TEST_F(ClangIpcServer, GetProjectDoesNotExistForCompletingProjectFile) +TEST_F(ClangIpcServer, GetProjectPartDoesNotExistForCompletingProjectPartFile) { - Utf8String inexistingProjectFilePath = Utf8StringLiteral("projectdoesnotexists.pro"); + Utf8String inexistingProjectPartFilePath = Utf8StringLiteral("projectpartsdoesnotexist.pro"); CompleteCodeCommand completeCodeCommand(variableTestFilePath, 20, 1, - inexistingProjectFilePath); - ProjectDoesNotExistCommand projectDoesNotExistCommand({inexistingProjectFilePath}); + inexistingProjectPartFilePath); + ProjectPartsDoNotExistCommand projectPartsDoNotExistCommand({inexistingProjectPartFilePath}); - EXPECT_CALL(mockIpcClient, projectDoesNotExist(projectDoesNotExistCommand)) + EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistCommand)) .Times(1); clangServer.completeCode(completeCodeCommand); } -TEST_F(ClangIpcServer, GetProjectDoesNotExistForCompletingUnregisteredFile) +TEST_F(ClangIpcServer, GetProjectPartDoesNotExistForCompletingUnregisteredFile) { CompleteCodeCommand completeCodeCommand(parseErrorTestFilePath, 20, 1, - projectFilePath); - TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(parseErrorTestFilePath, projectFilePath); + projectPartId); + TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(parseErrorTestFilePath, projectPartId); EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistCommand)) .Times(1); @@ -367,7 +367,7 @@ TEST_F(ClangIpcServer, TicketNumberIsForwarded) CompleteCodeCommand completeCodeCommand(functionTestFilePath, 20, 1, - projectFilePath); + projectPartId); CodeCompletion codeCompletion(Utf8StringLiteral("Function"), Utf8String(), Utf8String(), diff --git a/tests/unit/codemodelbackend/unittest/clientserverinprocesstest.cpp b/tests/unit/codemodelbackend/unittest/clientserverinprocesstest.cpp index dc4a25b641..78837a75c8 100644 --- a/tests/unit/codemodelbackend/unittest/clientserverinprocesstest.cpp +++ b/tests/unit/codemodelbackend/unittest/clientserverinprocesstest.cpp @@ -33,7 +33,7 @@ #include "gmock/gmock.h" #include "gtest-qt-printing.h" -#include "translationunitdoesnotexistscommand.h" +#include "translationunitdoesnotexistcommand.h" #include <QString> #include <QBuffer> @@ -55,7 +55,7 @@ #include <ipcserverproxy.h> #include <ipcclientproxy.h> -#include <projectdoesnotexistscommand.h> +#include <projectpartsdonotexistcommand.h> #include "mockipclient.h" #include "mockipcserver.h" @@ -109,7 +109,7 @@ TEST_F(ClientServerInProcess, SendAliveCommand) TEST_F(ClientServerInProcess, SendRegisterTranslationUnitForCodeCompletionCommand) { CodeModelBackEnd::FileContainer fileContainer(Utf8StringLiteral("data/complete_extractor_function.cpp"), - Utf8StringLiteral("pathToProject.pro")); + Utf8StringLiteral("pathToProjectPart.pro")); CodeModelBackEnd::RegisterTranslationUnitForCodeCompletionCommand command({fileContainer}); EXPECT_CALL(mockIpcServer, registerTranslationUnitsForCodeCompletion(command)) @@ -121,7 +121,7 @@ TEST_F(ClientServerInProcess, SendRegisterTranslationUnitForCodeCompletionComman TEST_F(ClientServerInProcess, SendUnregisterTranslationUnitsForCodeCompletionCommand) { - CodeModelBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("pathToProject.pro")); + CodeModelBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("pathToProjectPart.pro")); CodeModelBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand command({fileContainer}); EXPECT_CALL(mockIpcServer, unregisterTranslationUnitsForCodeCompletion(command)) @@ -154,33 +154,33 @@ TEST_F(ClientServerInProcess, SendCodeCompletedCommand) scheduleClientCommands(); } -TEST_F(ClientServerInProcess, SendRegisterProjectsForCodeCompletionCommand) +TEST_F(ClientServerInProcess, SendRegisterProjectPartsForCodeCompletionCommand) { - CodeModelBackEnd::ProjectContainer projectContainer(Utf8StringLiteral("data/complete.pro")); - CodeModelBackEnd::RegisterProjectsForCodeCompletionCommand command({projectContainer}); + CodeModelBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("data/complete.pro")); + CodeModelBackEnd::RegisterProjectPartsForCodeCompletionCommand command({projectContainer}); - EXPECT_CALL(mockIpcServer, registerProjectsForCodeCompletion(command)) + EXPECT_CALL(mockIpcServer, registerProjectPartsForCodeCompletion(command)) .Times(1); - serverProxy.registerProjectsForCodeCompletion(command); + serverProxy.registerProjectPartsForCodeCompletion(command); scheduleServerCommands(); } -TEST_F(ClientServerInProcess, SendUnregisterProjectsForCodeCompletionCommand) +TEST_F(ClientServerInProcess, SendUnregisterProjectPartsForCodeCompletionCommand) { - CodeModelBackEnd::UnregisterProjectsForCodeCompletionCommand command({Utf8StringLiteral("data/complete.pro")}); + CodeModelBackEnd::UnregisterProjectPartsForCodeCompletionCommand command({Utf8StringLiteral("data/complete.pro")}); - EXPECT_CALL(mockIpcServer, unregisterProjectsForCodeCompletion(command)) + EXPECT_CALL(mockIpcServer, unregisterProjectPartsForCodeCompletion(command)) .Times(1); - serverProxy.unregisterProjectsForCodeCompletion(command); + serverProxy.unregisterProjectPartsForCodeCompletion(command); scheduleServerCommands(); } TEST_F(ClientServerInProcess, SendTranslationUnitDoesNotExistCommand) { CodeModelBackEnd::FileContainer fileContainer(Utf8StringLiteral("data/complete_extractor_function.cpp"), - Utf8StringLiteral("pathToProject.pro")); + Utf8StringLiteral("pathToProjectPart.pro")); CodeModelBackEnd::TranslationUnitDoesNotExistCommand command(fileContainer); EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(command)) @@ -191,14 +191,14 @@ TEST_F(ClientServerInProcess, SendTranslationUnitDoesNotExistCommand) } -TEST_F(ClientServerInProcess, SendProjectDoesNotExistCommand) +TEST_F(ClientServerInProcess, SendProjectPartDoesNotExistCommand) { - CodeModelBackEnd::ProjectDoesNotExistCommand command({Utf8StringLiteral("pathToProject.pro")}); + CodeModelBackEnd::ProjectPartsDoNotExistCommand command({Utf8StringLiteral("pathToProjectPart.pro")}); - EXPECT_CALL(mockIpcClient, projectDoesNotExist(command)) + EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(command)) .Times(1); - clientProxy.projectDoesNotExist(command); + clientProxy.projectPartsDoNotExist(command); scheduleClientCommands(); } ClientServerInProcess::ClientServerInProcess() diff --git a/tests/unit/codemodelbackend/unittest/clientserveroutsideprocess.cpp b/tests/unit/codemodelbackend/unittest/clientserveroutsideprocess.cpp index 3fb9d1de56..4af8f1a861 100644 --- a/tests/unit/codemodelbackend/unittest/clientserveroutsideprocess.cpp +++ b/tests/unit/codemodelbackend/unittest/clientserveroutsideprocess.cpp @@ -54,8 +54,8 @@ #include <writecommandblock.h> #include <readcommandblock.h> #include <connectionclient.h> -#include <translationunitdoesnotexistscommand.h> -#include <projectdoesnotexistscommand.h> +#include <translationunitdoesnotexistcommand.h> +#include <projectpartsdonotexistcommand.h> #include <mockipclient.h> @@ -98,7 +98,7 @@ TEST_F(ClientServerOutsideProcess, ResetAliveTimer) TEST_F(ClientServerOutsideProcess, SendRegisterTranslationUnitForCodeCompletionCommand) { - CodeModelBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo"), Utf8StringLiteral("pathToProject.pro")); + CodeModelBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo"), Utf8StringLiteral("pathToProjectPart.pro")); CodeModelBackEnd::RegisterTranslationUnitForCodeCompletionCommand registerTranslationUnitForCodeCompletionCommand({fileContainer}); EchoCommand echoCommand(QVariant::fromValue(registerTranslationUnitForCodeCompletionCommand)); @@ -134,28 +134,28 @@ TEST_F(ClientServerOutsideProcess, SendCompleteCodeCommand) ASSERT_TRUE(client.waitForEcho()); } -TEST_F(ClientServerOutsideProcess, SendRegisterProjectsForCodeCompletionCommand) +TEST_F(ClientServerOutsideProcess, SendRegisterProjectPartsForCodeCompletionCommand) { - CodeModelBackEnd::ProjectContainer projectContainer(Utf8StringLiteral("data/complete.pro")); - CodeModelBackEnd::RegisterProjectsForCodeCompletionCommand registerProjectsForCodeCompletionCommand({projectContainer}); - EchoCommand echoCommand(QVariant::fromValue(registerProjectsForCodeCompletionCommand)); + CodeModelBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("data/complete.pro")); + CodeModelBackEnd::RegisterProjectPartsForCodeCompletionCommand registerProjectPartsForCodeCompletionCommand({projectContainer}); + EchoCommand echoCommand(QVariant::fromValue(registerProjectPartsForCodeCompletionCommand)); EXPECT_CALL(mockIpcClient, echo(echoCommand)) .Times(1); - client.serverProxy().registerProjectsForCodeCompletion(registerProjectsForCodeCompletionCommand); + client.serverProxy().registerProjectPartsForCodeCompletion(registerProjectPartsForCodeCompletionCommand); ASSERT_TRUE(client.waitForEcho()); } -TEST_F(ClientServerOutsideProcess, SendUnregisterProjectsForCodeCompletionCommand) +TEST_F(ClientServerOutsideProcess, SendUnregisterProjectPartsForCodeCompletionCommand) { - CodeModelBackEnd::UnregisterProjectsForCodeCompletionCommand unregisterProjectsForCodeCompletionCommand({Utf8StringLiteral("data/complete.pro")}); - EchoCommand echoCommand(QVariant::fromValue(unregisterProjectsForCodeCompletionCommand)); + CodeModelBackEnd::UnregisterProjectPartsForCodeCompletionCommand unregisterProjectPartsForCodeCompletionCommand({Utf8StringLiteral("data/complete.pro")}); + EchoCommand echoCommand(QVariant::fromValue(unregisterProjectPartsForCodeCompletionCommand)); EXPECT_CALL(mockIpcClient, echo(echoCommand)) .Times(1); - client.serverProxy().unregisterProjectsForCodeCompletion(unregisterProjectsForCodeCompletionCommand); + client.serverProxy().unregisterProjectPartsForCodeCompletion(unregisterProjectPartsForCodeCompletionCommand); ASSERT_TRUE(client.waitForEcho()); } diff --git a/tests/unit/codemodelbackend/unittest/codecompletionsextractortest.cpp b/tests/unit/codemodelbackend/unittest/codecompletionsextractortest.cpp index 467506fd74..cc007f3319 100644 --- a/tests/unit/codemodelbackend/unittest/codecompletionsextractortest.cpp +++ b/tests/unit/codemodelbackend/unittest/codecompletionsextractortest.cpp @@ -40,7 +40,7 @@ #include <filecontainer.h> #include <translationunit.h> #include <unsavedfiles.h> -#include <project.h> +#include <projectpart.h> #include <utf8stringvector.h> #include <QFile> @@ -138,7 +138,7 @@ public: static void TearDownTestCase(); protected: - static CodeModelBackEnd::Project project; + static CodeModelBackEnd::ProjectPart project; static CodeModelBackEnd::UnsavedFiles unsavedFiles; static TranslationUnit functionTranslationUnit; static TranslationUnit variableTranslationUnit; @@ -148,7 +148,7 @@ protected: static TranslationUnit constructorTranslationUnit; }; -CodeModelBackEnd::Project CodeCompletionsExtractor::project(Utf8StringLiteral("/path/to/projectfile")); +CodeModelBackEnd::ProjectPart CodeCompletionsExtractor::project(Utf8StringLiteral("/path/to/projectfile")); CodeModelBackEnd::UnsavedFiles CodeCompletionsExtractor::unsavedFiles; TranslationUnit CodeCompletionsExtractor::functionTranslationUnit(Utf8StringLiteral("data/complete_extractor_function.cpp"), unsavedFiles, project); TranslationUnit CodeCompletionsExtractor::variableTranslationUnit(Utf8StringLiteral("data/complete_extractor_variable.cpp"), unsavedFiles, project); @@ -526,7 +526,7 @@ TEST_F(CodeCompletionsExtractor, NotAvailableFunction) TEST_F(CodeCompletionsExtractor, UnsavedFile) { CodeModelBackEnd::UnsavedFiles unsavedFiles; - CodeModelBackEnd::Project project(Utf8StringLiteral("/path/to/projectfile")); + CodeModelBackEnd::ProjectPart project(Utf8StringLiteral("/path/to/projectfile")); TranslationUnit translationUnit(Utf8String::fromUtf8("data/complete_extractor_function.cpp"), unsavedFiles, project); unsavedFiles.createOrUpdate({unsavedDataFileContainer("data/complete_extractor_function.cpp", "data/complete_extractor_function_unsaved.cpp")}); @@ -542,7 +542,7 @@ TEST_F(CodeCompletionsExtractor, UnsavedFile) TEST_F(CodeCompletionsExtractor, ChangeUnsavedFile) { CodeModelBackEnd::UnsavedFiles unsavedFiles; - CodeModelBackEnd::Project project(Utf8StringLiteral("/path/to/projectfile")); + CodeModelBackEnd::ProjectPart project(Utf8StringLiteral("/path/to/projectfile")); TranslationUnit translationUnit(Utf8String::fromUtf8("data/complete_extractor_function.cpp"), unsavedFiles, project); unsavedFiles.createOrUpdate({unsavedDataFileContainer("data/complete_extractor_function.cpp", "data/complete_extractor_function_unsaved.cpp")}); diff --git a/tests/unit/codemodelbackend/unittest/codecompletiontest.cpp b/tests/unit/codemodelbackend/unittest/codecompletiontest.cpp index 667d58fc16..c07e3b648d 100644 --- a/tests/unit/codemodelbackend/unittest/codecompletiontest.cpp +++ b/tests/unit/codemodelbackend/unittest/codecompletiontest.cpp @@ -36,7 +36,7 @@ #include <translationunit.h> #include <unsavedfiles.h> #include <utf8stringvector.h> -#include <project.h> +#include <projectpart.h> #include <QFile> @@ -58,15 +58,15 @@ public: static void TearDownTestCase(); protected: - static CodeModelBackEnd::Project project; + static CodeModelBackEnd::ProjectPart projectPart; static CodeModelBackEnd::UnsavedFiles unsavedFiles; static CodeModelBackEnd::TranslationUnit translationUnit; static CodeModelBackEnd::CodeCompleter completer; }; -CodeModelBackEnd::Project CodeCompleter::project(Utf8StringLiteral("/path/to/projectfile")); +CodeModelBackEnd::ProjectPart CodeCompleter::projectPart(Utf8StringLiteral("projectPartId")); CodeModelBackEnd::UnsavedFiles CodeCompleter::unsavedFiles; -CodeModelBackEnd::TranslationUnit CodeCompleter::translationUnit(Utf8StringLiteral("data/complete_completer.cpp"), unsavedFiles, project); +CodeModelBackEnd::TranslationUnit CodeCompleter::translationUnit(Utf8StringLiteral("data/complete_completer.cpp"), unsavedFiles, projectPart); CodeModelBackEnd::CodeCompleter CodeCompleter::completer = translationUnit; void CodeCompleter::SetUpTestCase() @@ -76,7 +76,7 @@ void CodeCompleter::SetUpTestCase() const Utf8String unsavedFileContent = Utf8String::fromByteArray(unsavedFileContentFile.readAll()); const CodeModelBackEnd::FileContainer unsavedDataFileContainer(translationUnit.filePath(), - project.projectFilePath(), + projectPart.projectPartId(), unsavedFileContent, true); diff --git a/tests/unit/codemodelbackend/unittest/mockipclient.h b/tests/unit/codemodelbackend/unittest/mockipclient.h index 9351a716a1..6ad035ee24 100644 --- a/tests/unit/codemodelbackend/unittest/mockipclient.h +++ b/tests/unit/codemodelbackend/unittest/mockipclient.h @@ -44,8 +44,8 @@ class MockIpcClient : public CodeModelBackEnd::IpcClientInterface { void(const CodeModelBackEnd::CodeCompletedCommand &command)); MOCK_METHOD1(translationUnitDoesNotExist, void(const CodeModelBackEnd::TranslationUnitDoesNotExistCommand &command)); - MOCK_METHOD1(projectDoesNotExist, - void(const CodeModelBackEnd::ProjectDoesNotExistCommand &command)); + MOCK_METHOD1(projectPartsDoNotExist, + void(const CodeModelBackEnd::ProjectPartsDoNotExistCommand &command)); }; #endif // MOCKIPCLIENT_H diff --git a/tests/unit/codemodelbackend/unittest/mockipcserver.h b/tests/unit/codemodelbackend/unittest/mockipcserver.h index d6a5d73bff..4b7e32590b 100644 --- a/tests/unit/codemodelbackend/unittest/mockipcserver.h +++ b/tests/unit/codemodelbackend/unittest/mockipcserver.h @@ -41,10 +41,10 @@ class MockIpcServer : public CodeModelBackEnd::IpcServerInterface { void(const CodeModelBackEnd::RegisterTranslationUnitForCodeCompletionCommand &command)); MOCK_METHOD1(unregisterTranslationUnitsForCodeCompletion, void(const CodeModelBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand &command)); - MOCK_METHOD1(registerProjectsForCodeCompletion, - void(const CodeModelBackEnd::RegisterProjectsForCodeCompletionCommand &command)); - MOCK_METHOD1(unregisterProjectsForCodeCompletion, - void(const CodeModelBackEnd::UnregisterProjectsForCodeCompletionCommand &command)); + MOCK_METHOD1(registerProjectPartsForCodeCompletion, + void(const CodeModelBackEnd::RegisterProjectPartsForCodeCompletionCommand &command)); + MOCK_METHOD1(unregisterProjectPartsForCodeCompletion, + void(const CodeModelBackEnd::UnregisterProjectPartsForCodeCompletionCommand &command)); MOCK_METHOD1(completeCode, void(const CodeModelBackEnd::CompleteCodeCommand &command)); }; diff --git a/tests/unit/codemodelbackend/unittest/projecttest.cpp b/tests/unit/codemodelbackend/unittest/projecttest.cpp index 0db7386f23..da62d9d352 100644 --- a/tests/unit/codemodelbackend/unittest/projecttest.cpp +++ b/tests/unit/codemodelbackend/unittest/projecttest.cpp @@ -33,10 +33,10 @@ #include "gmock/gmock-matchers.h" #include "gmock/gmock-generated-matchers.h" -#include <project.h> +#include <projectpart.h> #include <utf8stringvector.h> #include <projects.h> -#include <projectdoesnotexistsexception.h> +#include <projectpartsdonotexistexception.h> #include <chrono> @@ -49,46 +49,46 @@ using testing::Not; namespace { -TEST(Project, CreateProject) +TEST(ProjectPart, CreateProjectPart) { Utf8String projectPath(Utf8StringLiteral("/tmp/blah.pro")); - CodeModelBackEnd::Project project(projectPath); + CodeModelBackEnd::ProjectPart project(projectPath); - ASSERT_THAT(project.projectFilePath(), projectPath); + ASSERT_THAT(project.projectPartId(), projectPath); } -TEST(Project, CreateProjectWithProjectContainer) +TEST(ProjectPart, CreateProjectPartWithProjectPartContainer) { - CodeModelBackEnd::ProjectContainer projectContainer(Utf8StringLiteral("pathToProject.pro"), {Utf8StringLiteral("-O")}); + CodeModelBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("pathToProjectPart.pro"), {Utf8StringLiteral("-O")}); - CodeModelBackEnd::Project project(projectContainer); + CodeModelBackEnd::ProjectPart project(projectContainer); - ASSERT_THAT(project.projectFilePath(), Utf8StringLiteral("pathToProject.pro")); + ASSERT_THAT(project.projectPartId(), Utf8StringLiteral("pathToProjectPart.pro")); ASSERT_THAT(project.arguments(), Contains(StrEq("-O"))); } -TEST(Project, SetArguments) +TEST(ProjectPart, SetArguments) { - CodeModelBackEnd::Project project(Utf8StringLiteral("/tmp/blah.pro")); + CodeModelBackEnd::ProjectPart project(Utf8StringLiteral("/tmp/blah.pro")); project.setArguments(Utf8StringVector({Utf8StringLiteral("-O"), Utf8StringLiteral("-fast")})); ASSERT_THAT(project.arguments(), ElementsAre(StrEq("-O"), StrEq("-fast"))); } -TEST(Project, ArgumentCount) +TEST(ProjectPart, ArgumentCount) { - CodeModelBackEnd::Project project(Utf8StringLiteral("/tmp/blah.pro")); + CodeModelBackEnd::ProjectPart project(Utf8StringLiteral("/tmp/blah.pro")); project.setArguments(Utf8StringVector({Utf8StringLiteral("-O"), Utf8StringLiteral("-fast")})); ASSERT_THAT(project.argumentCount(), 2); } -TEST(Project, TimeStampIsUpdatedAsArgumentChanged) +TEST(ProjectPart, TimeStampIsUpdatedAsArgumentChanged) { - CodeModelBackEnd::Project project(Utf8StringLiteral("/tmp/blah.pro")); + CodeModelBackEnd::ProjectPart project(Utf8StringLiteral("/tmp/blah.pro")); auto lastChangeTimePoint = project.lastChangeTimePoint(); project.setArguments(Utf8StringVector({Utf8StringLiteral("-O"), Utf8StringLiteral("-fast")})); @@ -97,88 +97,88 @@ TEST(Project, TimeStampIsUpdatedAsArgumentChanged) } -TEST(Project, GetNonExistingPoject) +TEST(ProjectPart, GetNonExistingPoject) { - CodeModelBackEnd::Projects projects; + CodeModelBackEnd::ProjectParts projects; - ASSERT_THROW(projects.project(Utf8StringLiteral("pathToProject.pro")), CodeModelBackEnd::ProjectDoesNotExistException); + ASSERT_THROW(projects.project(Utf8StringLiteral("pathToProjectPart.pro")), CodeModelBackEnd::ProjectPartDoNotExistException); } -TEST(Project, AddProjects) +TEST(ProjectPart, AddProjectParts) { - CodeModelBackEnd::ProjectContainer projectContainer(Utf8StringLiteral("pathToProject.pro"), {Utf8StringLiteral("-O")}); - CodeModelBackEnd::Projects projects; + CodeModelBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("pathToProjectPart.pro"), {Utf8StringLiteral("-O")}); + CodeModelBackEnd::ProjectParts projects; projects.createOrUpdate({projectContainer}); - ASSERT_THAT(projects.project(projectContainer.filePath()), CodeModelBackEnd::Project(projectContainer)); - ASSERT_THAT(projects.project(projectContainer.filePath()).arguments(), ElementsAre(StrEq("-O"))); + ASSERT_THAT(projects.project(projectContainer.projectPartId()), CodeModelBackEnd::ProjectPart(projectContainer)); + ASSERT_THAT(projects.project(projectContainer.projectPartId()).arguments(), ElementsAre(StrEq("-O"))); } -TEST(Project, UpdateProjects) +TEST(ProjectPart, UpdateProjectParts) { - CodeModelBackEnd::ProjectContainer projectContainer(Utf8StringLiteral("pathToProject.pro"), {Utf8StringLiteral("-O")}); - CodeModelBackEnd::ProjectContainer projectContainerWithNewArguments(Utf8StringLiteral("pathToProject.pro"), {Utf8StringLiteral("-fast")}); - CodeModelBackEnd::Projects projects; + CodeModelBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("pathToProjectPart.pro"), {Utf8StringLiteral("-O")}); + CodeModelBackEnd::ProjectPartContainer projectContainerWithNewArguments(Utf8StringLiteral("pathToProjectPart.pro"), {Utf8StringLiteral("-fast")}); + CodeModelBackEnd::ProjectParts projects; projects.createOrUpdate({projectContainer}); projects.createOrUpdate({projectContainerWithNewArguments}); - ASSERT_THAT(projects.project(projectContainer.filePath()), CodeModelBackEnd::Project(projectContainer)); - ASSERT_THAT(projects.project(projectContainer.filePath()).arguments(), ElementsAre(StrEq("-fast"))); + ASSERT_THAT(projects.project(projectContainer.projectPartId()), CodeModelBackEnd::ProjectPart(projectContainer)); + ASSERT_THAT(projects.project(projectContainer.projectPartId()).arguments(), ElementsAre(StrEq("-fast"))); } -TEST(Project, ThrowExceptionForAccesingRemovedProjects) +TEST(ProjectPart, ThrowExceptionForAccesingRemovedProjectParts) { - CodeModelBackEnd::ProjectContainer projectContainer(Utf8StringLiteral("pathToProject.pro"), {Utf8StringLiteral("-O")}); - CodeModelBackEnd::Projects projects; + CodeModelBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("pathToProjectPart.pro"), {Utf8StringLiteral("-O")}); + CodeModelBackEnd::ProjectParts projects; projects.createOrUpdate({projectContainer}); - projects.remove({projectContainer.filePath()}); + projects.remove({projectContainer.projectPartId()}); - ASSERT_THROW(projects.project(projectContainer.filePath()), CodeModelBackEnd::ProjectDoesNotExistException); + ASSERT_THROW(projects.project(projectContainer.projectPartId()), CodeModelBackEnd::ProjectPartDoNotExistException); } -TEST(Project, ProjectFilePathIsEmptyfterRemoving) +TEST(ProjectPart, ProjectPartProjectPartIdIsEmptyfterRemoving) { - CodeModelBackEnd::ProjectContainer projectContainer(Utf8StringLiteral("pathToProject.pro"), {Utf8StringLiteral("-O")}); - CodeModelBackEnd::Projects projects; + CodeModelBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("pathToProjectPart.pro"), {Utf8StringLiteral("-O")}); + CodeModelBackEnd::ProjectParts projects; projects.createOrUpdate({projectContainer}); - CodeModelBackEnd::Project project(projects.project(projectContainer.filePath())); + CodeModelBackEnd::ProjectPart project(projects.project(projectContainer.projectPartId())); - projects.remove({projectContainer.filePath()}); + projects.remove({projectContainer.projectPartId()}); - ASSERT_TRUE(project.projectFilePath().isEmpty()); + ASSERT_TRUE(project.projectPartId().isEmpty()); } -TEST(Project, ThrowsForNotExistingProjectButRemovesAllExistingProject) +TEST(Project, ThrowsForNotExistingProjectPartButRemovesAllExistingProject) { - CodeModelBackEnd::ProjectContainer projectContainer(Utf8StringLiteral("pathToProject.pro")); - CodeModelBackEnd::Projects projects; + CodeModelBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("pathToProjectPart.pro")); + CodeModelBackEnd::ProjectParts projects; projects.createOrUpdate({projectContainer}); - CodeModelBackEnd::Project project = *projects.findProject(Utf8StringLiteral("pathToProject.pro")); + CodeModelBackEnd::ProjectPart project = *projects.findProjectPart(Utf8StringLiteral("pathToProjectPart.pro")); - EXPECT_THROW(projects.remove({Utf8StringLiteral("doesnotexist.pro"), projectContainer.filePath()}), CodeModelBackEnd::ProjectDoesNotExistException); + EXPECT_THROW(projects.remove({Utf8StringLiteral("doesnotexist.pro"), projectContainer.projectPartId()}), CodeModelBackEnd::ProjectPartDoNotExistException); ASSERT_THAT(projects.projects(), Not(Contains(project))); } -TEST(Project, HasProject) +TEST(ProjectPart, HasProjectPart) { - CodeModelBackEnd::ProjectContainer projectContainer(Utf8StringLiteral("pathToProject.pro")); - CodeModelBackEnd::Projects projects; + CodeModelBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("pathToProjectPart.pro")); + CodeModelBackEnd::ProjectParts projects; projects.createOrUpdate({projectContainer}); - ASSERT_TRUE(projects.hasProject(projectContainer.filePath())); + ASSERT_TRUE(projects.hasProjectPart(projectContainer.projectPartId())); } -TEST(Project, DoNotHasProject) +TEST(ProjectPart, DoNotHasProjectPart) { - CodeModelBackEnd::ProjectContainer projectContainer(Utf8StringLiteral("pathToProject.pro")); - CodeModelBackEnd::Projects projects; + CodeModelBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("pathToProjectPart.pro")); + CodeModelBackEnd::ProjectParts projects; projects.createOrUpdate({projectContainer}); - ASSERT_FALSE(projects.hasProject(Utf8StringLiteral("doesnotexist.pro"))); + ASSERT_FALSE(projects.hasProjectPart(Utf8StringLiteral("doesnotexist.pro"))); } diff --git a/tests/unit/codemodelbackend/unittest/translationunitstest.cpp b/tests/unit/codemodelbackend/unittest/translationunitstest.cpp index 04e1732b40..e6e3e18cd6 100644 --- a/tests/unit/codemodelbackend/unittest/translationunitstest.cpp +++ b/tests/unit/codemodelbackend/unittest/translationunitstest.cpp @@ -37,19 +37,19 @@ #include <translationunit.h> #include <unsavedfiles.h> #include <utf8string.h> -#include <project.h> +#include <projectpart.h> #include <translationunits.h> #include <filecontainer.h> -#include <projectcontainer.h> +#include <projectpartcontainer.h> #include <projects.h> -#include <translationunitdoesnotexistsexception.h> +#include <translationunitdoesnotexistexception.h> #include <translationunitisnullexception.h> -#include <translationunitfilenotexitsexception.h> -#include <projectdoesnotexistsexception.h> +#include <translationunitfilenotexitexception.h> +#include <projectpartsdonotexistexception.h> using CodeModelBackEnd::TranslationUnit; using CodeModelBackEnd::UnsavedFiles; -using CodeModelBackEnd::Project; +using CodeModelBackEnd::ProjectPart; using testing::IsNull; using testing::NotNull; @@ -61,9 +61,9 @@ namespace { using ::testing::PrintToString; -MATCHER_P2(IsTranslationUnit, filePath, projectFilePath, +MATCHER_P2(IsTranslationUnit, filePath, projectPartId, std::string(negation ? "isn't" : "is") + " translation unit with file path " - + PrintToString(filePath) + " and project " + PrintToString(projectFilePath) + + PrintToString(filePath) + " and project " + PrintToString(projectPartId) ) { if (arg.filePath() != filePath) { @@ -71,8 +71,8 @@ MATCHER_P2(IsTranslationUnit, filePath, projectFilePath, return false; } - if (arg.projectFilePath() != projectFilePath) { - *result_listener << "file path is " + PrintToString(arg.projectFilePath()) + " and not " + PrintToString(projectFilePath); + if (arg.projectPartId() != projectPartId) { + *result_listener << "file path is " + PrintToString(arg.projectPartId()) + " and not " + PrintToString(projectPartId); return false; } @@ -84,82 +84,82 @@ class TranslationUnits : public ::testing::Test protected: void SetUp() override; - CodeModelBackEnd::Projects projects; + CodeModelBackEnd::ProjectParts projects; CodeModelBackEnd::UnsavedFiles unsavedFiles; CodeModelBackEnd::TranslationUnits translationUnits = CodeModelBackEnd::TranslationUnits(projects, unsavedFiles); const Utf8String filePath = Utf8StringLiteral("data/complete_testfile_1.cpp"); - const Utf8String projectFilePath = Utf8StringLiteral("/path/to/projectfile"); + const Utf8String projectPartId = Utf8StringLiteral("/path/to/projectfile"); }; void TranslationUnits::SetUp() { - projects.createOrUpdate({CodeModelBackEnd::ProjectContainer(projectFilePath)}); + projects.createOrUpdate({CodeModelBackEnd::ProjectPartContainer(projectPartId)}); } TEST_F(TranslationUnits, ThrowForGettingWithWrongFilePath) { - ASSERT_THROW(translationUnits.translationUnit(Utf8StringLiteral("foo.cpp"), projectFilePath), + ASSERT_THROW(translationUnits.translationUnit(Utf8StringLiteral("foo.cpp"), projectPartId), CodeModelBackEnd::TranslationUnitDoesNotExistException); } -TEST_F(TranslationUnits, ThrowForGettingWithWrongProjectFilePath) +TEST_F(TranslationUnits, ThrowForGettingWithWrongProjectPartFilePath) { ASSERT_THROW(translationUnits.translationUnit(filePath, Utf8StringLiteral("foo.pro")), - CodeModelBackEnd::ProjectDoesNotExistException); + CodeModelBackEnd::ProjectPartDoNotExistException); } TEST_F(TranslationUnits, Add) { - CodeModelBackEnd::FileContainer fileContainer(filePath, projectFilePath); + CodeModelBackEnd::FileContainer fileContainer(filePath, projectPartId); translationUnits.createOrUpdate({fileContainer}); - ASSERT_THAT(translationUnits.translationUnit(filePath, projectFilePath), - IsTranslationUnit(filePath, projectFilePath)); + ASSERT_THAT(translationUnits.translationUnit(filePath, projectPartId), + IsTranslationUnit(filePath, projectPartId)); } TEST_F(TranslationUnits, ThrowForRemovingWithWrongFilePath) { - CodeModelBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), projectFilePath); + CodeModelBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), projectPartId); ASSERT_THROW(translationUnits.remove({fileContainer}), CodeModelBackEnd::TranslationUnitDoesNotExistException); } -TEST_F(TranslationUnits, ThrowForRemovingWithWrongProjectFilePath) +TEST_F(TranslationUnits, ThrowForRemovingWithWrongProjectPartFilePath) { CodeModelBackEnd::FileContainer fileContainer(filePath, Utf8StringLiteral("foo.pro")); ASSERT_THROW(translationUnits.remove({fileContainer}), - CodeModelBackEnd::ProjectDoesNotExistException); + CodeModelBackEnd::ProjectPartDoNotExistException); } TEST_F(TranslationUnits, Remove) { - CodeModelBackEnd::FileContainer fileContainer(filePath, projectFilePath); + CodeModelBackEnd::FileContainer fileContainer(filePath, projectPartId); translationUnits.createOrUpdate({fileContainer}); translationUnits.remove({fileContainer}); - ASSERT_THROW(translationUnits.translationUnit(filePath, projectFilePath), + ASSERT_THROW(translationUnits.translationUnit(filePath, projectPartId), CodeModelBackEnd::TranslationUnitDoesNotExistException); } TEST_F(TranslationUnits, RemoveAllValidIfExceptionIsThrown) { - CodeModelBackEnd::FileContainer fileContainer(filePath, projectFilePath); + CodeModelBackEnd::FileContainer fileContainer(filePath, projectPartId); translationUnits.createOrUpdate({fileContainer}); - ASSERT_THROW(translationUnits.remove({CodeModelBackEnd::FileContainer(Utf8StringLiteral("dontextist.pro"), projectFilePath), fileContainer}), + ASSERT_THROW(translationUnits.remove({CodeModelBackEnd::FileContainer(Utf8StringLiteral("dontextist.pro"), projectPartId), fileContainer}), CodeModelBackEnd::TranslationUnitDoesNotExistException); ASSERT_THAT(translationUnits.translationUnits(), - Not(Contains(TranslationUnit(filePath, unsavedFiles, projects.project(projectFilePath))))); + Not(Contains(TranslationUnit(filePath, unsavedFiles, projects.project(projectPartId))))); } } diff --git a/tests/unit/codemodelbackend/unittest/translationunittest.cpp b/tests/unit/codemodelbackend/unittest/translationunittest.cpp index b6158632a8..38abfc1f0a 100644 --- a/tests/unit/codemodelbackend/unittest/translationunittest.cpp +++ b/tests/unit/codemodelbackend/unittest/translationunittest.cpp @@ -37,18 +37,18 @@ #include <translationunit.h> #include <unsavedfiles.h> #include <utf8string.h> -#include <project.h> +#include <projectpart.h> #include <translationunits.h> #include <filecontainer.h> #include <projects.h> -#include <translationunitdoesnotexistsexception.h> +#include <translationunitdoesnotexistexception.h> #include <translationunitisnullexception.h> -#include <translationunitfilenotexitsexception.h> +#include <translationunitfilenotexitexception.h> #include <translationunitparseerrorexception.h> using CodeModelBackEnd::TranslationUnit; using CodeModelBackEnd::UnsavedFiles; -using CodeModelBackEnd::Project; +using CodeModelBackEnd::ProjectPart; using testing::IsNull; using testing::NotNull; @@ -65,12 +65,12 @@ TEST(TranslationUnit, DefaultTranslationUnitIsInvalid) TEST(TranslationUnit, ThrowExceptionForNonExistingFilePath) { - ASSERT_THROW(TranslationUnit(Utf8StringLiteral("file.cpp"), UnsavedFiles(), Project(Utf8StringLiteral("/path/to/projectfile"))), CodeModelBackEnd::TranslationUnitFileNotExitsException); + ASSERT_THROW(TranslationUnit(Utf8StringLiteral("file.cpp"), UnsavedFiles(), ProjectPart(Utf8StringLiteral("/path/to/projectfile"))), CodeModelBackEnd::TranslationUnitFileNotExitsException); } TEST(TranslationUnit, TranslationUnitIsValid) { - TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), UnsavedFiles(), Project(Utf8StringLiteral("/path/to/projectfile"))); + TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), UnsavedFiles(), ProjectPart(Utf8StringLiteral("/path/to/projectfile"))); ASSERT_FALSE(translationUnit.isNull()); } @@ -85,7 +85,7 @@ TEST(TranslationUnit, ThrowExceptionForGettingIndexForInvalidUnit) TEST(TranslationUnit, IndexGetterIsNonNullForValidUnit) { - TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), UnsavedFiles(), Project(Utf8StringLiteral("/path/to/projectfile"))); + TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), UnsavedFiles(), ProjectPart(Utf8StringLiteral("/path/to/projectfile"))); ASSERT_THAT(translationUnit.index(), NotNull()); } @@ -100,7 +100,7 @@ TEST(TranslationUnit, ThrowExceptionForGettingCxTranslationUnitForInvalidUnit) TEST(TranslationUnit, CxTranslationUnitGetterIsNonNullForValidUnit) { UnsavedFiles unsavedFiles; - TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), unsavedFiles, Project(Utf8StringLiteral("/path/to/projectfile"))); + TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), unsavedFiles, ProjectPart(Utf8StringLiteral("/path/to/projectfile"))); ASSERT_THAT(translationUnit.cxTranslationUnit(), NotNull()); } @@ -114,7 +114,7 @@ TEST(TranslationUnit, ThrowExceptionIfGettingFilePathForNullUnit) TEST(TranslationUnit, ResetedTranslationUnitIsNull) { - TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), UnsavedFiles(), Project(Utf8StringLiteral("/path/to/projectfile"))); + TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), UnsavedFiles(), ProjectPart(Utf8StringLiteral("/path/to/projectfile"))); translationUnit.reset(); @@ -123,7 +123,7 @@ TEST(TranslationUnit, ResetedTranslationUnitIsNull) TEST(TranslationUnit, TimeStampIsUpdatedAsNewCxTranslationUnitIsGenerated) { - TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), UnsavedFiles(), Project(Utf8StringLiteral("/path/to/projectfile"))); + TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), UnsavedFiles(), ProjectPart(Utf8StringLiteral("/path/to/projectfile"))); auto lastChangeTimePoint = translationUnit.lastChangeTimePoint(); translationUnit.cxTranslationUnit(); @@ -134,7 +134,7 @@ TEST(TranslationUnit, TimeStampIsUpdatedAsNewCxTranslationUnitIsGenerated) //TEST(TranslationUnit, ThrowParseErrorForWrongArguments) //{ -// Project project(Utf8StringLiteral("/path/to/projectfile")); +// ProjectPart project(Utf8StringLiteral("/path/to/projectfile")); // project.setArguments({Utf8StringLiteral("-fblah")}); // TranslationUnit translationUnit(Utf8StringLiteral("data/complete_testfile_1.cpp"), UnsavedFiles(), project); |