Skip to content

Commit f909085

Browse files
committed
Fixed #6
1 parent d2cc91d commit f909085

38 files changed

+249
-248
lines changed

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Or include files:
1717
* `src/wsjcpp_core.h`
1818
* `src/wsjcpp_core.cpp`
1919

20-
## Logger (WSJCppLog)
20+
## Logger (WsjcppLog)
2121

2222
* Output will be collored for console, but color will be missing for files.
2323
* Functions are safe thread.
2424
* Logger supports a log rotation (every 51000 seconds / every day)
25-
* WSJCppLog::throw_err - will be generate `throw std::runtime_error(sMessage);`
26-
* std::vector<std::string> WSJCppLog::getLastLogMessages() - last 50 records from log
25+
* WsjcppLog::throw_err - will be generate `throw std::runtime_error(sMessage);`
26+
* std::vector<std::string> WsjcppLog::getLastLogMessages() - last 50 records from log
2727

2828
In main() you need to init logger first.
2929

@@ -32,11 +32,11 @@ In main() you need to init logger first.
3232
3333
int main(int argc, char* argv[]) {
3434
std::string TAG = "MAIN";
35-
if (!WSJCppCore::dirExists(".logs")) {
36-
WSJCppCore::makeDir(".logs");
35+
if (!WsjcppCore::dirExists(".logs")) {
36+
WsjcppCore::makeDir(".logs");
3737
}
38-
WSJCppLog::setLogDirectory(".logs");
39-
WSJCppLog::setPrefixLogFile("app");
38+
WsjcppLog::setLogDirectory(".logs");
39+
WsjcppLog::setPrefixLogFile("app");
4040
4141
// ...
4242
return 0;
@@ -50,10 +50,10 @@ And then you can call static functions anywhere in your code:
5050
5151
...
5252
const std::string TAG = "MAIN";
53-
WSJCppLog::info(TAG, "Hello info");
54-
WSJCppLog::err(TAG, "Hello err");
55-
WSJCppLog::warn(TAG, "Hello warn");
56-
WSJCppLog::ok(TAG, "Hello ok");
53+
WsjcppLog::info(TAG, "Hello info");
54+
WsjcppLog::err(TAG, "Hello err");
55+
WsjcppLog::warn(TAG, "Hello warn");
56+
WsjcppLog::ok(TAG, "Hello ok");
5757
```
5858

5959
Example output
@@ -64,22 +64,22 @@ Example output
6464
2020-02-25 16:56:07.376, 0x0x10ac51dc0 [OK] MAIN: Hello ok
6565
```
6666

67-
## List of static function (WSJCppCore):
67+
## List of static function (WsjcppCore):
6868

6969
### doNormalizePath
7070

7171
Normalize paths. For example: ".//../bin/some/../" -> "./../bin/"
7272

7373
```
74-
std::string sPath = WSJCppCore::doNormalizePath(".//../bin/some/../");
74+
std::string sPath = WsjcppCore::doNormalizePath(".//../bin/some/../");
7575
```
7676

7777
### extractFilename
7878

7979
Extract base filename from fullpath.
8080

8181
```
82-
std::string sFilename = WSJCppCore::doNormalizePath(".//../bin/some/../file.txt");
82+
std::string sFilename = WsjcppCore::doNormalizePath(".//../bin/some/../file.txt");
8383
```
8484

8585
### getCurrentDirectory
@@ -165,7 +165,7 @@ static std::vector<std::string> listOfFiles(const std::string &sDirname);
165165
Create a new directory
166166
```
167167
std::string sDirname = ".logs";
168-
if (WSJCppCore::makeDir(sDirname)) {
168+
if (WsjcppCore::makeDir(sDirname)) {
169169
std::cout << " Created '" << sDirname << "'" << std::endl;
170170
}
171171
```
@@ -182,7 +182,7 @@ static bool writeFile(const std::string &sFilename, const char *pBuffer, const i
182182
Read text files into std::string
183183
```
184184
std::string sContent;
185-
if (WSJCppCore::readTextFile("./file.txt", sContent)) {
185+
if (WsjcppCore::readTextFile("./file.txt", sContent)) {
186186
std::cout << sContent;
187187
}
188188
```
@@ -194,15 +194,15 @@ Read file binary content to buffer
194194
```
195195
char *pBuffer = nullptr;
196196
int nBufferSize = 0;
197-
if (WSJCppCore::readFileToBuffer("./data/readFileToBuffer.txt", &pBuffer, nBufferSize)) {
197+
if (WsjcppCore::readFileToBuffer("./data/readFileToBuffer.txt", &pBuffer, nBufferSize)) {
198198
// your can work with buffer here
199199
}
200200
```
201201

202202
### removeFile
203203

204204
```
205-
if (WSJCppCore::removeFile("./file.txt")) {
205+
if (WsjcppCore::removeFile("./file.txt")) {
206206
std::cout << "File removed" << std::endl;
207207
}
208208
```
@@ -212,7 +212,7 @@ if (WSJCppCore::removeFile("./file.txt")) {
212212
Creating empty file. Will return true if file not exists and do created
213213

214214
```
215-
if (WSJCppCore::createEmptyFile("./file.txt")) {
215+
if (WsjcppCore::createEmptyFile("./file.txt")) {
216216
std::cout << "Empty file created" << std::endl;
217217
}
218218
```
@@ -244,14 +244,14 @@ Convert text to upper charaters like "abC" -> "ABC". Worked only with latin alph
244244
### replaceAll
245245

246246
```
247-
WSJCppCore::replaceAll(std::string& str, const std::string& from, const std::string& to);
247+
WsjcppCore::replaceAll(std::string& str, const std::string& from, const std::string& to);
248248
```
249249

250250
### replaceAll
251251

252252
```
253253
std::string sWhat = "|1a|2b|3c|4d|";
254-
std::vector<std::string> vSplitted = WSJCppCore::split(sWhat, "|");
254+
std::vector<std::string> vSplitted = WsjcppCore::split(sWhat, "|");
255255
for (int i = 0; i < vSplitted.size(); i++) {
256256
std::cout << vSplitted[i] << std::endl;
257257
}
@@ -269,11 +269,11 @@ Example output:
269269

270270
### createUuid
271271

272-
Generate uuid, but you need to call `WSJCppCore::initRandom();` before it (for example in main() function)
272+
Generate uuid, but you need to call `WsjcppCore::initRandom();` before it (for example in main() function)
273273

274274
```
275-
WSJCppCore::initRandom(); // once in main on start
276-
std::string sUuid = WSJCppCore::createUuid();
275+
WsjcppCore::initRandom(); // once in main on start
276+
std::string sUuid = WsjcppCore::createUuid();
277277
std::cout << sUuid << std::endl;
278278
```
279279

@@ -287,9 +287,9 @@ b49d92ae-f11c-f8bc-3a94-e7519e341927
287287
`unsigned int` to hex string (lowercase)
288288

289289
```
290-
std::cout << WSJCppCore::uint2hexString(1) << std::endl;
291-
std::cout << WSJCppCore::uint2hexString(3000) << std::endl;
292-
std::cout << WSJCppCore::uint2hexString(4123123123) << std::endl;
290+
std::cout << WsjcppCore::uint2hexString(1) << std::endl;
291+
std::cout << WsjcppCore::uint2hexString(3000) << std::endl;
292+
std::cout << WsjcppCore::uint2hexString(4123123123) << std::endl;
293293
```
294294

295295
Example output
@@ -302,7 +302,7 @@ f5c1ddb3
302302

303303
```
304304
std::string s = "dddd";
305-
unsigned long nPointer = WSJCppCore::convertVoidToULong((void *)&s);
305+
unsigned long nPointer = WsjcppCore::convertVoidToULong((void *)&s);
306306
std::cout << sPointerHex << std::endl;
307307
static unsigned long convertVoidToULong(void *p);
308308
```
@@ -316,7 +316,7 @@ Example output:
316316

317317
```
318318
std::string s = "dddd";
319-
std::string sPointerHex = WSJCppCore::getPointerAsHex((void *)&s);
319+
std::string sPointerHex = WsjcppCore::getPointerAsHex((void *)&s);
320320
std::cout << sPointerHex << std::endl;
321321
```
322322

@@ -328,15 +328,15 @@ Example output:
328328
### extractURLProtocol
329329

330330
```
331-
std::string sProtocol = WSJCppCore::extractURLProtocol("https://github.com/wsjcpp");
331+
std::string sProtocol = WsjcppCore::extractURLProtocol("https://github.com/wsjcpp");
332332
```
333333

334334
### getEnv
335335

336336
Get the value of a system environment variable
337337
```
338338
std::string sValue;
339-
if (WSJCppCore::getEnv("PATH", sValue)) {
339+
if (WsjcppCore::getEnv("PATH", sValue)) {
340340
std::cout << sValue << std::endl;
341341
}
342342
```

src/main.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ int main(int argc, char* argv[]) {
88
std::string appName = std::string(WSJCPP_NAME);
99
std::string appVersion = std::string(WSJCPP_VERSION);
1010

11-
if (!WSJCppCore::dirExists(".logs")) {
12-
WSJCppCore::makeDir(".logs");
11+
if (!WsjcppCore::dirExists(".logs")) {
12+
WsjcppCore::makeDir(".logs");
1313
}
14-
WSJCppLog::setLogDirectory(".logs");
15-
WSJCppLog::setPrefixLogFile("wsjcpp_core");
14+
WsjcppLog::setLogDirectory(".logs");
15+
WsjcppLog::setPrefixLogFile("wsjcpp_core");
1616

17-
WSJCppLog::info(TAG, "Hello info");
18-
WSJCppLog::err(TAG, "Hello err");
19-
WSJCppLog::warn(TAG, "Hello warn");
20-
WSJCppLog::ok(TAG, "Hello ok");
17+
WsjcppLog::info(TAG, "Hello info");
18+
WsjcppLog::err(TAG, "Hello err");
19+
WsjcppLog::warn(TAG, "Hello warn");
20+
WsjcppLog::ok(TAG, "Hello ok");
2121

22-
WSJCppCore::init(
22+
WsjcppCore::init(
2323
argc, argv,
2424
std::string(WSJCPP_NAME),
2525
std::string(WSJCPP_VERSION),

0 commit comments

Comments
 (0)