logic: use wstring in symbol and bookmark names
* use wstring in symbol and bookmark names * fixed setting apppath in windows includes * regard utf8 encoding in shared indexer commands * regard utf8 encoding in shared indexer status
This commit is contained in:
@@ -30,10 +30,11 @@ void ConsoleLogger::logMessage(const std::string& type, const LogMessage& messag
|
||||
{
|
||||
std::cout << message.getTimeString("%H:%M:%S") << " | ";
|
||||
|
||||
if (message.filePath.size())
|
||||
if (!message.filePath.empty())
|
||||
{
|
||||
std::cout << message.getFileName() << ':' << message.line << ' ' << message.functionName << "() | ";
|
||||
}
|
||||
|
||||
std::cout << type << ": " << message.message << std::endl;
|
||||
std::cout << type << ": ";
|
||||
std::wcout << message.message << std::endl;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <cstdio>
|
||||
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
FileLogger::FileLogger()
|
||||
: Logger("FileLogger")
|
||||
@@ -124,7 +125,7 @@ void FileLogger::logMessage(const std::string& type, const LogMessage& message)
|
||||
fileStream << message.getFileName() << ':' << message.line << ' ' << message.functionName << "() | ";
|
||||
}
|
||||
|
||||
fileStream << type << ": " << message.message << std::endl;
|
||||
fileStream << type << ": " << utility::encodeToUtf8(message.message) << std::endl;
|
||||
fileStream.close();
|
||||
|
||||
m_currentLogLineCount++;
|
||||
|
||||
@@ -93,7 +93,7 @@ void LogManager::logInfo(
|
||||
{
|
||||
if (m_loggingEnabled)
|
||||
{
|
||||
m_logManagerImplementation.logInfo(message, file, function, line);
|
||||
m_logManagerImplementation.logInfo(utility::decodeFromUtf8(message), file, function, line);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ void LogManager::logInfo(
|
||||
{
|
||||
if (m_loggingEnabled)
|
||||
{
|
||||
m_logManagerImplementation.logInfo(utility::encodeToUtf8(message), file, function, line);
|
||||
m_logManagerImplementation.logInfo(message, file, function, line);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,19 @@ void LogManager::logWarning(
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
)
|
||||
{
|
||||
if (m_loggingEnabled)
|
||||
{
|
||||
m_logManagerImplementation.logWarning(utility::decodeFromUtf8(message), file, function, line);
|
||||
}
|
||||
}
|
||||
|
||||
void LogManager::logWarning(
|
||||
const std::wstring& message,
|
||||
const std::string& file,
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
)
|
||||
{
|
||||
if (m_loggingEnabled)
|
||||
{
|
||||
@@ -123,8 +136,8 @@ void LogManager::logWarning(
|
||||
}
|
||||
}
|
||||
|
||||
void LogManager::logWarning(
|
||||
const std::wstring& message,
|
||||
void LogManager::logError(
|
||||
const std::string& message,
|
||||
const std::string& file,
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
@@ -132,12 +145,12 @@ void LogManager::logWarning(
|
||||
{
|
||||
if (m_loggingEnabled)
|
||||
{
|
||||
m_logManagerImplementation.logWarning(utility::encodeToUtf8(message), file, function, line);
|
||||
m_logManagerImplementation.logError(utility::decodeFromUtf8(message), file, function, line);
|
||||
}
|
||||
}
|
||||
|
||||
void LogManager::logError(
|
||||
const std::string& message,
|
||||
const std::wstring& message,
|
||||
const std::string& file,
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
@@ -149,19 +162,6 @@ void LogManager::logError(
|
||||
}
|
||||
}
|
||||
|
||||
void LogManager::logError(
|
||||
const std::wstring& message,
|
||||
const std::string& file,
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
)
|
||||
{
|
||||
if (m_loggingEnabled)
|
||||
{
|
||||
m_logManagerImplementation.logError(utility::encodeToUtf8(message), file, function, line);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<LogManager> LogManager::s_instance;
|
||||
|
||||
LogManager::LogManager()
|
||||
|
||||
@@ -86,7 +86,7 @@ int LogManagerImplementation::getLoggerCount() const
|
||||
}
|
||||
|
||||
void LogManagerImplementation::logInfo(
|
||||
const std::string& message,
|
||||
const std::wstring& message,
|
||||
const std::string& file,
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
@@ -100,7 +100,7 @@ void LogManagerImplementation::logInfo(
|
||||
}
|
||||
|
||||
void LogManagerImplementation::logWarning(
|
||||
const std::string& message,
|
||||
const std::wstring& message,
|
||||
const std::string& file,
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
@@ -114,7 +114,7 @@ void LogManagerImplementation::logWarning(
|
||||
}
|
||||
|
||||
void LogManagerImplementation::logError(
|
||||
const std::string& message,
|
||||
const std::wstring& message,
|
||||
const std::string& file,
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
|
||||
@@ -30,19 +30,19 @@ public:
|
||||
Logger* getLoggerByType(const std::string& type);
|
||||
|
||||
void logInfo(
|
||||
const std::string& message,
|
||||
const std::wstring& message,
|
||||
const std::string& file,
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
);
|
||||
void logWarning(
|
||||
const std::string& message,
|
||||
const std::wstring& message,
|
||||
const std::string& file,
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
);
|
||||
void logError(
|
||||
const std::string& message,
|
||||
const std::wstring& message,
|
||||
const std::string& file,
|
||||
const std::string& function,
|
||||
const unsigned int line
|
||||
|
||||
@@ -9,7 +9,7 @@ struct LogMessage
|
||||
{
|
||||
public:
|
||||
LogMessage(
|
||||
const std::string& message,
|
||||
const std::wstring& message,
|
||||
const std::string& filePath,
|
||||
const std::string& functionName,
|
||||
const unsigned int line,
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
return filePath.substr(filePath.find_last_of("/\\") + 1);
|
||||
}
|
||||
|
||||
const std::string message;
|
||||
const std::wstring message;
|
||||
const std::string filePath;
|
||||
const std::string functionName;
|
||||
const unsigned int line;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#ifndef MESSAGE_ACTIVATE_EDGE_H
|
||||
#define MESSAGE_ACTIVATE_EDGE_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
#include "data/graph/Edge.h"
|
||||
#include "data/name/NameHierarchy.h"
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/types.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
class MessageActivateEdge
|
||||
: public Message<MessageActivateEdge>
|
||||
{
|
||||
@@ -35,10 +36,10 @@ public:
|
||||
|
||||
std::string getFullName() const
|
||||
{
|
||||
std::string name = Edge::getReadableTypeString(type) + ":";
|
||||
name += sourceNameHierarchy.getQualifiedNameWithSignature() + "->";
|
||||
std::wstring name = Edge::getReadableTypeString(type) + L":";
|
||||
name += sourceNameHierarchy.getQualifiedNameWithSignature() + L"->";
|
||||
name += targetNameHierarchy.getQualifiedNameWithSignature();
|
||||
return name;
|
||||
return utility::encodeToUtf8(name);
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#ifndef MESSAGE_ACTIVATE_TRAIL_EDGE_H
|
||||
#define MESSAGE_ACTIVATE_TRAIL_EDGE_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
#include "data/graph/Edge.h"
|
||||
#include "data/name/NameHierarchy.h"
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/types.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
class MessageActivateTrailEdge
|
||||
: public Message<MessageActivateTrailEdge>
|
||||
{
|
||||
@@ -28,10 +29,10 @@ public:
|
||||
|
||||
std::string getFullName() const
|
||||
{
|
||||
std::string name = Edge::getReadableTypeString(type) + ":";
|
||||
name += sourceNameHierarchy.getQualifiedNameWithSignature() + "->";
|
||||
std::wstring name = Edge::getReadableTypeString(type) + L":";
|
||||
name += sourceNameHierarchy.getQualifiedNameWithSignature() + L"->";
|
||||
name += targetNameHierarchy.getQualifiedNameWithSignature();
|
||||
return name;
|
||||
return utility::encodeToUtf8(name);
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/math/Vector2.h"
|
||||
#include "utility/TimeStamp.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
namespace utility
|
||||
{
|
||||
@@ -250,7 +251,7 @@ inline std::vector<std::string> utility::toStrings<FilePath>(const std::vector<F
|
||||
std::vector<std::string> v;
|
||||
for (const FilePath& t : d)
|
||||
{
|
||||
v.push_back(t.str());
|
||||
v.push_back(utility::encodeToUtf8(t.wstr()));
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,16 @@ namespace utility
|
||||
return split<std::vector<std::string>>(str, delimiter);
|
||||
}
|
||||
|
||||
std::vector<std::wstring> splitToVector(const std::wstring& str, wchar_t delimiter)
|
||||
{
|
||||
return split<std::vector<std::wstring>>(str, std::wstring(1, delimiter));
|
||||
}
|
||||
|
||||
std::vector<std::wstring> splitToVector(const std::wstring& str, const std::wstring& delimiter)
|
||||
{
|
||||
return split<std::vector<std::wstring>>(str, delimiter);
|
||||
}
|
||||
|
||||
std::string join(const std::deque<std::string>& list, char delimiter)
|
||||
{
|
||||
return join<std::deque<std::string> >(list, std::string(1, delimiter));
|
||||
@@ -164,6 +174,16 @@ namespace utility
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring substrBeforeLast(const std::wstring& str, wchar_t delimiter)
|
||||
{
|
||||
size_t pos = str.rfind(delimiter);
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
return str.substr(0, pos);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string substrAfter(const std::string& str, char delimiter)
|
||||
{
|
||||
size_t pos = str.find(delimiter);
|
||||
@@ -452,6 +472,24 @@ namespace utility
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring elide(const std::wstring& str, ElideMode mode, size_t size)
|
||||
{
|
||||
if (str.size() <= size || str.size() <= 3)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case ELIDE_LEFT:
|
||||
return L"..." + str.substr(str.size() - size - 3, str.size());
|
||||
case ELIDE_MIDDLE:
|
||||
return str.substr(0, size / 2 - 1) + L"..." + str.substr(str.size() - (size / 2 - 2), str.size());
|
||||
case ELIDE_RIGHT:
|
||||
return str.substr(0, size - 3) + L"...";
|
||||
}
|
||||
}
|
||||
|
||||
std::string substrBetween(const std::string &str, const std::string &delimiter1, const std::string &delimiter2)
|
||||
{
|
||||
size_t found_delimiter1 = str.find(delimiter1);
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace utility
|
||||
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, const std::string& delimiter);
|
||||
std::vector<std::wstring> splitToVector(const std::wstring& str, wchar_t delimiter);
|
||||
std::vector<std::wstring> splitToVector(const std::wstring& str, const std::wstring& delimiter);
|
||||
|
||||
template <typename ContainerType>
|
||||
std::string join(const ContainerType& list, const std::string& delimiter);
|
||||
@@ -38,6 +40,7 @@ namespace utility
|
||||
std::string substrBeforeFirst(const std::string& str, char delimiter);
|
||||
std::string substrBeforeFirst(const std::string& str, const std::string& delimiter);
|
||||
std::string substrBeforeLast(const std::string& str, char delimiter);
|
||||
std::wstring substrBeforeLast(const std::wstring& str, wchar_t delimiter);
|
||||
std::string substrAfter(const std::string& str, char delimiter);
|
||||
std::string substrAfter(const std::string& str, const std::string& delimiter);
|
||||
|
||||
@@ -71,6 +74,7 @@ namespace utility
|
||||
};
|
||||
|
||||
std::string elide(const std::string& str, ElideMode mode, size_t size);
|
||||
std::wstring elide(const std::wstring& str, ElideMode mode, size_t size);
|
||||
|
||||
template <typename ContainerType>
|
||||
ContainerType split(const std::string& str, const std::string& delimiter)
|
||||
|
||||
Reference in New Issue
Block a user