src: switch to wstring for printing messages
This commit is contained in:
@@ -29,6 +29,27 @@
|
||||
} \
|
||||
while(0)
|
||||
|
||||
#define LOG_INFO_BARE(__str__) \
|
||||
do \
|
||||
{ \
|
||||
LogManager::getInstance()->logInfo(__str__, "", "", 0); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
#define LOG_WARNING_BARE(__str__) \
|
||||
do \
|
||||
{ \
|
||||
LogManager::getInstance()->logWarning(__str__, "", "", 0); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
#define LOG_ERROR_BARE(__str__) \
|
||||
do \
|
||||
{ \
|
||||
LogManager::getInstance()->logError(__str__, "", "", 0); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
#define LOG_INFO_STREAM(__s__) \
|
||||
do \
|
||||
{ \
|
||||
|
||||
@@ -89,6 +89,7 @@ public:
|
||||
bool operator!=(const VectorBase<U, N>& other) const;
|
||||
|
||||
std::string toString() const;
|
||||
std::wstring toWString() const;
|
||||
|
||||
protected:
|
||||
T m_values[N];
|
||||
@@ -441,6 +442,21 @@ std::string VectorBase<T, N>::toString() const
|
||||
return result.str();
|
||||
}
|
||||
|
||||
template<class T, unsigned int N>
|
||||
std::wstring VectorBase<T, N>::toWString() const
|
||||
{
|
||||
std::wstringstream result;
|
||||
result << L"[";
|
||||
|
||||
for (unsigned int i = 0; i < N - 1; i++)
|
||||
{
|
||||
result << m_values[i] << L", ";
|
||||
}
|
||||
result << m_values[N - 1] << L"]";
|
||||
|
||||
return result.str();
|
||||
}
|
||||
|
||||
template<class T, unsigned int N>
|
||||
std::ostream& operator<<(std::ostream& ostream, const VectorBase<T, N>& vector)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
MessageQueue::getInstance()->processMessage(message, true);
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "utility/types.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
class MessageBase
|
||||
{
|
||||
@@ -92,12 +93,12 @@ public:
|
||||
return m_keepContent;
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const = 0;
|
||||
virtual void print(std::wostream& os) const = 0;
|
||||
|
||||
std::string str() const
|
||||
std::wstring str() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << getType() << " ";
|
||||
std::wstringstream ss;
|
||||
ss << utility::decodeFromUtf8(getType()) << L" ";
|
||||
print(ss);
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void MessageQueue::processMessage(std::shared_ptr<MessageBase> message, bool asN
|
||||
{
|
||||
if (message->isLogged())
|
||||
{
|
||||
LOG_INFO_STREAM_BARE(<< "send " << message->str());
|
||||
LOG_INFO_BARE(L"send " + message->str());
|
||||
}
|
||||
|
||||
if (m_sendMessagesAsTasks && message->sendAsTask())
|
||||
|
||||
@@ -34,17 +34,17 @@ public:
|
||||
return type == Edge::EDGE_AGGREGATION;
|
||||
}
|
||||
|
||||
std::string getFullName() const
|
||||
std::wstring getFullName() const
|
||||
{
|
||||
std::wstring name = Edge::getReadableTypeString(type) + L":";
|
||||
name += sourceNameHierarchy.getQualifiedNameWithSignature() + L"->";
|
||||
name += targetNameHierarchy.getQualifiedNameWithSignature();
|
||||
return utility::encodeToUtf8(name);
|
||||
return name;
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << tokenId << " - " << getFullName();
|
||||
os << tokenId << L" - " << getFullName();
|
||||
}
|
||||
|
||||
const Id tokenId;
|
||||
|
||||
@@ -18,9 +18,9 @@ public:
|
||||
return "MessageActivateFile";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << filePath.str();
|
||||
os << filePath.wstr();
|
||||
}
|
||||
|
||||
const FilePath filePath;
|
||||
|
||||
@@ -27,11 +27,11 @@ public:
|
||||
return "MessageActivateLocalSymbols";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
for (const Id& symbolId : symbolIds)
|
||||
{
|
||||
os << symbolId << " ";
|
||||
os << symbolId << L" ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,11 +36,11 @@ public:
|
||||
return "MessageActivateNodes";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
for (const ActiveNode& node : nodes)
|
||||
{
|
||||
os << node.nodeId << " ";
|
||||
os << node.nodeId << L" ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@ public:
|
||||
return "MessageActivateSourceLocations";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
for (const Id& id : locationIds)
|
||||
{
|
||||
os << id << " ";
|
||||
os << id << L" ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@ public:
|
||||
return "MessageActivateTokenIds";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
for (const Id& id : tokenIds)
|
||||
{
|
||||
os << id << " ";
|
||||
os << id << L" ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ public:
|
||||
return "MessageActivateTokens";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
for (const Id& id : tokenIds)
|
||||
{
|
||||
os << id << " ";
|
||||
os << id << L" ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,17 +27,17 @@ public:
|
||||
return "MessageActivateTrailEdge";
|
||||
}
|
||||
|
||||
std::string getFullName() const
|
||||
std::wstring getFullName() const
|
||||
{
|
||||
std::wstring name = Edge::getReadableTypeString(type) + L":";
|
||||
name += sourceNameHierarchy.getQualifiedNameWithSignature() + L"->";
|
||||
name += targetNameHierarchy.getQualifiedNameWithSignature();
|
||||
return utility::encodeToUtf8(name);
|
||||
return name;
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << tokenId << " - " << getFullName();
|
||||
os << tokenId << L" - " << getFullName();
|
||||
}
|
||||
|
||||
const Id tokenId;
|
||||
|
||||
@@ -44,27 +44,27 @@ public:
|
||||
return "MessageChangeFileView";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << filePath.str();
|
||||
os << filePath.wstr();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case FILE_MINIMIZED: os << ", minimize"; break;
|
||||
case FILE_SNIPPETS: os << ", snippets"; break;
|
||||
case FILE_MAXIMIZED: os << ", maximize"; break;
|
||||
case FILE_MINIMIZED: os << L", minimize"; break;
|
||||
case FILE_SNIPPETS: os << L", snippets"; break;
|
||||
case FILE_MAXIMIZED: os << L", maximize"; break;
|
||||
}
|
||||
|
||||
switch (viewMode)
|
||||
{
|
||||
case VIEW_LIST: os << ", list"; break;
|
||||
case VIEW_SINGLE: os << ", single"; break;
|
||||
case VIEW_CURRENT: os << ", current"; break;
|
||||
case VIEW_LIST: os << L", list"; break;
|
||||
case VIEW_SINGLE: os << L", single"; break;
|
||||
case VIEW_CURRENT: os << L", current"; break;
|
||||
}
|
||||
|
||||
if (needsData)
|
||||
{
|
||||
os << ", needs data";
|
||||
os << L", needs data";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,15 +23,15 @@ public:
|
||||
return "MessageCodeReference";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
if (type == REFERENCE_PREVIOUS)
|
||||
{
|
||||
os << "previous";
|
||||
os << L"previous";
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "next";
|
||||
os << L"next";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ public:
|
||||
return "MessageFocusIn";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
for (const Id& id : tokenIds)
|
||||
{
|
||||
os << id << " ";
|
||||
os << id << L" ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@ public:
|
||||
return "MessageFocusOut";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
for (const Id& id : tokenIds)
|
||||
{
|
||||
os << id << " ";
|
||||
os << id << L" ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
return "MessageGraphNodeBundleSplit";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << bundleId;
|
||||
}
|
||||
|
||||
@@ -20,16 +20,16 @@ public:
|
||||
return "MessageGraphNodeExpand";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << tokenId << " ";
|
||||
os << tokenId << L" ";
|
||||
if (expand)
|
||||
{
|
||||
os << "expand";
|
||||
os << L"expand";
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "collapse";
|
||||
os << L"collapse";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
return "MessageGraphNodeHide";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << tokenId;
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ public:
|
||||
return "MessageGraphNodeMove";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << tokenId << " " << delta.toString();
|
||||
os << tokenId << L" " << delta.toWString();
|
||||
}
|
||||
|
||||
const Id tokenId;
|
||||
|
||||
@@ -15,9 +15,9 @@ public:
|
||||
return "MessageIDECreateCDB";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << "Create CDB from current solution";
|
||||
os << L"Create CDB from current solution";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ public:
|
||||
return "MessageLoadProject";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << projectSettingsFilePath.str();
|
||||
os << ", settingsChanged: " << std::boolalpha << settingsChanged;
|
||||
os << ", refreshMode: " << refreshMode;
|
||||
os << projectSettingsFilePath.wstr();
|
||||
os << L", settingsChanged: " << std::boolalpha << settingsChanged;
|
||||
os << L", refreshMode: " << refreshMode;
|
||||
}
|
||||
|
||||
const FilePath projectSettingsFilePath;
|
||||
|
||||
@@ -19,9 +19,9 @@ public:
|
||||
return "MessageMoveIDECursor";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << filePath.str() << ":" << row << ":" << column;
|
||||
os << filePath.wstr() << L":" << row << L":" << column;
|
||||
}
|
||||
|
||||
const FilePath filePath;
|
||||
|
||||
@@ -22,9 +22,9 @@ public:
|
||||
return "MessageNewErrors";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << errors.size() << " errors";
|
||||
os << errors.size() << L" errors";
|
||||
}
|
||||
|
||||
std::vector<ErrorInfo> errors;
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
if (uiOnly)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
return "MessageSearch";
|
||||
}
|
||||
|
||||
std::string getMatchesAsString() const
|
||||
std::wstring getMatchesAsString() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
return utility::decodeFromUtf8(ss.str());
|
||||
}
|
||||
|
||||
const std::vector<SearchMatch>& getMatches() const
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
return tokenIds;
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << getMatchesAsString();
|
||||
}
|
||||
|
||||
@@ -20,19 +20,19 @@ public:
|
||||
return "MessageSearchAutocomplete";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << query << "[";
|
||||
os << utility::decodeFromUtf8(query) << L"[";
|
||||
std::vector<Id> nodeTypeIds = acceptedNodeTypes.getNodeTypeIds();
|
||||
for (size_t i = 0; i < nodeTypeIds.size(); i++)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
os << ", ";
|
||||
os << L", ";
|
||||
}
|
||||
os << std::to_string(nodeTypeIds[i]);
|
||||
os << std::to_wstring(nodeTypeIds[i]);
|
||||
}
|
||||
os << "]";
|
||||
os << L"]";
|
||||
}
|
||||
|
||||
const std::string query;
|
||||
|
||||
@@ -17,9 +17,9 @@ public:
|
||||
return "MessageSearchFullText";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << searchTerm;
|
||||
os << utility::decodeFromUtf8(searchTerm);
|
||||
}
|
||||
|
||||
const std::string searchTerm;
|
||||
|
||||
@@ -21,9 +21,9 @@ public:
|
||||
return "MessageShowReference";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << "index: " << refIndex << " token: " << tokenId << " location: " << locationId;
|
||||
os << L"index: " << refIndex << L" token: " << tokenId << L" location: " << locationId;
|
||||
}
|
||||
|
||||
const size_t refIndex;
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
return "MessageShowScope";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << scopeLocationId;
|
||||
}
|
||||
|
||||
@@ -48,26 +48,26 @@ std::wstring MessageStatus::status() const
|
||||
return L"";
|
||||
}
|
||||
|
||||
void MessageStatus::print(std::ostream& os) const
|
||||
void MessageStatus::print(std::wostream& os) const
|
||||
{
|
||||
for (const std::wstring& status : m_stati)
|
||||
{
|
||||
os << utility::encodeToUtf8(status);
|
||||
os << status;
|
||||
|
||||
if (m_stati.size() > 1)
|
||||
{
|
||||
os << " - ";
|
||||
os << L" - ";
|
||||
}
|
||||
}
|
||||
|
||||
if (isError)
|
||||
{
|
||||
os << " - error";
|
||||
os << L" - error";
|
||||
}
|
||||
|
||||
if (showLoader)
|
||||
{
|
||||
os << " - loading";
|
||||
os << L" - loading";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
|
||||
const std::vector<std::wstring>& stati() const;
|
||||
std::wstring status() const;
|
||||
virtual void print(std::ostream& os) const;
|
||||
virtual void print(std::wostream& os) const;
|
||||
|
||||
const bool isError;
|
||||
const bool showLoader;
|
||||
|
||||
@@ -17,9 +17,9 @@ public:
|
||||
return "MessageSwitchColorScheme";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << colorSchemePath.str();
|
||||
os << colorSchemePath.wstr();
|
||||
}
|
||||
|
||||
const FilePath colorSchemePath;
|
||||
|
||||
@@ -17,15 +17,15 @@ public:
|
||||
return "MessageZoom";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
if (zoomIn)
|
||||
{
|
||||
os << "in";
|
||||
os << L"in";
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "out";
|
||||
os << L"out";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ class CxxDeclName: public CxxName
|
||||
public:
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames
|
||||
// const std::wstring& name,
|
||||
// const std::vector<std::wstring>& templateParameterNames
|
||||
//);
|
||||
|
||||
CxxDeclName(
|
||||
@@ -24,8 +24,8 @@ public:
|
||||
|
||||
// uncomment this constructor if required, but try to use the one using move constructors for the members
|
||||
//CxxDeclName(
|
||||
// const std::string& name,
|
||||
// const std::vector<std::string>& templateParameterNames,
|
||||
// const std::wstring& name,
|
||||
// const std::vector<std::wstring>& templateParameterNames,
|
||||
// std::shared_ptr<CxxName> parent
|
||||
//);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user