added json to global results

This commit is contained in:
ALEXks
2025-09-18 21:09:43 +03:00
parent 06aabdbee6
commit 8de18d1788
4 changed files with 275 additions and 385 deletions

View File

@@ -390,31 +390,14 @@ void clearGlobalBuffer() { globalOutputBuffer = ""; }
const string& getGlobalBuffer() { return globalOutputBuffer; }
set<short*> allocated;
set<int*> allocatedInt;
static void convertGlobalBuffer(short *&result, int *&resultSize)
{
const unsigned len = (unsigned)globalOutputBuffer.size();
result = new short[len + 1];
allocated.insert(result);
result[len] = '\0';
for (unsigned i = 0; i < len; ++i)
result[i] = globalOutputBuffer[i];
resultSize = new int[1];
resultSize[0] = (int)len;
}
extern map<string, vector<Messages>> SPF_messages; //file ->messages
void clearGlobalMessagesBuffer()
{
//clear allocated memory
for (auto& elem : allocated)
delete[]elem;
for (auto& elem : allocatedInt)
delete[]elem;
delete []elem;
allocated.clear();
allocatedInt.clear();
SPF_messages.clear();
}
@@ -451,7 +434,7 @@ static map<string, vector<Messages>> removeCopies(map<string, vector<Messages>>
return out;
}
static void convertGlobalMessagesBuffer(short *&result, int *&resultSize)
static string convertGlobalMessagesBuffer()
{
auto copySPF_messages = removeCopies(SPF_messages);
for (auto &byFile : copySPF_messages)
@@ -489,21 +472,13 @@ static void convertGlobalMessagesBuffer(short *&result, int *&resultSize)
json all;
all["allMessages"] = allMessages;
const string str = all.dump();
const unsigned len = (unsigned)str.size();
copyStringToShort(result, str);
allocated.insert(result);
resultSize = new int[1];
resultSize[0] = (int)len;
return all.dump();
}
void convertBuffers(short*& resultM, int*& resultSizeM, short*& result, int*& resultSize)
void convertBuffers(string &resultM, string &result)
{
convertGlobalMessagesBuffer(resultM, resultSizeM);
convertGlobalBuffer(result, resultSize);
resultM = convertGlobalMessagesBuffer();
result = getGlobalBuffer();
}
bool isSPF_comment(const string &bufStr)

View File

@@ -33,7 +33,7 @@ void addToGlobalBufferAndPrint(const std::string &toPrint);
void clearGlobalBuffer();
const std::string& getGlobalBuffer();
std::wstring to_wstring(const std::string);
void convertBuffers(short*& resultM, int*& resultSizeM, short*& result, int*& resultSize);
void convertBuffers(std::string& resultM, std::string& result);
void clearGlobalMessagesBuffer();
std::string renameInclude(const std::string& inc);
void copyIncludes(const std::set<std::string> &allIncludeFiles, const std::map<std::string, std::map<int, std::set<std::string>>> &commentsToInclude, const std::map<std::string, std::map<int, std::set<std::string>>>& newCopyDeclToIncl, const char *folderName, bool keepSpfDirs, bool isFreeStyle, bool isRename, int removeDirs = 0);

View File

@@ -1,3 +1,3 @@
#pragma once
#define VERSION_SPF "2444"
#define VERSION_SPF "2445"

File diff suppressed because it is too large Load Diff