Skip to content

Commit

Permalink
5.7.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
bha-evs committed Aug 12, 2024
1 parent 2796600 commit fcac821
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ include(cmake/fetch_content.cmake)
# in code coverage computation as they are test programs themselves.
set(EXTRA_COVERAGE_EXCLUSION "\'${CMAKE_CURRENT_SOURCE_DIR}/integration/*\'")

project(bofstd VERSION 5.7.3.2)
project(bofstd VERSION 5.7.3.3)

if (EMSCRIPTEN)
message("Force pthread detection for BofStd compilation under EMSCRIPTEN")
Expand Down
1 change: 1 addition & 0 deletions lib/include/bofstd/boffs.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ BOFSTD_EXPORT int64_t Bof_SetFileIoPosition(uintptr_t _Io, int64_t _Offset_S64,
BOFSTD_EXPORT int64_t Bof_GetFileIoPosition(uintptr_t _Io);

BOFSTD_EXPORT BOFERR Bof_ReadLine(uintptr_t _Io, uint32_t &_rNb_U32, char *_pBuffer_c);
BOFSTD_EXPORT BOFERR Bof_ReadLine(const BOF::BofPath &_rPath, std::vector<std::string> &_rLineCollection);
BOFSTD_EXPORT BOFERR Bof_ReadLine(uintptr_t _Io, std::string &_rLine_S);
BOFSTD_EXPORT BOFERR Bof_WriteLine(uintptr_t _Io, const std::string &_rLine_S);

Expand Down
2 changes: 2 additions & 0 deletions lib/include/bofstd/bofstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ BOFSTD_EXPORT std::string Bof_StringReplace(const std::string &_rStr_S, const st
// @return The new string with the 'replaced' substring
// @remarks None
BOFSTD_EXPORT std::string Bof_StringReplace(const std::string &_rStr_S, const std::string &_rStringToReplace_S, const std::string &_rReplaceString_S);
//_rTokenKey_S = "{reqNum}";
BOFSTD_EXPORT std::string Bof_StringTokenReplace(const std::string &_rStr_S, const std::string &_rTokenKey_S, const std::string &_rTokenValue_S);

// @brief Check if a string contains some specific characters
// @param _rStr_S : Specifies the string to process
Expand Down
28 changes: 28 additions & 0 deletions lib/src/boffs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,34 @@ BOFERR Bof_ReadLine(uintptr_t _Io, uint32_t &_rNb_U32, char *_pBuffer_c)
return (Rts_E);
}


BOFERR Bof_ReadLine(const BOF::BofPath &_rPath, std::vector<std::string> &_rLineCollection)
{
BOFERR Rts_E = BOF_ERR_ENOENT;
FILE *pIo_X;
int Len_i;
char pBuffer_c[0x1000];
std::stringstream Output;

pIo_X = fopen(_rPath.FullPathName(false).c_str(), "rb");
if (pIo_X != nullptr)
{
Rts_E = BOF_ERR_NO_ERROR;
while (!feof(pIo_X))
{
Len_i = fread(pBuffer_c, 1, sizeof(pBuffer_c) - 1, pIo_X); //-1 for extra 0
if (Len_i > 0)
{
pBuffer_c[Len_i] = 0;
Output << pBuffer_c;
}
}
fclose(pIo_X);
_rLineCollection = BOF::Bof_StringSplit(Output.str(), "\n");
}
return (Rts_E);
}

BOFERR Bof_ReadLine(uintptr_t _Io, std::string &_rLine_S)
{
BOFERR Rts_E;
Expand Down
6 changes: 3 additions & 3 deletions lib/src/bofprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ BOFERR BofProcess::S_Execute_popen(const std::string &_rCommand_S, std::string &
int Len_i;
std::string Command_S;
char pBuffer_c[0x1000];
std::stringstream Output_S;
std::stringstream Output;

_rOutput_S = "";
_rExitCode_i = 127;
Expand All @@ -565,10 +565,10 @@ BOFERR BofProcess::S_Execute_popen(const std::string &_rCommand_S, std::string &
if (Len_i > 0)
{
pBuffer_c[Len_i] = 0;
Output_S << pBuffer_c;
Output << pBuffer_c;
}
}
_rOutput_S = Output_S.str();
_rOutput_S = Output.str();
//printf("Output: %zd:%s\n", _rOutput_S.size(), _rOutput_S.c_str());
// Grab the forked status
_rExitCode_i = pclose(pPipe_X);
Expand Down
20 changes: 20 additions & 0 deletions lib/src/bofstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,24 @@ std::string Bof_StringReplace(const std::string &_rStr_S, const std::string &_rS
}
return Rts_S;
}
//_rTokenKey_S = "{reqNum}";
std::string Bof_StringTokenReplace(const std::string &_rStr_S, const std::string &_rTokenKey_S, const std::string &_rTokenValue_S)
{
std::string Rts_S, Tag_S;
size_t Pos, LenTag, LenValue;

Rts_S = _rStr_S;
LenTag = _rTokenKey_S.size();
LenValue = _rTokenValue_S.size();

Pos = 0;
while ((Pos = Rts_S.find(_rTokenKey_S, Pos)) != std::string::npos)
{
Rts_S.replace(Pos, LenTag, _rTokenValue_S);
Pos += LenValue;
}
return Rts_S;
}
bool Bof_StringIsPresent(const std::string &_rStr_S, const std::string &_rCharToLookFor_S)
{
return (_rStr_S.find_first_of(_rCharToLookFor_S) != std::string::npos);
Expand Down Expand Up @@ -701,4 +718,7 @@ std::string Bof_Sprintf(const char *_pFormat_c, ...)
}
return Rts_S;
}



END_BOF_NAMESPACE()
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bofstd",
"version": "5.7.3.2",
"version": "5.7.3.3",
"description": "The onbings general purpose C++ Multiplatform library",
"dependencies": [
{
Expand Down

0 comments on commit fcac821

Please sign in to comment.