logic: more wstring usages
* removed header paths from VS Project setup message since VS doesn't send these anymore * implemented using wstring in IDE communication * fixed retrieving filepaths from QtDirectoryListbox that contain special characters * use wstring for source extensions * added special character as file extension to FileManagerTestSuite
This commit is contained in:
@@ -26,7 +26,7 @@ void IDECommunicationController::clear()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDECommunicationController::handleIncomingMessage(const std::string& message)
|
void IDECommunicationController::handleIncomingMessage(const std::wstring& message)
|
||||||
{
|
{
|
||||||
if (m_enabled == false)
|
if (m_enabled == false)
|
||||||
{
|
{
|
||||||
@@ -70,10 +70,7 @@ void IDECommunicationController::setEnabled(const bool enabled)
|
|||||||
void IDECommunicationController::sendUpdatePing()
|
void IDECommunicationController::sendUpdatePing()
|
||||||
{
|
{
|
||||||
// first reset connection status
|
// first reset connection status
|
||||||
MessagePingReceived msg;
|
MessagePingReceived().dispatch();
|
||||||
msg.ideId = "";
|
|
||||||
msg.ideName = "";
|
|
||||||
msg.dispatch();
|
|
||||||
|
|
||||||
// send ping to update connection status
|
// send ping to update connection status
|
||||||
sendMessage(NetworkProtocolHelper::buildPingMessage());
|
sendMessage(NetworkProtocolHelper::buildPingMessage());
|
||||||
@@ -87,7 +84,7 @@ void IDECommunicationController::handleSetActiveTokenMessage(
|
|||||||
{
|
{
|
||||||
const unsigned int cursorColumn = message.column;
|
const unsigned int cursorColumn = message.column;
|
||||||
|
|
||||||
const FilePath filePath = FilePath(message.fileLocation).makeCanonical();
|
const FilePath filePath = message.filePath.getCanonical();
|
||||||
|
|
||||||
if (FileSystem::getFileInfoForPath(filePath).lastWriteTime
|
if (FileSystem::getFileInfoForPath(filePath).lastWriteTime
|
||||||
== m_storageAccess->getFileInfoForFilePath(filePath).lastWriteTime)
|
== m_storageAccess->getFileInfoForFilePath(filePath).lastWriteTime)
|
||||||
@@ -152,7 +149,7 @@ void IDECommunicationController::handleCreateCDBProjectMessage(const NetworkProt
|
|||||||
{
|
{
|
||||||
if (message.valid)
|
if (message.valid)
|
||||||
{
|
{
|
||||||
MessageProjectNew(message.cdbFileLocation, message.headerPaths).dispatch();
|
MessageProjectNew(message.cdbFileLocation).dispatch();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -169,10 +166,10 @@ void IDECommunicationController::handlePing(const NetworkProtocolHelper::PingMes
|
|||||||
|
|
||||||
if (msg.ideName.empty())
|
if (msg.ideName.empty())
|
||||||
{
|
{
|
||||||
msg.ideName = "unknown IDE";
|
msg.ideName = L"unknown IDE";
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(msg.ideName + " instance detected via plugin port");
|
LOG_INFO(msg.ideName + L" instance detected via plugin port");
|
||||||
msg.dispatch();
|
msg.dispatch();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -191,7 +188,7 @@ void IDECommunicationController::handleMessage(MessageWindowFocus* message)
|
|||||||
|
|
||||||
void IDECommunicationController::handleMessage(MessageIDECreateCDB* message)
|
void IDECommunicationController::handleMessage(MessageIDECreateCDB* message)
|
||||||
{
|
{
|
||||||
std::string networkMessage = NetworkProtocolHelper::buildCreateCDBMessage();
|
std::wstring networkMessage = NetworkProtocolHelper::buildCreateCDBMessage();
|
||||||
|
|
||||||
MessageStatus(L"Requesting IDE to create Compilation Database via plug-in.").dispatch();
|
MessageStatus(L"Requesting IDE to create Compilation Database via plug-in.").dispatch();
|
||||||
|
|
||||||
@@ -200,13 +197,13 @@ void IDECommunicationController::handleMessage(MessageIDECreateCDB* message)
|
|||||||
|
|
||||||
void IDECommunicationController::handleMessage(MessageMoveIDECursor* message)
|
void IDECommunicationController::handleMessage(MessageMoveIDECursor* message)
|
||||||
{
|
{
|
||||||
std::string networkMessage = NetworkProtocolHelper::buildSetIDECursorMessage(
|
std::wstring networkMessage = NetworkProtocolHelper::buildSetIDECursorMessage(
|
||||||
message->FilePosition.str(), message->Row, message->Column
|
message->filePath, message->row, message->column
|
||||||
);
|
);
|
||||||
|
|
||||||
MessageStatus(
|
MessageStatus(
|
||||||
L"Jump to source location via plug-in: " + message->FilePosition.wstr() + L", row: " +
|
L"Jump to source location via plug-in: " + message->filePath.wstr() + L", row: " +
|
||||||
std::to_wstring(message->Row) + L", col: " + std::to_wstring(message->Column)
|
std::to_wstring(message->row) + L", col: " + std::to_wstring(message->column)
|
||||||
).dispatch();
|
).dispatch();
|
||||||
|
|
||||||
sendMessage(networkMessage);
|
sendMessage(networkMessage);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
virtual void stopListening() = 0;
|
virtual void stopListening() = 0;
|
||||||
virtual bool isListening() const = 0;
|
virtual bool isListening() const = 0;
|
||||||
|
|
||||||
void handleIncomingMessage(const std::string& message);
|
void handleIncomingMessage(const std::wstring& message);
|
||||||
|
|
||||||
bool getEnabled() const;
|
bool getEnabled() const;
|
||||||
void setEnabled(const bool enabled);
|
void setEnabled(const bool enabled);
|
||||||
@@ -49,7 +49,7 @@ private:
|
|||||||
virtual void handleMessage(MessageIDECreateCDB* message);
|
virtual void handleMessage(MessageIDECreateCDB* message);
|
||||||
virtual void handleMessage(MessageMoveIDECursor* message);
|
virtual void handleMessage(MessageMoveIDECursor* message);
|
||||||
virtual void handleMessage(MessagePluginPortChange* message);
|
virtual void handleMessage(MessagePluginPortChange* message);
|
||||||
virtual void sendMessage(const std::string& message) const = 0;
|
virtual void sendMessage(const std::wstring& message) const = 0;
|
||||||
|
|
||||||
StorageAccess* m_storageAccess;
|
StorageAccess* m_storageAccess;
|
||||||
|
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ void StatusBarController::handleMessage(MessageFinishedParsing* message)
|
|||||||
|
|
||||||
void StatusBarController::handleMessage(MessagePingReceived* message)
|
void StatusBarController::handleMessage(MessagePingReceived* message)
|
||||||
{
|
{
|
||||||
std::string status = "No IDE connected";
|
std::wstring status = L"No IDE connected";
|
||||||
|
|
||||||
if (message->ideName.length() > 0)
|
if (!message->ideName.empty())
|
||||||
{
|
{
|
||||||
status = "Connected to ";
|
status = L"Connected to ";
|
||||||
status += message->ideName;
|
status += message->ideName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,35 +6,36 @@
|
|||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#include "utility/logging/logging.h"
|
#include "utility/logging/logging.h"
|
||||||
|
#include "utility/utilityString.h"
|
||||||
|
|
||||||
std::string NetworkProtocolHelper::m_divider = ">>";
|
std::wstring NetworkProtocolHelper::s_divider = L">>";
|
||||||
std::string NetworkProtocolHelper::m_setActiveTokenPrefix = "setActiveToken";
|
std::wstring NetworkProtocolHelper::s_setActiveTokenPrefix = L"setActiveToken";
|
||||||
std::string NetworkProtocolHelper::m_moveCursorPrefix = "moveCursor";
|
std::wstring NetworkProtocolHelper::s_moveCursorPrefix = L"moveCursor";
|
||||||
std::string NetworkProtocolHelper::m_endOfMessageToken = "<EOM>";
|
std::wstring NetworkProtocolHelper::s_endOfMessageToken = L"<EOM>";
|
||||||
std::string NetworkProtocolHelper::m_createProjectPrefix = "createProject";
|
std::wstring NetworkProtocolHelper::s_createProjectPrefix = L"createProject";
|
||||||
std::string NetworkProtocolHelper::m_createCDBProjectPrefix = "createCDBProject";
|
std::wstring NetworkProtocolHelper::s_createCDBProjectPrefix = L"createCDBProject";
|
||||||
std::string NetworkProtocolHelper::m_createCDBPrefix = "createCDB";
|
std::wstring NetworkProtocolHelper::s_createCDBPrefix = L"createCDB";
|
||||||
std::string NetworkProtocolHelper::m_pingPrefix = "ping";
|
std::wstring NetworkProtocolHelper::s_pingPrefix = L"ping";
|
||||||
|
|
||||||
NetworkProtocolHelper::MESSAGE_TYPE NetworkProtocolHelper::getMessageType(const std::string& message)
|
NetworkProtocolHelper::MESSAGE_TYPE NetworkProtocolHelper::getMessageType(const std::wstring& message)
|
||||||
{
|
{
|
||||||
std::vector<std::string> subMessages = divideMessage(message);
|
std::vector<std::wstring> subMessages = divideMessage(message);
|
||||||
|
|
||||||
if (subMessages.size() > 0)
|
if (!subMessages.empty())
|
||||||
{
|
{
|
||||||
if (subMessages[0] == m_setActiveTokenPrefix)
|
if (subMessages[0] == s_setActiveTokenPrefix)
|
||||||
{
|
{
|
||||||
return MESSAGE_TYPE::SET_ACTIVE_TOKEN;
|
return MESSAGE_TYPE::SET_ACTIVE_TOKEN;
|
||||||
}
|
}
|
||||||
else if (subMessages[0] == m_createProjectPrefix)
|
else if (subMessages[0] == s_createProjectPrefix)
|
||||||
{
|
{
|
||||||
return MESSAGE_TYPE::CREATE_PROJECT;
|
return MESSAGE_TYPE::CREATE_PROJECT;
|
||||||
}
|
}
|
||||||
else if (subMessages[0] == m_createCDBProjectPrefix)
|
else if (subMessages[0] == s_createCDBProjectPrefix)
|
||||||
{
|
{
|
||||||
return MESSAGE_TYPE::CREATE_CDB_MESSAGE;
|
return MESSAGE_TYPE::CREATE_CDB_MESSAGE;
|
||||||
}
|
}
|
||||||
else if (subMessages[0] == m_pingPrefix)
|
else if (subMessages[0] == s_pingPrefix)
|
||||||
{
|
{
|
||||||
return MESSAGE_TYPE::PING;
|
return MESSAGE_TYPE::PING;
|
||||||
}
|
}
|
||||||
@@ -47,34 +48,34 @@ NetworkProtocolHelper::MESSAGE_TYPE NetworkProtocolHelper::getMessageType(const
|
|||||||
return MESSAGE_TYPE::UNKNOWN;
|
return MESSAGE_TYPE::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkProtocolHelper::SetActiveTokenMessage NetworkProtocolHelper::parseSetActiveTokenMessage(const std::string& message)
|
NetworkProtocolHelper::SetActiveTokenMessage NetworkProtocolHelper::parseSetActiveTokenMessage(const std::wstring& message)
|
||||||
{
|
{
|
||||||
std::vector<std::string> subMessages = divideMessage(message);
|
std::vector<std::wstring> subMessages = divideMessage(message);
|
||||||
|
|
||||||
SetActiveTokenMessage networkMessage;
|
SetActiveTokenMessage networkMessage;
|
||||||
|
|
||||||
if (subMessages.size() > 0)
|
if (!subMessages.empty())
|
||||||
{
|
{
|
||||||
if (subMessages[0] == m_setActiveTokenPrefix)
|
if (subMessages[0] == s_setActiveTokenPrefix)
|
||||||
{
|
{
|
||||||
if (subMessages.size() != 5)
|
if (subMessages.size() != 5)
|
||||||
{
|
{
|
||||||
LOG_ERROR_STREAM(<< "Failed to parse setActiveToken message, invalid token count");
|
LOG_ERROR("Failed to parse setActiveToken message, invalid token count");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string fileLocation = subMessages[1];
|
const std::wstring filePath = subMessages[1];
|
||||||
std::string row = subMessages[2];
|
const std::wstring row = subMessages[2];
|
||||||
std::string column = subMessages[3];
|
const std::wstring column = subMessages[3];
|
||||||
|
|
||||||
if(
|
if(
|
||||||
fileLocation.length() > 0
|
!filePath.empty()
|
||||||
&& row.length() > 0
|
&& !row.empty()
|
||||||
&& column.length() > 0
|
&& !column.empty()
|
||||||
&& isDigits(row)
|
&& isDigits(row)
|
||||||
&& isDigits(column)
|
&& isDigits(column)
|
||||||
){
|
){
|
||||||
networkMessage.fileLocation = fileLocation;
|
networkMessage.filePath = FilePath(filePath);
|
||||||
networkMessage.row = std::stoi(row);
|
networkMessage.row = std::stoi(row);
|
||||||
networkMessage.column = std::stoi(column);
|
networkMessage.column = std::stoi(column);
|
||||||
networkMessage.valid = true;
|
networkMessage.valid = true;
|
||||||
@@ -83,110 +84,79 @@ NetworkProtocolHelper::SetActiveTokenMessage NetworkProtocolHelper::parseSetActi
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_ERROR_STREAM(<< "Failed to parse message, invalid type token: " << subMessages[0] << ". Expected " << m_setActiveTokenPrefix);
|
LOG_ERROR(L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + s_setActiveTokenPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return networkMessage;
|
return networkMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkProtocolHelper::CreateProjectMessage NetworkProtocolHelper::parseCreateProjectMessage(const std::string& message)
|
NetworkProtocolHelper::CreateProjectMessage NetworkProtocolHelper::parseCreateProjectMessage(const std::wstring& message)
|
||||||
{
|
{
|
||||||
std::vector<std::string> subMessages = divideMessage(message);
|
std::vector<std::wstring> subMessages = divideMessage(message);
|
||||||
|
|
||||||
NetworkProtocolHelper::CreateProjectMessage networkMessage;
|
NetworkProtocolHelper::CreateProjectMessage networkMessage;
|
||||||
|
|
||||||
if (subMessages.size() > 0)
|
if (!subMessages.empty())
|
||||||
{
|
{
|
||||||
if (subMessages[0] == m_createProjectPrefix)
|
if (subMessages[0] == s_createProjectPrefix)
|
||||||
{
|
{
|
||||||
if (subMessages.size() != 4)
|
if (subMessages.size() != 4)
|
||||||
{
|
{
|
||||||
LOG_ERROR_STREAM(<< "Failed to parse createProject message, invalid token count");
|
LOG_ERROR("Failed to parse createProject message, invalid token count");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::string fileLocation = subMessages[1];
|
|
||||||
std::string ideId = subMessages[2];
|
|
||||||
if (fileLocation.length() > 0
|
|
||||||
&& ideId.length() > 0)
|
|
||||||
{
|
|
||||||
networkMessage.solutionFileLocation = fileLocation;
|
|
||||||
|
|
||||||
std::string nonConstId = ideId;
|
|
||||||
boost::algorithm::to_lower(nonConstId);
|
|
||||||
|
|
||||||
networkMessage.ideId = nonConstId;
|
|
||||||
|
|
||||||
networkMessage.valid = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_WARNING_STREAM(<< "Failed to parse ide ID string. Is " << ideId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_ERROR_STREAM(<< "Failed to parse message, invalid type token: " << subMessages[0] << ". Expected " << m_createProjectPrefix);
|
LOG_ERROR(L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + s_createProjectPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return networkMessage;
|
return networkMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkProtocolHelper::CreateCDBProjectMessage NetworkProtocolHelper::parseCreateCDBProjectMessage(const std::string& message)
|
NetworkProtocolHelper::CreateCDBProjectMessage NetworkProtocolHelper::parseCreateCDBProjectMessage(const std::wstring& message)
|
||||||
{
|
{
|
||||||
std::vector<std::string> subMessages = divideMessage(message);
|
std::vector<std::wstring> subMessages = divideMessage(message);
|
||||||
|
|
||||||
NetworkProtocolHelper::CreateCDBProjectMessage networkMessage;
|
NetworkProtocolHelper::CreateCDBProjectMessage networkMessage;
|
||||||
|
|
||||||
if (subMessages.size() > 0)
|
if (!subMessages.empty())
|
||||||
{
|
{
|
||||||
if (subMessages[0] == m_createCDBProjectPrefix)
|
if (subMessages[0] == s_createCDBProjectPrefix)
|
||||||
{
|
{
|
||||||
if (subMessages.size() < 4)
|
if (subMessages.size() < 4)
|
||||||
{
|
{
|
||||||
LOG_ERROR_STREAM(<< "Failed to parse createCDBProject message, too few tokens");
|
LOG_ERROR("Failed to parse createCDBProject message, too few tokens");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int subMessageCount = subMessages.size();
|
const int subMessageCount = subMessages.size();
|
||||||
|
|
||||||
std::string cdbPath = subMessages[1];
|
const std::wstring cdbPath = subMessages[1];
|
||||||
if (cdbPath.length() > 0)
|
if (!cdbPath.empty())
|
||||||
{
|
{
|
||||||
networkMessage.cdbFileLocation = cdbPath;
|
networkMessage.cdbFileLocation = FilePath(cdbPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_WARNING_STREAM(<< "CDB file path is not set.");
|
LOG_WARNING("CDB file path is not set.");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> headerPaths;
|
const std::wstring ideId = subMessages[subMessageCount - 2];
|
||||||
for (int i = 2; i < subMessageCount - 2; i++)
|
if (!ideId.empty())
|
||||||
{
|
{
|
||||||
if (subMessages[i].length() > 0)
|
std::wstring nonConstId = ideId;
|
||||||
{
|
|
||||||
headerPaths.push_back(subMessages[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
networkMessage.headerPaths = headerPaths;
|
|
||||||
|
|
||||||
std::string ideId = subMessages[subMessageCount - 2];
|
|
||||||
if (ideId.length() > 0)
|
|
||||||
{
|
|
||||||
std::string nonConstId = ideId;
|
|
||||||
boost::algorithm::to_lower(nonConstId);
|
boost::algorithm::to_lower(nonConstId);
|
||||||
|
|
||||||
networkMessage.ideId = nonConstId;
|
networkMessage.ideId = nonConstId;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_WARNING_STREAM(<< "Failed to parse ide ID string. Is " << ideId);
|
LOG_WARNING(L"Failed to parse ide ID string. Is " + ideId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (networkMessage.cdbFileLocation.length() > 0 && networkMessage.ideId.length() > 0)
|
if (!networkMessage.cdbFileLocation.empty() && !networkMessage.ideId.empty())
|
||||||
{
|
{
|
||||||
networkMessage.valid = true;
|
networkMessage.valid = true;
|
||||||
}
|
}
|
||||||
@@ -194,22 +164,22 @@ NetworkProtocolHelper::CreateCDBProjectMessage NetworkProtocolHelper::parseCreat
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_ERROR_STREAM(<< "Failed to parse message, invalid type token: " << subMessages[0] << ". Expected " << m_createCDBProjectPrefix);
|
LOG_ERROR(L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + s_createCDBProjectPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return networkMessage;
|
return networkMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkProtocolHelper::PingMessage NetworkProtocolHelper::parsePingMessage(const std::string& message)
|
NetworkProtocolHelper::PingMessage NetworkProtocolHelper::parsePingMessage(const std::wstring& message)
|
||||||
{
|
{
|
||||||
std::vector<std::string> subMessages = divideMessage(message);
|
std::vector<std::wstring> subMessages = divideMessage(message);
|
||||||
|
|
||||||
NetworkProtocolHelper::PingMessage pingMessage;
|
NetworkProtocolHelper::PingMessage pingMessage;
|
||||||
|
|
||||||
if (subMessages.size() > 0)
|
if (!subMessages.empty())
|
||||||
{
|
{
|
||||||
if (subMessages[0] == m_pingPrefix)
|
if (subMessages[0] == s_pingPrefix)
|
||||||
{
|
{
|
||||||
if (subMessages.size() < 2)
|
if (subMessages.size() < 2)
|
||||||
{
|
{
|
||||||
@@ -217,11 +187,11 @@ NetworkProtocolHelper::PingMessage NetworkProtocolHelper::parsePingMessage(const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string ideId = subMessages[1];
|
std::wstring ideId = subMessages[1];
|
||||||
|
|
||||||
if (ideId.length() > 0)
|
if (!ideId.empty())
|
||||||
{
|
{
|
||||||
std::string nonConstId = ideId;
|
std::wstring nonConstId = ideId;
|
||||||
boost::algorithm::to_lower(nonConstId);
|
boost::algorithm::to_lower(nonConstId);
|
||||||
|
|
||||||
pingMessage.ideId = ideId;
|
pingMessage.ideId = ideId;
|
||||||
@@ -230,78 +200,78 @@ NetworkProtocolHelper::PingMessage NetworkProtocolHelper::parsePingMessage(const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_WARNING_STREAM(<< "Failed to parse ide ID string. Is " << ideId);
|
LOG_WARNING(L"Failed to parse ide ID string: " + ideId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_ERROR_STREAM(<< "Failed to parse message, invalid type token: " << subMessages[0] << ". Expected " << m_pingPrefix);
|
LOG_ERROR(L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + s_pingPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pingMessage;
|
return pingMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string NetworkProtocolHelper::buildSetIDECursorMessage(const std::string& fileLocation, const unsigned int row, const unsigned int column)
|
std::wstring NetworkProtocolHelper::buildSetIDECursorMessage(const FilePath& fileLocation, const unsigned int row, const unsigned int column)
|
||||||
{
|
{
|
||||||
std::stringstream messageStream;
|
std::wstringstream messageStream;
|
||||||
|
|
||||||
messageStream << m_moveCursorPrefix;
|
messageStream << s_moveCursorPrefix;
|
||||||
messageStream << m_divider;
|
messageStream << s_divider;
|
||||||
messageStream << fileLocation;
|
messageStream << fileLocation.wstr();
|
||||||
messageStream << m_divider;
|
messageStream << s_divider;
|
||||||
messageStream << row;
|
messageStream << row;
|
||||||
messageStream << m_divider;
|
messageStream << s_divider;
|
||||||
messageStream << column;
|
messageStream << column;
|
||||||
messageStream << m_endOfMessageToken;
|
messageStream << s_endOfMessageToken;
|
||||||
|
|
||||||
return messageStream.str();
|
return messageStream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string NetworkProtocolHelper::buildCreateCDBMessage()
|
std::wstring NetworkProtocolHelper::buildCreateCDBMessage()
|
||||||
{
|
{
|
||||||
std::stringstream messageStream;
|
std::wstringstream messageStream;
|
||||||
|
|
||||||
messageStream << m_createCDBPrefix;
|
messageStream << s_createCDBPrefix;
|
||||||
messageStream << m_endOfMessageToken;
|
messageStream << s_endOfMessageToken;
|
||||||
|
|
||||||
return messageStream.str();
|
return messageStream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string NetworkProtocolHelper::buildPingMessage()
|
std::wstring NetworkProtocolHelper::buildPingMessage()
|
||||||
{
|
{
|
||||||
std::stringstream messageStream;
|
std::wstringstream messageStream;
|
||||||
|
|
||||||
messageStream << m_pingPrefix;
|
messageStream << s_pingPrefix;
|
||||||
messageStream << m_divider;
|
messageStream << s_divider;
|
||||||
messageStream << "sourcetrail";
|
messageStream << "sourcetrail";
|
||||||
messageStream << m_endOfMessageToken;
|
messageStream << s_endOfMessageToken;
|
||||||
|
|
||||||
return messageStream.str();
|
return messageStream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> NetworkProtocolHelper::divideMessage(const std::string& message)
|
std::vector<std::wstring> NetworkProtocolHelper::divideMessage(const std::wstring& message)
|
||||||
{
|
{
|
||||||
std::vector<std::string> result;
|
std::vector<std::wstring> result;
|
||||||
|
|
||||||
std::string msg = message;
|
std::wstring msg = message;
|
||||||
size_t pos = msg.find(m_divider);
|
size_t pos = msg.find(s_divider);
|
||||||
|
|
||||||
while (pos != std::string::npos)
|
while (pos != std::wstring::npos)
|
||||||
{
|
{
|
||||||
std::string subMessage = msg.substr(0, pos);
|
std::wstring subMessage = msg.substr(0, pos);
|
||||||
result.push_back(subMessage);
|
result.push_back(subMessage);
|
||||||
msg = msg.substr(pos + m_divider.size());
|
msg = msg.substr(pos + s_divider.size());
|
||||||
pos = msg.find(m_divider);
|
pos = msg.find(s_divider);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.size() > 0)
|
if (msg.size() > 0)
|
||||||
{
|
{
|
||||||
pos = msg.find(m_endOfMessageToken);
|
pos = msg.find(s_endOfMessageToken);
|
||||||
if (pos != std::string::npos)
|
if (pos != std::wstring::npos)
|
||||||
{
|
{
|
||||||
std::string subMessage = msg.substr(0, pos);
|
std::wstring subMessage = msg.substr(0, pos);
|
||||||
result.push_back(subMessage);
|
result.push_back(subMessage);
|
||||||
msg = msg.substr(pos);
|
msg = msg.substr(pos);
|
||||||
result.push_back(msg);
|
result.push_back(msg);
|
||||||
@@ -311,35 +281,7 @@ std::vector<std::string> NetworkProtocolHelper::divideMessage(const std::string&
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string NetworkProtocolHelper::removeEndOfMessageToken(const std::string& message)
|
bool NetworkProtocolHelper::isDigits(const std::wstring& text)
|
||||||
{
|
{
|
||||||
size_t pos = message.find(m_endOfMessageToken);
|
return (text.find_first_not_of(L"0123456789") == std::wstring::npos);
|
||||||
if (pos != std::string::npos)
|
|
||||||
{
|
|
||||||
return message.substr(0, pos);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string NetworkProtocolHelper::getSubstringAfterString(const std::string& message, const std::string& searchString, std::string& subMessage)
|
|
||||||
{
|
|
||||||
std::string result = "";
|
|
||||||
|
|
||||||
size_t pos = message.find(searchString);
|
|
||||||
|
|
||||||
if(pos != std::string::npos)
|
|
||||||
{
|
|
||||||
result = message.substr(0, pos);
|
|
||||||
subMessage = message.substr(pos + searchString.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NetworkProtocolHelper::isDigits(const std::string& text)
|
|
||||||
{
|
|
||||||
return (text.find_first_not_of("0123456789") == std::string::npos);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "utility/file/FilePath.h"
|
||||||
|
|
||||||
class NetworkProtocolHelper
|
class NetworkProtocolHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -11,13 +13,13 @@ public:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SetActiveTokenMessage()
|
SetActiveTokenMessage()
|
||||||
: fileLocation("")
|
: filePath(L"")
|
||||||
, row(0)
|
, row(0)
|
||||||
, column(0)
|
, column(0)
|
||||||
, valid(false)
|
, valid(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::string fileLocation;
|
FilePath filePath;
|
||||||
unsigned int row;
|
unsigned int row;
|
||||||
unsigned int column;
|
unsigned int column;
|
||||||
bool valid;
|
bool valid;
|
||||||
@@ -25,31 +27,19 @@ public:
|
|||||||
|
|
||||||
struct CreateProjectMessage
|
struct CreateProjectMessage
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
CreateProjectMessage()
|
|
||||||
: solutionFileLocation("")
|
|
||||||
, ideId("")
|
|
||||||
, valid(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
std::string solutionFileLocation;
|
|
||||||
std::string ideId;
|
|
||||||
bool valid;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CreateCDBProjectMessage
|
struct CreateCDBProjectMessage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CreateCDBProjectMessage()
|
CreateCDBProjectMessage()
|
||||||
: cdbFileLocation("")
|
: cdbFileLocation(L"")
|
||||||
, headerPaths()
|
, ideId(L"")
|
||||||
, ideId("")
|
|
||||||
, valid(false)
|
, valid(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::string cdbFileLocation;
|
FilePath cdbFileLocation;
|
||||||
std::vector<std::string> headerPaths;
|
std::wstring ideId;
|
||||||
std::string ideId;
|
|
||||||
bool valid;
|
bool valid;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -57,11 +47,11 @@ public:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PingMessage()
|
PingMessage()
|
||||||
: ideId("")
|
: ideId(L"")
|
||||||
, valid(false)
|
, valid(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::string ideId;
|
std::wstring ideId;
|
||||||
bool valid;
|
bool valid;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -74,33 +64,29 @@ public:
|
|||||||
PING
|
PING
|
||||||
};
|
};
|
||||||
|
|
||||||
static MESSAGE_TYPE getMessageType(const std::string& message);
|
static MESSAGE_TYPE getMessageType(const std::wstring& message);
|
||||||
|
|
||||||
static SetActiveTokenMessage parseSetActiveTokenMessage(const std::string& message);
|
static SetActiveTokenMessage parseSetActiveTokenMessage(const std::wstring& message);
|
||||||
static CreateProjectMessage parseCreateProjectMessage(const std::string& message);
|
static CreateProjectMessage parseCreateProjectMessage(const std::wstring& message);
|
||||||
static CreateCDBProjectMessage parseCreateCDBProjectMessage(const std::string& message);
|
static CreateCDBProjectMessage parseCreateCDBProjectMessage(const std::wstring& message);
|
||||||
static PingMessage parsePingMessage(const std::string& message);
|
static PingMessage parsePingMessage(const std::wstring& message);
|
||||||
|
|
||||||
static std::string buildSetIDECursorMessage(const std::string& fileLocation, const unsigned int row, const unsigned int column);
|
static std::wstring buildSetIDECursorMessage(const FilePath& fileLocation, const unsigned int row, const unsigned int column);
|
||||||
static std::string buildCreateCDBMessage();
|
static std::wstring buildCreateCDBMessage();
|
||||||
static std::string buildPingMessage();
|
static std::wstring buildPingMessage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<std::string> divideMessage(const std::string& message);
|
static std::vector<std::wstring> divideMessage(const std::wstring& message);
|
||||||
|
static bool isDigits(const std::wstring& text);
|
||||||
|
|
||||||
static std::string removeEndOfMessageToken(const std::string& message);
|
static std::wstring s_divider;
|
||||||
|
static std::wstring s_setActiveTokenPrefix;
|
||||||
static std::string getSubstringAfterString(const std::string& message, const std::string& searchString, std::string& subMessage);
|
static std::wstring s_moveCursorPrefix;
|
||||||
static bool isDigits(const std::string& text);
|
static std::wstring s_endOfMessageToken;
|
||||||
|
static std::wstring s_createProjectPrefix;
|
||||||
static std::string m_divider;
|
static std::wstring s_createCDBProjectPrefix;
|
||||||
static std::string m_setActiveTokenPrefix;
|
static std::wstring s_createCDBPrefix;
|
||||||
static std::string m_moveCursorPrefix;
|
static std::wstring s_pingPrefix;
|
||||||
static std::string m_endOfMessageToken;
|
|
||||||
static std::string m_createProjectPrefix;
|
|
||||||
static std::string m_createCDBProjectPrefix;
|
|
||||||
static std::string m_createCDBPrefix;
|
|
||||||
static std::string m_pingPrefix;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NETWORK_PROTOCOL_HELPER_H
|
#endif // NETWORK_PROTOCOL_HELPER_H
|
||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
virtual void showMessage(const std::wstring& message, bool isError, bool showLoader) = 0;
|
virtual void showMessage(const std::wstring& message, bool isError, bool showLoader) = 0;
|
||||||
virtual void setErrorCount(ErrorCountInfo errorCount) = 0;
|
virtual void setErrorCount(ErrorCountInfo errorCount) = 0;
|
||||||
|
|
||||||
virtual void showIdeStatus(const std::string& message) = 0;
|
virtual void showIdeStatus(const std::wstring& message) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StatusBarController* getController();
|
StatusBarController* getController();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ SourceGroupSettings::SourceGroupSettings(const std::string& id, SourceGroupType
|
|||||||
, m_standard("")
|
, m_standard("")
|
||||||
, m_sourcePaths(std::vector<FilePath>())
|
, m_sourcePaths(std::vector<FilePath>())
|
||||||
, m_excludePaths(std::vector<FilePath>())
|
, m_excludePaths(std::vector<FilePath>())
|
||||||
, m_sourceExtensions(std::vector<std::string>())
|
, m_sourceExtensions(std::vector<std::wstring>())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ void SourceGroupSettings::load(std::shared_ptr<const ConfigManager> config)
|
|||||||
setStandard(getValue<std::string>(key + "/standard", "", config));
|
setStandard(getValue<std::string>(key + "/standard", "", config));
|
||||||
setSourcePaths(getPathValues(key + "/source_paths/source_path", config));
|
setSourcePaths(getPathValues(key + "/source_paths/source_path", config));
|
||||||
setExcludePaths(getPathValues(key + "/exclude_paths/exclude_path", config));
|
setExcludePaths(getPathValues(key + "/exclude_paths/exclude_path", config));
|
||||||
setSourceExtensions(getValues(key + "/source_extensions/source_extension", std::vector<std::string>(), config));
|
setSourceExtensions(getValues(key + "/source_extensions/source_extension", std::vector<std::wstring>(), config));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config)
|
void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config)
|
||||||
@@ -158,7 +158,7 @@ void SourceGroupSettings::setExcludePaths(const std::vector<FilePath>& excludePa
|
|||||||
m_excludePaths = excludePaths;
|
m_excludePaths = excludePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> SourceGroupSettings::getSourceExtensions() const
|
std::vector<std::wstring> SourceGroupSettings::getSourceExtensions() const
|
||||||
{
|
{
|
||||||
if (m_sourceExtensions.empty())
|
if (m_sourceExtensions.empty())
|
||||||
{
|
{
|
||||||
@@ -167,7 +167,7 @@ std::vector<std::string> SourceGroupSettings::getSourceExtensions() const
|
|||||||
return m_sourceExtensions;
|
return m_sourceExtensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceGroupSettings::setSourceExtensions(const std::vector<std::string>& sourceExtensions)
|
void SourceGroupSettings::setSourceExtensions(const std::vector<std::wstring>& sourceExtensions)
|
||||||
{
|
{
|
||||||
m_sourceExtensions = sourceExtensions;
|
m_sourceExtensions = sourceExtensions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ public:
|
|||||||
std::vector<FilePath> getExcludePathsExpandedAndAbsolute() const;
|
std::vector<FilePath> getExcludePathsExpandedAndAbsolute() const;
|
||||||
void setExcludePaths(const std::vector<FilePath>& excludePaths);
|
void setExcludePaths(const std::vector<FilePath>& excludePaths);
|
||||||
|
|
||||||
std::vector<std::string> getSourceExtensions() const;
|
std::vector<std::wstring> getSourceExtensions() const;
|
||||||
void setSourceExtensions(const std::vector<std::string>& sourceExtensions);
|
void setSourceExtensions(const std::vector<std::wstring>& sourceExtensions);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -73,7 +73,7 @@ protected:
|
|||||||
const ProjectSettings* m_projectSettings;
|
const ProjectSettings* m_projectSettings;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual std::vector<std::string> getDefaultSourceExtensions() const = 0;
|
virtual std::vector<std::wstring> getDefaultSourceExtensions() const = 0;
|
||||||
virtual std::string getDefaultStandard() const = 0;
|
virtual std::string getDefaultStandard() const = 0;
|
||||||
|
|
||||||
std::string m_id;
|
std::string m_id;
|
||||||
@@ -84,7 +84,7 @@ private:
|
|||||||
std::string m_standard;
|
std::string m_standard;
|
||||||
std::vector<FilePath> m_sourcePaths;
|
std::vector<FilePath> m_sourcePaths;
|
||||||
std::vector<FilePath> m_excludePaths;
|
std::vector<FilePath> m_excludePaths;
|
||||||
std::vector<std::string> m_sourceExtensions;
|
std::vector<std::wstring> m_sourceExtensions;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
@@ -143,19 +143,19 @@ void SourceGroupSettingsCxx::setCompilerFlags(const std::vector<std::string>& co
|
|||||||
m_compilerFlags = compilerFlags;
|
m_compilerFlags = compilerFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> SourceGroupSettingsCxx::getDefaultSourceExtensions() const
|
std::vector<std::wstring> SourceGroupSettingsCxx::getDefaultSourceExtensions() const
|
||||||
{
|
{
|
||||||
std::vector<std::string> defaultValues;
|
std::vector<std::wstring> defaultValues;
|
||||||
|
|
||||||
switch (getType())
|
switch (getType())
|
||||||
{
|
{
|
||||||
case SOURCE_GROUP_CPP_EMPTY:
|
case SOURCE_GROUP_CPP_EMPTY:
|
||||||
defaultValues.push_back(".cpp");
|
defaultValues.push_back(L".cpp");
|
||||||
defaultValues.push_back(".cxx");
|
defaultValues.push_back(L".cxx");
|
||||||
defaultValues.push_back(".cc");
|
defaultValues.push_back(L".cc");
|
||||||
break;
|
break;
|
||||||
case SOURCE_GROUP_C_EMPTY:
|
case SOURCE_GROUP_C_EMPTY:
|
||||||
defaultValues.push_back(".c");
|
defaultValues.push_back(L".c");
|
||||||
break;
|
break;
|
||||||
case SOURCE_GROUP_CXX_CDB:
|
case SOURCE_GROUP_CXX_CDB:
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public:
|
|||||||
void setCompilerFlags(const std::vector<std::string>& compilerFlags);
|
void setCompilerFlags(const std::vector<std::string>& compilerFlags);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual std::vector<std::string> getDefaultSourceExtensions() const override;
|
virtual std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||||
virtual std::string getDefaultStandard() const override;
|
virtual std::string getDefaultStandard() const override;
|
||||||
|
|
||||||
std::vector<FilePath> m_headerSearchPaths;
|
std::vector<FilePath> m_headerSearchPaths;
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ void SourceGroupSettingsJava::setClasspath(const std::vector<FilePath>& classpat
|
|||||||
{
|
{
|
||||||
m_classpath = classpath;
|
m_classpath = classpath;
|
||||||
}
|
}
|
||||||
std::vector<std::string> SourceGroupSettingsJava::getDefaultSourceExtensions() const
|
std::vector<std::wstring> SourceGroupSettingsJava::getDefaultSourceExtensions() const
|
||||||
{
|
{
|
||||||
return std::vector<std::string>(1, ".java");
|
return { L".java" };
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SourceGroupSettingsJava::getDefaultStandard() const
|
std::string SourceGroupSettingsJava::getDefaultStandard() const
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
void setClasspath(const std::vector<FilePath>& classpath);
|
void setClasspath(const std::vector<FilePath>& classpath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual std::vector<std::string> getDefaultSourceExtensions() const override;
|
virtual std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||||
virtual std::string getDefaultStandard() const override;
|
virtual std::string getDefaultStandard() const override;
|
||||||
|
|
||||||
bool m_useJreSystemLibrary;
|
bool m_useJreSystemLibrary;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ FileManager::~FileManager()
|
|||||||
void FileManager::update(
|
void FileManager::update(
|
||||||
const std::vector<FilePath>& sourcePaths,
|
const std::vector<FilePath>& sourcePaths,
|
||||||
const std::vector<FilePath>& excludePaths,
|
const std::vector<FilePath>& excludePaths,
|
||||||
const std::vector<std::string>& sourceExtensions
|
const std::vector<std::wstring>& sourceExtensions
|
||||||
){
|
){
|
||||||
m_sourcePaths = sourcePaths;
|
m_sourcePaths = sourcePaths;
|
||||||
m_excludePaths = makeCanonical(excludePaths);
|
m_excludePaths = makeCanonical(excludePaths);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
void update(
|
void update(
|
||||||
const std::vector<FilePath>& sourcePaths,
|
const std::vector<FilePath>& sourcePaths,
|
||||||
const std::vector<FilePath>& excludePaths,
|
const std::vector<FilePath>& excludePaths,
|
||||||
const std::vector<std::string>& sourceExtensions
|
const std::vector<std::wstring>& sourceExtensions
|
||||||
);
|
);
|
||||||
|
|
||||||
// returns a list of source paths (can be directories) specified in the project settings
|
// returns a list of source paths (can be directories) specified in the project settings
|
||||||
@@ -36,7 +36,7 @@ private:
|
|||||||
|
|
||||||
std::vector<FilePath> m_sourcePaths;
|
std::vector<FilePath> m_sourcePaths;
|
||||||
std::vector<FilePath> m_excludePaths;
|
std::vector<FilePath> m_excludePaths;
|
||||||
std::vector<std::string> m_sourceExtensions;
|
std::vector<std::wstring> m_sourceExtensions;
|
||||||
|
|
||||||
std::set<FilePath> m_allSourceFilePaths;
|
std::set<FilePath> m_allSourceFilePaths;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -396,6 +396,11 @@ std::string FilePath::extension() const
|
|||||||
return m_path->extension().generic_string();
|
return m_path->extension().generic_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::wstring FilePath::wExtension() const
|
||||||
|
{
|
||||||
|
return m_path->extension().generic_wstring();
|
||||||
|
}
|
||||||
|
|
||||||
FilePath FilePath::withoutExtension() const
|
FilePath FilePath::withoutExtension() const
|
||||||
{
|
{
|
||||||
return FilePath(getPath().replace_extension().wstring());
|
return FilePath(getPath().replace_extension().wstring());
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public:
|
|||||||
std::wstring wFileName() const;
|
std::wstring wFileName() const;
|
||||||
|
|
||||||
std::string extension() const;
|
std::string extension() const;
|
||||||
|
std::wstring wExtension() const;
|
||||||
FilePath withoutExtension() const;
|
FilePath withoutExtension() const;
|
||||||
FilePath replaceExtension(const std::string& extension) const;
|
FilePath replaceExtension(const std::string& extension) const;
|
||||||
bool hasExtension(const std::vector<std::string>& extensions) const;
|
bool hasExtension(const std::vector<std::string>& extensions) const;
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ FileInfo FileSystem::getFileInfoForPath(const FilePath& filePath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FileInfo> FileSystem::getFileInfosFromPaths(
|
std::vector<FileInfo> FileSystem::getFileInfosFromPaths(
|
||||||
const std::vector<FilePath>& paths, const std::vector<std::string>& fileExtensions, bool followSymLinks
|
const std::vector<FilePath>& paths, const std::vector<std::wstring>& fileExtensions, bool followSymLinks
|
||||||
){
|
){
|
||||||
std::set<std::string> ext;
|
std::set<std::wstring> ext;
|
||||||
for (const std::string& e : fileExtensions)
|
for (const std::wstring& e : fileExtensions)
|
||||||
{
|
{
|
||||||
ext.insert(utility::toLowerCase(e));
|
ext.insert(utility::toLowerCase(e));
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ std::vector<FileInfo> FileSystem::getFileInfosFromPaths(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (boost::filesystem::is_regular_file(*it) &&
|
if (boost::filesystem::is_regular_file(*it) &&
|
||||||
(!ext.size() || ext.find(utility::toLowerCase(it->path().extension().string())) != ext.end()))
|
(ext.empty() || ext.find(utility::toLowerCase(it->path().extension().wstring())) != ext.end()))
|
||||||
{
|
{
|
||||||
boost::filesystem::path p = boost::filesystem::canonical(it->path());
|
boost::filesystem::path p = boost::filesystem::canonical(it->path());
|
||||||
if (filePaths.find(p) != filePaths.end())
|
if (filePaths.find(p) != filePaths.end())
|
||||||
@@ -115,7 +115,7 @@ std::vector<FileInfo> FileSystem::getFileInfosFromPaths(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (path.exists() && (!ext.size() || ext.find(utility::toLowerCase(path.extension())) != ext.end()))
|
else if (path.exists() && (ext.empty() || ext.find(utility::toLowerCase(path.wExtension())) != ext.end()))
|
||||||
{
|
{
|
||||||
const FilePath canonicalPath = path.getCanonical();
|
const FilePath canonicalPath = path.getCanonical();
|
||||||
boost::filesystem::path p = canonicalPath.getPath();
|
boost::filesystem::path p = canonicalPath.getPath();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
static FileInfo getFileInfoForPath(const FilePath& filePath);
|
static FileInfo getFileInfoForPath(const FilePath& filePath);
|
||||||
|
|
||||||
static std::vector<FileInfo> getFileInfosFromPaths(
|
static std::vector<FileInfo> getFileInfosFromPaths(
|
||||||
const std::vector<FilePath>& paths, const std::vector<std::string>& fileExtensions, bool followSymLinks = true);
|
const std::vector<FilePath>& paths, const std::vector<std::wstring>& fileExtensions, bool followSymLinks = true);
|
||||||
|
|
||||||
static std::set<FilePath> getSymLinkedDirectories(const std::vector<FilePath>& paths);
|
static std::set<FilePath> getSymLinkedDirectories(const std::vector<FilePath>& paths);
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
class MessageMoveIDECursor : public Message<MessageMoveIDECursor>
|
class MessageMoveIDECursor : public Message<MessageMoveIDECursor>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MessageMoveIDECursor(const FilePath& FilePos, const unsigned int Row, const unsigned int Column)
|
MessageMoveIDECursor(const FilePath& filePath, const unsigned int row, const unsigned int column)
|
||||||
: FilePosition(FilePos)
|
: filePath(filePath)
|
||||||
, Row(Row)
|
, row(row)
|
||||||
, Column(Column)
|
, column(column)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,12 +21,12 @@ public:
|
|||||||
|
|
||||||
virtual void print(std::ostream& os) const
|
virtual void print(std::ostream& os) const
|
||||||
{
|
{
|
||||||
os << FilePosition.str() << ":" << Row << ":" << Column;
|
os << filePath.str() << ":" << row << ":" << column;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FilePath FilePosition;
|
const FilePath filePath;
|
||||||
const unsigned int Row;
|
const unsigned int row;
|
||||||
const unsigned int Column;
|
const unsigned int column;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MESSAGE_MOVE_IDE_CURSOR_H
|
#endif // MESSAGE_MOVE_IDE_CURSOR_H
|
||||||
@@ -8,8 +8,7 @@ class MessagePingReceived
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MessagePingReceived()
|
MessagePingReceived()
|
||||||
: ideId("")
|
: ideName(L"")
|
||||||
, ideName("")
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,8 +17,7 @@ public:
|
|||||||
return "MessagePingReceived";
|
return "MessagePingReceived";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ideId;
|
std::wstring ideName;
|
||||||
std::string ideName;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MESSAGE_PING_RECEIVED_H
|
#endif // MESSAGE_PING_RECEIVED_H
|
||||||
@@ -7,9 +7,8 @@ class MessageProjectNew
|
|||||||
: public Message<MessageProjectNew>
|
: public Message<MessageProjectNew>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MessageProjectNew(const std::string cdbPath, const std::vector<std::string> headerPaths)
|
MessageProjectNew(const FilePath& cdbPath)
|
||||||
: cdbPath(cdbPath)
|
: cdbPath(cdbPath)
|
||||||
, headerPaths(headerPaths)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,8 +17,7 @@ public:
|
|||||||
return "MessageProjectNew";
|
return "MessageProjectNew";
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string cdbPath;
|
const FilePath cdbPath;
|
||||||
const std::vector<std::string> headerPaths;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MESSAGE_PROJECT_NEW_H
|
#endif // MESSAGE_PROJECT_NEW_H
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
template <typename StringType>
|
template <typename StringType>
|
||||||
StringType doRreplace(StringType str, const StringType& from, const StringType& to)
|
StringType doReplace(StringType str, const StringType& from, const StringType& to)
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
|
|
||||||
@@ -215,6 +215,13 @@ namespace utility
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::wstring toLowerCase(const std::wstring& in)
|
||||||
|
{
|
||||||
|
std::wstring out;
|
||||||
|
std::transform(in.begin(), in.end(), std::back_inserter(out), tolower);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
bool equalsCaseInsensitive(const std::string& a, const std::string& b)
|
bool equalsCaseInsensitive(const std::string& a, const std::string& b)
|
||||||
{
|
{
|
||||||
if (a.size() == b.size())
|
if (a.size() == b.size())
|
||||||
@@ -233,12 +240,12 @@ namespace utility
|
|||||||
|
|
||||||
std::string replace(std::string str, const std::string& from, const std::string& to)
|
std::string replace(std::string str, const std::string& from, const std::string& to)
|
||||||
{
|
{
|
||||||
return doRreplace(str, from, to);
|
return doReplace(str, from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring replace(std::wstring str, const std::wstring& from, const std::wstring& to)
|
std::wstring replace(std::wstring str, const std::wstring& from, const std::wstring& to)
|
||||||
{
|
{
|
||||||
return doRreplace(str, from, to);
|
return doReplace(str, from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string replaceBetween(const std::string& str, char startDelimiter, char endDelimiter, const std::string& to)
|
std::string replaceBetween(const std::string& str, char startDelimiter, char endDelimiter, const std::string& to)
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ namespace utility
|
|||||||
template <typename ContainerType>
|
template <typename ContainerType>
|
||||||
ContainerType split(const std::string& str, const std::string& delimiter);
|
ContainerType split(const std::string& str, const std::string& delimiter);
|
||||||
|
|
||||||
|
template <typename ContainerType>
|
||||||
|
ContainerType split(const std::wstring& str, const std::wstring& delimiter);
|
||||||
|
|
||||||
std::deque<std::string> split(const std::string& str, char delimiter);
|
std::deque<std::string> split(const std::string& str, char delimiter);
|
||||||
std::deque<std::string> split(const std::string& str, const std::string& delimiter);
|
std::deque<std::string> split(const std::string& str, const std::string& delimiter);
|
||||||
std::vector<std::string> splitToVector(const std::string& str, char delimiter);
|
std::vector<std::string> splitToVector(const std::string& str, char delimiter);
|
||||||
@@ -45,6 +48,7 @@ namespace utility
|
|||||||
|
|
||||||
std::string toUpperCase(const std::string& in);
|
std::string toUpperCase(const std::string& in);
|
||||||
std::string toLowerCase(const std::string& in);
|
std::string toLowerCase(const std::string& in);
|
||||||
|
std::wstring toLowerCase(const std::wstring& in);
|
||||||
bool equalsCaseInsensitive(const std::string& a, const std::string& b);
|
bool equalsCaseInsensitive(const std::string& a, const std::string& b);
|
||||||
|
|
||||||
std::string replace(std::string str, const std::string& from, const std::string& to);
|
std::string replace(std::string str, const std::string& from, const std::string& to);
|
||||||
@@ -80,8 +84,24 @@ namespace utility
|
|||||||
pos = str.find(delimiter, oldPos);
|
pos = str.find(delimiter, oldPos);
|
||||||
c.push_back(str.substr(oldPos, pos - oldPos));
|
c.push_back(str.substr(oldPos, pos - oldPos));
|
||||||
oldPos = pos + delimiter.size();
|
oldPos = pos + delimiter.size();
|
||||||
}
|
} while (pos != std::string::npos);
|
||||||
while (pos != std::string::npos);
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename ContainerType>
|
||||||
|
ContainerType split(const std::wstring& str, const std::wstring& delimiter)
|
||||||
|
{
|
||||||
|
size_t pos = 0;
|
||||||
|
size_t oldPos = 0;
|
||||||
|
ContainerType c;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
pos = str.find(delimiter, oldPos);
|
||||||
|
c.push_back(str.substr(oldPos, pos - oldPos));
|
||||||
|
oldPos = pos + delimiter.size();
|
||||||
|
} while (pos != std::wstring::npos);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ void QtListItemWidget::setText(QString text)
|
|||||||
{
|
{
|
||||||
const FilePath path(text.toStdWString());
|
const FilePath path(text.toStdWString());
|
||||||
const FilePath relPath = path.getRelativeTo(relativeRoot);
|
const FilePath relPath = path.getRelativeTo(relativeRoot);
|
||||||
if (relPath.str().size() < path.str().size())
|
if (relPath.wstr().size() < path.wstr().size())
|
||||||
{
|
{
|
||||||
text = QString::fromStdString(relPath.str());
|
text = QString::fromStdWString(relPath.wstr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,46 +239,45 @@ void QtDirectoryListBox::dropEvent(QDropEvent *event)
|
|||||||
|
|
||||||
std::vector<FilePath> QtDirectoryListBox::getList()
|
std::vector<FilePath> QtDirectoryListBox::getList()
|
||||||
{
|
{
|
||||||
std::vector<std::string> strList = getStringList();
|
|
||||||
std::vector<FilePath> list;
|
std::vector<FilePath> list;
|
||||||
for (const std::string& str : strList)
|
for (const std::wstring& s : getWStringList())
|
||||||
{
|
{
|
||||||
list.push_back(FilePath(str));
|
list.push_back(FilePath(s));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtDirectoryListBox::setList(const std::vector<FilePath>& list, bool readOnly)
|
void QtDirectoryListBox::setList(const std::vector<FilePath>& list, bool readOnly)
|
||||||
{
|
{
|
||||||
std::vector<std::string> strList;
|
std::vector<std::wstring> strList;
|
||||||
for (const FilePath& path : list)
|
for (const FilePath& path : list)
|
||||||
{
|
{
|
||||||
strList.push_back(path.str());
|
strList.push_back(path.wstr());
|
||||||
}
|
}
|
||||||
setStringList(strList, readOnly);
|
setWStringList(strList, readOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> QtDirectoryListBox::getStringList()
|
std::vector<std::wstring> QtDirectoryListBox::getWStringList()
|
||||||
{
|
{
|
||||||
std::vector<std::string> list;
|
std::vector<std::wstring> list;
|
||||||
for (int i = 0; i < m_list->count(); ++i)
|
for (int i = 0; i < m_list->count(); ++i)
|
||||||
{
|
{
|
||||||
QtListItemWidget* widget = dynamic_cast<QtListItemWidget*>(m_list->itemWidget(m_list->item(i)));
|
QtListItemWidget* widget = dynamic_cast<QtListItemWidget*>(m_list->itemWidget(m_list->item(i)));
|
||||||
list.push_back(widget->getText().toStdString());
|
list.push_back(widget->getText().toStdWString());
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtDirectoryListBox::setStringList(const std::vector<std::string>& list, bool readOnly)
|
void QtDirectoryListBox::setWStringList(const std::vector<std::wstring>& list, bool readOnly)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
FilePath root = m_relativeRootDirectory;
|
FilePath root = m_relativeRootDirectory;
|
||||||
m_relativeRootDirectory = FilePath();
|
m_relativeRootDirectory = FilePath();
|
||||||
|
|
||||||
for (const std::string& str : list)
|
for (const std::wstring& str : list)
|
||||||
{
|
{
|
||||||
QtListItemWidget* itemWidget = addListBoxItemWithText(QString::fromStdString(str));
|
QtListItemWidget* itemWidget = addListBoxItemWithText(QString::fromStdWString(str));
|
||||||
itemWidget->setReadOnly(readOnly);
|
itemWidget->setReadOnly(readOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,6 +285,26 @@ void QtDirectoryListBox::setStringList(const std::vector<std::string>& list, boo
|
|||||||
m_relativeRootDirectory = root;
|
m_relativeRootDirectory = root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> QtDirectoryListBox::getStringList()
|
||||||
|
{
|
||||||
|
std::vector<std::string> list;
|
||||||
|
for (std::wstring s: getWStringList())
|
||||||
|
{
|
||||||
|
list.push_back(utility::encodeToUtf8(s));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtDirectoryListBox::setStringList(const std::vector<std::string>& list, bool readOnly)
|
||||||
|
{
|
||||||
|
std::vector<std::wstring> wlist;
|
||||||
|
for (std::string s : list)
|
||||||
|
{
|
||||||
|
wlist.push_back(utility::decodeFromUtf8(s));
|
||||||
|
}
|
||||||
|
setWStringList(wlist);
|
||||||
|
}
|
||||||
|
|
||||||
QtListItemWidget* QtDirectoryListBox::addListBoxItemWithText(const QString& text)
|
QtListItemWidget* QtDirectoryListBox::addListBoxItemWithText(const QString& text)
|
||||||
{
|
{
|
||||||
QtListItemWidget* widget = addListBoxItem();
|
QtListItemWidget* widget = addListBoxItem();
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ public:
|
|||||||
std::vector<FilePath> getList();
|
std::vector<FilePath> getList();
|
||||||
void setList(const std::vector<FilePath>& list, bool readOnly = false);
|
void setList(const std::vector<FilePath>& list, bool readOnly = false);
|
||||||
|
|
||||||
|
std::vector<std::wstring> getWStringList();
|
||||||
|
void setWStringList(const std::vector<std::wstring>& list, bool readOnly = false);
|
||||||
|
|
||||||
std::vector<std::string> getStringList();
|
std::vector<std::string> getStringList();
|
||||||
void setStringList(const std::vector<std::string>& list, bool readOnly = false);
|
void setStringList(const std::vector<std::string>& list, bool readOnly = false);
|
||||||
|
|
||||||
|
|||||||
@@ -101,9 +101,9 @@ void QtStatusBar::setErrorCount(ErrorCountInfo errorCount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtStatusBar::setIdeStatus(const std::string& text)
|
void QtStatusBar::setIdeStatus(const std::wstring& text)
|
||||||
{
|
{
|
||||||
m_ideStatusText.setText(text.c_str());
|
m_ideStatusText.setText(QString::fromStdWString(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtStatusBar::resizeEvent(QResizeEvent* event)
|
void QtStatusBar::resizeEvent(QResizeEvent* event)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
void setText(const std::wstring& text, bool isError, bool showLoader);
|
void setText(const std::wstring& text, bool isError, bool showLoader);
|
||||||
void setErrorCount(ErrorCountInfo errorCount);
|
void setErrorCount(ErrorCountInfo errorCount);
|
||||||
|
|
||||||
void setIdeStatus(const std::string& text);
|
void setIdeStatus(const std::wstring& text);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent* event);
|
virtual void resizeEvent(QResizeEvent* event);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ bool QtIDECommunicationController::isListening() const
|
|||||||
return m_tcpWrapper.isListening();
|
return m_tcpWrapper.isListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtIDECommunicationController::sendMessage(const std::string& message) const
|
void QtIDECommunicationController::sendMessage(const std::wstring& message) const
|
||||||
{
|
{
|
||||||
m_tcpWrapper.sendMessage(message);
|
m_tcpWrapper.sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
virtual bool isListening() const;
|
virtual bool isListening() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void sendMessage(const std::string& message) const;
|
virtual void sendMessage(const std::wstring& message) const;
|
||||||
|
|
||||||
QtTcpWrapper m_tcpWrapper;
|
QtTcpWrapper m_tcpWrapper;
|
||||||
|
|
||||||
|
|||||||
@@ -43,10 +43,9 @@ QtTcpWrapper::~QtTcpWrapper()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtTcpWrapper::sendMessage(const std::string& message) const
|
void QtTcpWrapper::sendMessage(const std::wstring& message) const
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data = QString::fromStdWString(message).toUtf8();
|
||||||
data.append(message.c_str());
|
|
||||||
|
|
||||||
QTcpSocket socket;
|
QTcpSocket socket;
|
||||||
socket.connectToHost(QHostAddress::LocalHost, m_clientPort);
|
socket.connectToHost(QHostAddress::LocalHost, m_clientPort);
|
||||||
@@ -60,7 +59,7 @@ void QtTcpWrapper::sendMessage(const std::string& message) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtTcpWrapper::setReadCallback(const std::function<void(const std::string&)>& callback)
|
void QtTcpWrapper::setReadCallback(const std::function<void(const std::wstring&)>& callback)
|
||||||
{
|
{
|
||||||
m_readCallback = callback;
|
m_readCallback = callback;
|
||||||
}
|
}
|
||||||
@@ -110,12 +109,11 @@ void QtTcpWrapper::startRead()
|
|||||||
QString string;
|
QString string;
|
||||||
stream >> string;*/
|
stream >> string;*/
|
||||||
|
|
||||||
QString string = QString::fromUtf8(byteArray);
|
QString message = QString::fromUtf8(byteArray);
|
||||||
|
|
||||||
if (m_readCallback != NULL)
|
if (m_readCallback != NULL)
|
||||||
{
|
{
|
||||||
std::string message = string.toStdString();
|
m_readCallback(message.toStdWString());
|
||||||
m_readCallback(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*char buffer[1024] = { 0 };
|
/*char buffer[1024] = { 0 };
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ public:
|
|||||||
void startListening();
|
void startListening();
|
||||||
void stopListening();
|
void stopListening();
|
||||||
|
|
||||||
void sendMessage(const std::string& message) const;
|
void sendMessage(const std::wstring& message) const;
|
||||||
|
|
||||||
void setReadCallback(const std::function<void(const std::string&)>& callback);
|
void setReadCallback(const std::function<void(const std::wstring&)>& callback);
|
||||||
|
|
||||||
quint16 getServerPort() const;
|
quint16 getServerPort() const;
|
||||||
void setServerPort(const quint16 serverPort);
|
void setServerPort(const quint16 serverPort);
|
||||||
@@ -42,7 +42,7 @@ private:
|
|||||||
quint16 m_clientPort;
|
quint16 m_clientPort;
|
||||||
std::string m_ip;
|
std::string m_ip;
|
||||||
|
|
||||||
std::function<void(const std::string&)> m_readCallback;
|
std::function<void(const std::wstring&)> m_readCallback;
|
||||||
|
|
||||||
QTcpServer* m_tcpServer;
|
QTcpServer* m_tcpServer;
|
||||||
QTcpSocket* m_tcpClient;
|
QTcpSocket* m_tcpClient;
|
||||||
|
|||||||
@@ -189,13 +189,12 @@ void QtMainView::handleMessage(MessageProjectEdit* message)
|
|||||||
|
|
||||||
void QtMainView::handleMessage(MessageProjectNew* message)
|
void QtMainView::handleMessage(MessageProjectNew* message)
|
||||||
{
|
{
|
||||||
std::string cdbPath = message->cdbPath;
|
FilePath cdbPath = message->cdbPath;
|
||||||
std::vector<std::string> headerPaths = message->headerPaths;
|
|
||||||
|
|
||||||
m_onQtThread(
|
m_onQtThread(
|
||||||
[=]()
|
[=]()
|
||||||
{
|
{
|
||||||
m_window->newProjectFromCDB(cdbPath, headerPaths);
|
m_window->newProjectFromCDB(cdbPath);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void QtStatusBarView::setErrorCount(ErrorCountInfo errorCount)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtStatusBarView::showIdeStatus(const std::string& message)
|
void QtStatusBarView::showIdeStatus(const std::wstring& message)
|
||||||
{
|
{
|
||||||
m_onQtThread(
|
m_onQtThread(
|
||||||
[=]()
|
[=]()
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
virtual void showMessage(const std::wstring& message, bool isError, bool showLoader);
|
virtual void showMessage(const std::wstring& message, bool isError, bool showLoader);
|
||||||
virtual void setErrorCount(ErrorCountInfo errorCount);
|
virtual void setErrorCount(ErrorCountInfo errorCount);
|
||||||
|
|
||||||
virtual void showIdeStatus(const std::string& message);
|
virtual void showIdeStatus(const std::wstring& message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QtThreadedLambdaFunctor m_onQtThread;
|
QtThreadedLambdaFunctor m_onQtThread;
|
||||||
|
|||||||
@@ -565,7 +565,7 @@ void QtMainWindow::newProject()
|
|||||||
wizzard->newProject();
|
wizzard->newProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtMainWindow::newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths)
|
void QtMainWindow::newProjectFromCDB(const FilePath& filePath)
|
||||||
{
|
{
|
||||||
QtProjectWizzard* wizzard = dynamic_cast<QtProjectWizzard*>(m_windowStack.getTopWindow());
|
QtProjectWizzard* wizzard = dynamic_cast<QtProjectWizzard*>(m_windowStack.getTopWindow());
|
||||||
if (!wizzard)
|
if (!wizzard)
|
||||||
@@ -573,13 +573,7 @@ void QtMainWindow::newProjectFromCDB(const std::string& filePath, const std::vec
|
|||||||
wizzard = createWindow<QtProjectWizzard>();
|
wizzard = createWindow<QtProjectWizzard>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FilePath> headerFilePaths;
|
wizzard->newProjectFromCDB(filePath);
|
||||||
for (const std::string& s: headerPaths)
|
|
||||||
{
|
|
||||||
headerFilePaths.push_back(FilePath(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
wizzard->newProjectFromCDB(FilePath(filePath), headerFilePaths);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtMainWindow::openProject()
|
void QtMainWindow::openProject()
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public slots:
|
|||||||
void hideStartScreen();
|
void hideStartScreen();
|
||||||
|
|
||||||
void newProject();
|
void newProject();
|
||||||
void newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths);
|
void newProjectFromCDB(const FilePath& filePath);
|
||||||
void openProject();
|
void openProject();
|
||||||
void editProject();
|
void editProject();
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,16 @@ std::string QtTextEditDialog::getText()
|
|||||||
return m_text->toPlainText().toStdString();
|
return m_text->toPlainText().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtTextEditDialog::setWText(const std::wstring& text)
|
||||||
|
{
|
||||||
|
m_text->setPlainText(QString::fromStdWString(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring QtTextEditDialog::getWText()
|
||||||
|
{
|
||||||
|
return m_text->toPlainText().toStdWString();
|
||||||
|
}
|
||||||
|
|
||||||
void QtTextEditDialog::setReadOnly(bool readOnly)
|
void QtTextEditDialog::setReadOnly(bool readOnly)
|
||||||
{
|
{
|
||||||
m_text->setReadOnly(readOnly);
|
m_text->setReadOnly(readOnly);
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public:
|
|||||||
void setText(const std::string& text);
|
void setText(const std::string& text);
|
||||||
std::string getText();
|
std::string getText();
|
||||||
|
|
||||||
|
void setWText(const std::wstring& text);
|
||||||
|
std::wstring getWText();
|
||||||
|
|
||||||
void setReadOnly(bool readOnly);
|
void setReadOnly(bool readOnly);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ void QtProjectWizzard::newProject()
|
|||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath, const std::vector<FilePath>& headerPaths)
|
void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath)
|
||||||
{
|
{
|
||||||
if (!m_projectSettings)
|
if (!m_projectSettings)
|
||||||
{
|
{
|
||||||
@@ -91,16 +91,11 @@ void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath, const std::ve
|
|||||||
std::shared_ptr<SourceGroupSettingsCxxCdb> sourceGroupSettings =
|
std::shared_ptr<SourceGroupSettingsCxxCdb> sourceGroupSettings =
|
||||||
std::make_shared<SourceGroupSettingsCxxCdb>(utility::getUuidString(), m_projectSettings.get());
|
std::make_shared<SourceGroupSettingsCxxCdb>(utility::getUuidString(), m_projectSettings.get());
|
||||||
sourceGroupSettings->setCompilationDatabasePath(filePath);
|
sourceGroupSettings->setCompilationDatabasePath(filePath);
|
||||||
sourceGroupSettings->setSourcePaths(headerPaths);
|
|
||||||
m_newSourceGroupSettings = sourceGroupSettings;
|
m_newSourceGroupSettings = sourceGroupSettings;
|
||||||
|
|
||||||
emptySourceGroupCDBVS();
|
emptySourceGroupCDBVS();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtProjectWizzard::refreshProjectFromSolution(const std::string& ideId, const std::string& solutionPath)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtProjectWizzard::editProject(const FilePath& settingsPath)
|
void QtProjectWizzard::editProject(const FilePath& settingsPath)
|
||||||
{
|
{
|
||||||
std::shared_ptr<ProjectSettings> settings = std::make_shared<ProjectSettings>(settingsPath);
|
std::shared_ptr<ProjectSettings> settings = std::make_shared<ProjectSettings>(settingsPath);
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void newProject();
|
void newProject();
|
||||||
|
|
||||||
void newProjectFromCDB(const FilePath& filePath, const std::vector<FilePath>& headerPaths);
|
void newProjectFromCDB(const FilePath& filePath);
|
||||||
void refreshProjectFromSolution(const std::string& ideId, const std::string& solutionPath);
|
|
||||||
|
|
||||||
void editProject(const FilePath& settingsPath);
|
void editProject(const FilePath& settingsPath);
|
||||||
void editProject(std::shared_ptr<ProjectSettings> settings);
|
void editProject(std::shared_ptr<ProjectSettings> settings);
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ void QtProjectWizzardContentExtensions::populate(QGridLayout* layout, int& row)
|
|||||||
|
|
||||||
void QtProjectWizzardContentExtensions::load()
|
void QtProjectWizzardContentExtensions::load()
|
||||||
{
|
{
|
||||||
m_sourceList->setStringList(m_settings->getSourceExtensions());
|
m_sourceList->setWStringList(m_settings->getSourceExtensions());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtProjectWizzardContentExtensions::save()
|
void QtProjectWizzardContentExtensions::save()
|
||||||
{
|
{
|
||||||
m_settings->setSourceExtensions(m_sourceList->getStringList());
|
m_settings->setSourceExtensions(m_sourceList->getWStringList());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ bool QtProjectWizzardContentPaths::check()
|
|||||||
{
|
{
|
||||||
if (!expandedPath.exists())
|
if (!expandedPath.exists())
|
||||||
{
|
{
|
||||||
missingPaths.append((expandedPath.str() + "\n").c_str());
|
missingPaths.append(QString::fromStdWString(expandedPath.wstr() + L"\n"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ bool QtProjectWizzardContentPaths::check()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expandedPaths.size() && expandedPaths.size() == existingCount)
|
if (!expandedPaths.empty() && expandedPaths.size() == existingCount)
|
||||||
{
|
{
|
||||||
existingPaths.push_back(path);
|
existingPaths.push_back(path);
|
||||||
}
|
}
|
||||||
@@ -648,13 +648,13 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
|
|||||||
|
|
||||||
void QtProjectWizzardContentPathsHeaderSearch::finishedAcceptDetectedIncludePathsDialog()
|
void QtProjectWizzardContentPathsHeaderSearch::finishedAcceptDetectedIncludePathsDialog()
|
||||||
{
|
{
|
||||||
const std::vector<std::string> detectedPaths = utility::splitToVector(m_filesDialog->getText(), "\n");
|
const std::vector<std::wstring> detectedPaths = utility::split<std::vector<std::wstring>>(m_filesDialog->getWText(), L"\n");
|
||||||
closedFilesDialog();
|
closedFilesDialog();
|
||||||
|
|
||||||
std::vector<std::string> headerSearchPaths = m_list->getStringList();
|
std::vector<std::wstring> headerSearchPaths = m_list->getWStringList();
|
||||||
|
|
||||||
headerSearchPaths.reserve(headerSearchPaths.size() + detectedPaths.size());
|
headerSearchPaths.reserve(headerSearchPaths.size() + detectedPaths.size());
|
||||||
for (const std::string& detectedPath : detectedPaths)
|
for (const std::wstring& detectedPath : detectedPaths)
|
||||||
{
|
{
|
||||||
if (!detectedPath.empty())
|
if (!detectedPath.empty())
|
||||||
{
|
{
|
||||||
@@ -662,7 +662,7 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedAcceptDetectedIncludePath
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_list->setStringList(headerSearchPaths);
|
m_list->setWStringList(headerSearchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtProjectWizzardContentPathsHeaderSearch::closedPathsDialog()
|
void QtProjectWizzardContentPathsHeaderSearch::closedPathsDialog()
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "cxxtest/TestSuite.h"
|
#include "cxxtest/TestSuite.h"
|
||||||
|
|
||||||
#include "utility/file/FileManager.h"
|
#include "utility/file/FileManager.h"
|
||||||
|
#include "utility/file/FilePath.h"
|
||||||
|
#include "utility/utility.h"
|
||||||
|
|
||||||
class FileManagerTestSuite : public CxxTest::TestSuite
|
class FileManagerTestSuite : public CxxTest::TestSuite
|
||||||
{
|
{
|
||||||
@@ -12,14 +14,19 @@ public:
|
|||||||
sourcePaths.push_back(FilePath(L"./data/FileManagerTestSuite/include/"));
|
sourcePaths.push_back(FilePath(L"./data/FileManagerTestSuite/include/"));
|
||||||
std::vector<FilePath> headerPaths;
|
std::vector<FilePath> headerPaths;
|
||||||
std::vector<FilePath> excludePaths;
|
std::vector<FilePath> excludePaths;
|
||||||
std::vector<std::string> sourceExtensions;
|
const wchar_t specialCharacter(252);
|
||||||
sourceExtensions.push_back(".cpp");
|
std::wstring specialExtension = L".";
|
||||||
sourceExtensions.push_back(".c");
|
specialExtension += specialCharacter;
|
||||||
|
std::vector<std::wstring> sourceExtensions = { L".cpp", L".c", specialExtension };
|
||||||
|
|
||||||
FileManager fm;
|
FileManager fm;
|
||||||
fm.update(sourcePaths, excludePaths, sourceExtensions);
|
fm.update(sourcePaths, excludePaths, sourceExtensions);
|
||||||
std::set<FilePath> filePaths = fm.getAllSourceFilePaths();
|
std::vector<FilePath> filePaths = utility::toVector(fm.getAllSourceFilePaths());
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(filePaths.size(), 2);
|
TS_ASSERT_EQUALS(filePaths.size(), 3);
|
||||||
|
TS_ASSERT(utility::containsElement<FilePath>(filePaths, FilePath(L"./data/FileManagerTestSuite/src/a.cpp")));
|
||||||
|
TS_ASSERT(utility::containsElement<FilePath>(filePaths, FilePath(L"./data/FileManagerTestSuite/src/d.c")));
|
||||||
|
TS_ASSERT(utility::containsElement<FilePath>(filePaths, FilePath(L"./data/FileManagerTestSuite/src/e" + specialExtension)));
|
||||||
|
int ee = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "utility/file/FileSystem.h"
|
#include "utility/file/FileSystem.h"
|
||||||
|
#include "utility/utility.h"
|
||||||
|
|
||||||
class FileSystemTestSuite: public CxxTest::TestSuite
|
class FileSystemTestSuite: public CxxTest::TestSuite
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,60 +7,60 @@ class NetworkProtocolHelperTestSuite : public CxxTest::TestSuite
|
|||||||
public:
|
public:
|
||||||
void test_parse_message(void)
|
void test_parse_message(void)
|
||||||
{
|
{
|
||||||
std::string type = "setActiveToken";
|
std::wstring type = L"setActiveToken";
|
||||||
std::string divider = ">>";
|
std::wstring divider = L">>";
|
||||||
std::string filePath = "C:\\Users\\Manuel\\imporant\\file\\location\\fileName.cpp";
|
std::wstring filePath = L"C:/Users/Manuel/imporant/file/location/fileName.cpp";
|
||||||
std::string endOfMessageToken = "<EOM>";
|
std::wstring endOfMessageToken = L"<EOM>";
|
||||||
int row = 1;
|
int row = 1;
|
||||||
int column = 2;
|
int column = 2;
|
||||||
|
|
||||||
// valid message
|
// valid message
|
||||||
std::stringstream message;
|
std::wstringstream message;
|
||||||
message << type << divider << filePath << divider << row << divider << column << endOfMessageToken;
|
message << type << divider << filePath << divider << row << divider << column << endOfMessageToken;
|
||||||
|
|
||||||
NetworkProtocolHelper::SetActiveTokenMessage networkMessage = NetworkProtocolHelper::parseSetActiveTokenMessage(message.str());
|
NetworkProtocolHelper::SetActiveTokenMessage networkMessage = NetworkProtocolHelper::parseSetActiveTokenMessage(message.str());
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(networkMessage.fileLocation, filePath);
|
TS_ASSERT_EQUALS(networkMessage.filePath.wstr(), filePath);
|
||||||
TS_ASSERT_EQUALS(networkMessage.row, row);
|
TS_ASSERT_EQUALS(networkMessage.row, row);
|
||||||
TS_ASSERT_EQUALS(networkMessage.column, column);
|
TS_ASSERT_EQUALS(networkMessage.column, column);
|
||||||
TS_ASSERT_EQUALS(networkMessage.valid, true);
|
TS_ASSERT_EQUALS(networkMessage.valid, true);
|
||||||
|
|
||||||
// invalid type
|
// invalid type
|
||||||
message.str("");
|
message.str(L"");
|
||||||
message << "foo" << divider << filePath << divider << row << divider << column << endOfMessageToken;
|
message << L"foo" << divider << filePath << divider << row << divider << column << endOfMessageToken;
|
||||||
networkMessage = NetworkProtocolHelper::parseSetActiveTokenMessage(message.str());
|
networkMessage = NetworkProtocolHelper::parseSetActiveTokenMessage(message.str());
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(networkMessage.fileLocation, "");
|
TS_ASSERT_EQUALS(networkMessage.filePath.wstr(), L"");
|
||||||
TS_ASSERT_EQUALS(networkMessage.row, 0);
|
TS_ASSERT_EQUALS(networkMessage.row, 0);
|
||||||
TS_ASSERT_EQUALS(networkMessage.column, 0);
|
TS_ASSERT_EQUALS(networkMessage.column, 0);
|
||||||
TS_ASSERT_EQUALS(networkMessage.valid, false);
|
TS_ASSERT_EQUALS(networkMessage.valid, false);
|
||||||
|
|
||||||
// missing divider
|
// missing divider
|
||||||
message.str("");
|
message.str(L"");
|
||||||
message << type << divider << filePath << row << divider << column << endOfMessageToken;
|
message << type << divider << filePath << row << divider << column << endOfMessageToken;
|
||||||
networkMessage = NetworkProtocolHelper::parseSetActiveTokenMessage(message.str());
|
networkMessage = NetworkProtocolHelper::parseSetActiveTokenMessage(message.str());
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(networkMessage.fileLocation, "");
|
TS_ASSERT_EQUALS(networkMessage.filePath.wstr(), L"");
|
||||||
TS_ASSERT_EQUALS(networkMessage.row, 0);
|
TS_ASSERT_EQUALS(networkMessage.row, 0);
|
||||||
TS_ASSERT_EQUALS(networkMessage.column, 0);
|
TS_ASSERT_EQUALS(networkMessage.column, 0);
|
||||||
TS_ASSERT_EQUALS(networkMessage.valid, false);
|
TS_ASSERT_EQUALS(networkMessage.valid, false);
|
||||||
|
|
||||||
// invalid row
|
// invalid row
|
||||||
message.str("");
|
message.str(L"");
|
||||||
message << type << divider << filePath << divider << "potato" << divider << column << endOfMessageToken;
|
message << type << divider << filePath << divider << "potato" << divider << column << endOfMessageToken;
|
||||||
networkMessage = NetworkProtocolHelper::parseSetActiveTokenMessage(message.str());
|
networkMessage = NetworkProtocolHelper::parseSetActiveTokenMessage(message.str());
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(networkMessage.fileLocation, "");
|
TS_ASSERT_EQUALS(networkMessage.filePath.wstr(), L"");
|
||||||
TS_ASSERT_EQUALS(networkMessage.row, 0);
|
TS_ASSERT_EQUALS(networkMessage.row, 0);
|
||||||
TS_ASSERT_EQUALS(networkMessage.column, 0);
|
TS_ASSERT_EQUALS(networkMessage.column, 0);
|
||||||
TS_ASSERT_EQUALS(networkMessage.valid, false);
|
TS_ASSERT_EQUALS(networkMessage.valid, false);
|
||||||
|
|
||||||
// invalid column
|
// invalid column
|
||||||
message.str("");
|
message.str(L"");
|
||||||
message << type << divider << filePath << divider << row << divider << "laz0r" << endOfMessageToken;
|
message << type << divider << filePath << divider << row << divider << "laz0r" << endOfMessageToken;
|
||||||
networkMessage = NetworkProtocolHelper::parseSetActiveTokenMessage(message.str());
|
networkMessage = NetworkProtocolHelper::parseSetActiveTokenMessage(message.str());
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(networkMessage.fileLocation, "");
|
TS_ASSERT_EQUALS(networkMessage.filePath.wstr(), L"");
|
||||||
TS_ASSERT_EQUALS(networkMessage.row, 0);
|
TS_ASSERT_EQUALS(networkMessage.row, 0);
|
||||||
TS_ASSERT_EQUALS(networkMessage.column, 0);
|
TS_ASSERT_EQUALS(networkMessage.column, 0);
|
||||||
TS_ASSERT_EQUALS(networkMessage.valid, false);
|
TS_ASSERT_EQUALS(networkMessage.valid, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user