Skip to content

Commit d706979

Browse files
authored
Merge pull request #1 from wsjcpp/some_fixes
Some fixes
2 parents 934c1ad + 56e64c8 commit d706979

22 files changed

+648
-323
lines changed

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,60 @@
11
# wsjcpp-yaml
2+
3+
[![Build Status](https://api.travis-ci.org/wsjcpp/wsjcpp-yaml.svg?branch=master)](https://travis-ci.org/wsjcpp/wsjcpp-yaml) [![Github Stars](https://img.shields.io/github/stars/wsjcpp/wsjcpp-yaml.svg?label=github%20%E2%98%85)](https://github.com/wsjcpp/wsjcpp-yaml) [![Github Stars](https://img.shields.io/github/contributors/wsjcpp/wsjcpp-yaml.svg)](https://github.com/wsjcpp/wsjcpp-yaml) [![Github Forks](https://img.shields.io/github/forks/wsjcpp/wsjcpp-yaml.svg?label=github%20forks)](https://github.com/wsjcpp/wsjcpp-yaml/network/members)
4+
25
C++ Write/Reader yaml files
6+
7+
8+
## Integrate to your c++ project
9+
10+
include files:
11+
12+
- src.wsjcpp/wsjcpp-core/wsjcpp_core.h
13+
- src.wsjcpp/wsjcpp-core/wsjcpp_core.cpp
14+
- src/wsjcpp_yaml.cpp
15+
- src/wsjcpp_yaml.h
16+
17+
In you main file configure logger:
18+
19+
```cpp
20+
21+
#include <string.h>
22+
#include <iostream>
23+
#include "wsjcpp_yaml.h"
24+
#include "wsjcpp_core.h"
25+
26+
27+
int main(int argc, char* argv[]) {
28+
std::string TAG = "MAIN";
29+
std::string appLogPath = ".logs";
30+
WSJCppLog::setLogDirectory(appLogPath);
31+
if (!WSJCppCore::dirExists(appLogPath)) {
32+
WSJCppCore::makeDir(appLogPath);
33+
}
34+
WSJCppLog::info(TAG, "Hello!");
35+
36+
// now you can use WSJCppYAML
37+
WSJCppYAML yaml;
38+
if (yaml.loadFromString(
39+
"# yaml content\n"
40+
"yaml: nice format\n"
41+
"some-map: value1\n"
42+
"some-map2: value2\n"
43+
"some-array:\n"
44+
" - test1 \n"
45+
" - test2 \n"
46+
)) {
47+
WSJCppLog::throw_err(TAG, "Error parsing");
48+
return -1;
49+
}
50+
51+
std::cout << "yaml is " << yaml.getRoot()->getElement("yaml")->getValue() << std::endl;
52+
std::cout << "some-map is " << yaml.getRoot()->getElement("some-map")->getValue() << std::endl;
53+
std::cout << "some-map2 is " << yaml.getRoot()->getElement("some-map2")->getValue() << std::endl;
54+
std::cout << "some-array has " << std::to_string(yaml.getRoot()->getElement("some-array")->getLength()) << std::endl;
55+
std::cout << "some-array element 1 is " << yaml.getRoot()->getElement("some-array")->->getElement(0)->getValue() << std::endl;
56+
std::cout << "some-array element 2 is " << yaml.getRoot()->getElement("some-array")->->getElement(1)->getValue() << std::endl;
57+
return 0;
58+
}
59+
60+
```

src.wsjcpp/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ set (WSJCPP_LIBRARIES "")
1010
set (WSJCPP_INCLUDE_DIRS "")
1111
set (WSJCPP_SOURCES "")
1212

13-
list (APPEND WSJCPP_INCLUDE_DIRS "src.wsjcpp/wsjcpp-logger/")
14-
list (APPEND WSJCPP_SOURCES "src.wsjcpp/wsjcpp-logger/fallen.cpp")
15-
list (APPEND WSJCPP_SOURCES "src.wsjcpp/wsjcpp-logger/fallen.h")
13+
list (APPEND WSJCPP_INCLUDE_DIRS "src.wsjcpp/wsjcpp-core/")
14+
list (APPEND WSJCPP_SOURCES "src.wsjcpp/wsjcpp-core/wsjcpp_core.h")
15+
list (APPEND WSJCPP_SOURCES "src.wsjcpp/wsjcpp-core/wsjcpp_core.cpp")
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
wsjcpp: 1.0.0
3+
cmake_cxx_standard: 11
4+
cmake_minimum_required: 3.0
5+
6+
name: wsjcpp/wsjcpp-core
7+
version: 0.0.1
8+
description: Basic Utils for wsjcpp
9+
issues: https://github.com/wsjcpp/wsjcpp-core/issues
10+
repositories:
11+
- "https://github.com/wsjcpp/wsjcpp-core"
12+
keywords:
13+
- c++
14+
- wsjcpp
15+
16+
authors:
17+
- name: Evgenii Sopov
18+
email: mrseakg@gmail.com
19+
20+
requirements:
21+
libs:
22+
- pthread
23+
24+
distribution:
25+
sources:
26+
- from: src/wsjcpp_core.cpp
27+
to: wsjcpp_core.cpp
28+
sha1: ""
29+
- from: src/wsjcpp_core.h
30+
to: wsjcpp_core.h
31+
sha1: ""
32+
33+
unit-tests:
34+
folder: unit-tests # default
35+
files:
36+
- unit-tests/src/main.cpp
37+
- unit-tests/src/unit_tests.h
38+
- unit-tests/src/unit_tests.cpp

0 commit comments

Comments
 (0)