Skip to content

Commit 7c4c845

Browse files
committed
Make compatible code with compiler bcc32 C++ Builder
1 parent c6313f1 commit 7c4c845

File tree

7 files changed

+1280
-98
lines changed

7 files changed

+1280
-98
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ tmp/*
66
.wsjcpp-logs/*
77
.wsjcpp/*
88
unit-tests.wsjcpp/data-tests/read-write-file/docker-compose.output.yml
9+
*.local
10+
__history
11+
__recovery
12+
913

1014
*.log
1115

@@ -41,3 +45,10 @@ unit-tests.wsjcpp/data-tests/read-write-file/docker-compose.output.yml
4145
*.exe
4246
*.out
4347
*.app
48+
*.ilc
49+
*.ild
50+
*.ilf
51+
*.ils
52+
*.tds
53+
*.pdb
54+
*.map

src/examples/example_iterate_array.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ void example_iterate_array() {
5454
WsjcppYaml yaml2;
5555
std::string sError;
5656
if (!yaml2.loadFromString("test", sTest, sError)) {
57-
std::cerr << sError << std::endl;
57+
std::cerr << sError.c_str() << std::endl;
5858
return;
5959
}
6060
WsjcppYamlCursor cur = yaml2.getCursor();
6161
std::vector<std::string> vKeys = cur.keys();
62-
for (int i = 0; i < vKeys.size(); i++) {
62+
for (unsigned int i = 0; i < vKeys.size(); i++) {
6363
std::string sKey = vKeys[i];
6464
int nCount = cur[sKey].size(); // musts array
6565
for (int n = 0; n < nCount; n++) {
6666
WsjcppYamlCursor el = cur[sKey][n];
6767
std::cout
6868
<< "code = " << el["code"].valInt()
69-
<< "; focusstr = " << el["focusstr"].valStr()
69+
<< "; focusstr = " << el["focusstr"].valStr().c_str()
7070
<< ";"
7171
<< std::endl;
7272
}

src/examples/example_operators.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ void example_operator_1() {
3737
WsjcppYaml yaml;
3838
std::string sError;
3939
if (!yaml.loadFromString("test", sTest, sError)) {
40-
std::cerr << sError << std::endl;
40+
std::cerr << sError.c_str() << std::endl;
4141
return;
4242
}
4343
WsjcppYamlCursor cur = yaml.getCursor();
44-
std::cout << "before : " << cur["test"].valStr() << std::endl;
44+
std::cout << "before : " << cur["test"].valStr().c_str() << std::endl;
4545
cur["test"] = "some new string";
46-
std::cout << "after 1 : " << cur["test"].valStr() << std::endl;
46+
std::cout << "after 1 : " << cur["test"].valStr().c_str() << std::endl;
4747
cur["test"] = 111;
48-
std::cout << "after 2 : " << cur["test"].valStr() << std::endl;
48+
std::cout << "after 2 : " << cur["test"].valStr().c_str() << std::endl;
4949
cur["test"] = true;
50-
std::cout << "after 3 : " << cur["test"].valStr() << std::endl;
50+
std::cout << "after 3 : " << cur["test"].valStr().c_str() << std::endl;
5151
}

src/main.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ Official Source Code: https://github.com/wsjcpp/wsjcpp-yaml
2626

2727
#include <string.h>
2828
#include <iostream>
29+
#include <sstream>
2930
#include <algorithm>
31+
#if defined(__CODEGEARC__)
32+
#include <tchar.h>
33+
#endif
3034
#include "examples.h"
3135
#include "wsjcpp_yaml.h"
3236

@@ -35,22 +39,42 @@ Official Source Code: https://github.com/wsjcpp/wsjcpp-yaml
3539
class MyLogger : public IWsjcppYamlLog {
3640
public:
3741
// IWsjcppYamlLog
42+
#if defined(__CODEGEARC__) && !defined(__clang__)
43+
virtual void err(const std::string &TAG, const std::string &sMessage) {
44+
#else
3845
virtual void err(const std::string &TAG, const std::string &sMessage) override {
39-
std::cerr << TAG << " [error] : " << sMessage << std::endl;
46+
#endif
47+
std::cerr << TAG.c_str() << " [error] : " << sMessage.c_str() << std::endl;
4048
};
49+
#if defined(__CODEGEARC__) && !defined(__clang__)
50+
virtual void throw_err(const std::string &TAG, const std::string &sMessage) {
51+
#else
4152
virtual void throw_err(const std::string &TAG, const std::string &sMessage) override {
53+
#endif
4254
std::cerr << TAG << " [critical_error] : " << sMessage << std::endl;
4355
throw std::runtime_error(TAG + " [critical_error] : " + sMessage);
4456
};
57+
#if defined(__CODEGEARC__) && !defined(__clang__)
58+
virtual void warn(const std::string &TAG, const std::string &sMessage) {
59+
#else
4560
virtual void warn(const std::string &TAG, const std::string &sMessage) override {
61+
#endif
4662
std::cerr << TAG << " [warn] : " << sMessage << std::endl;
4763
};
64+
#if defined(__CODEGEARC__) && !defined(__clang__)
65+
virtual void info(const std::string &TAG, const std::string &sMessage) {
66+
#else
4867
virtual void info(const std::string &TAG, const std::string &sMessage) override {
68+
#endif
4969
std::cout << TAG << " [info] : " << sMessage << std::endl;
5070
};
5171
};
5272

73+
#if defined(__CODEGEARC__)
74+
int _tmain(int argc, _TCHAR* argv[]) {
75+
#else
5376
int main(int argc, char* argv[]) {
77+
#endif
5478
std::string TAG = "MAIN";
5579
// WsjcppCore::initRandom();
5680
// std::string appName = std::string(WSJCPP_APP_NAME);

0 commit comments

Comments
 (0)