Skip to content

Commit c36f485

Browse files
author
PC
committed
Ad cpp wrapper and do cleanup
1 parent d0bdd4e commit c36f485

12 files changed

+1761
-1773
lines changed

CMakeLists.txt

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
cmake_minimum_required (VERSION 3.8.0)
2+
project(libxml_test)
3+
4+
set(ProjDirPath ${CMAKE_CURRENT_SOURCE_DIR})
5+
6+
file(GLOB LIBXML_TEST_SOURCES
7+
"${ProjDirPath}/xml_parser.c"
8+
"${ProjDirPath}/xml_parser_alloc.c"
9+
"${ProjDirPath}/test.h"
10+
"${ProjDirPath}/test.c"
11+
)
12+
13+
include_directories(${ProjDirPath}/.)
14+
add_executable(libxml_test ${LIBXML_TEST_SOURCES})
15+
16+
target_compile_features(libxml_test PUBLIC cxx_std_17)
17+
18+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
19+
target_compile_options(libxml_test PUBLIC -Weverything)
20+
endif()
21+
22+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
23+
target_compile_options(libxml_test PUBLIC -Wall)
24+
target_compile_options(libxml_test PUBLIC -Wextra)
25+
target_compile_options(libxml_test PUBLIC -Werror)
26+
target_compile_options(libxml_test PUBLIC -Wno-unused-macros)
27+
target_compile_options(libxml_test PUBLIC -Wno-format-nonliteral)
28+
target_compile_options(libxml_test PUBLIC -Wno-c++98-compat)
29+
endif()
30+
31+
add_custom_target(run
32+
COMMAND libxml_test
33+
DEPENDS libxml_test
34+
WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
35+
)

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Example of parsing string:
99
```c
1010
// List of element and attribute names in test string.
1111

12-
static const PARSER_XML_NAME xml_names[]=
12+
static const PARSER_CHAR xml_names[]=
1313
{
1414
{ "element_type_1" },
1515
{ "element_type_2" },
@@ -27,7 +27,7 @@ static const PARSER_XML_NAME xml_names[]=
2727

2828
// String to parse.
2929

30-
static const char parse_test_string[]=
30+
static const PARSER_CHAR parse_test_string[]=
3131
{
3232
"<element_type_1 testElementId=\"0\" intAttribute=\"20\" floatAttribute=\"1.230000\" stringAttribute=\"TEST\">\n"
3333
" <element_type_2 testElementId=\"1\">\n"
@@ -64,7 +64,7 @@ static PARSER_ERROR test_parse(void)
6464

6565
// Parse string.
6666

67-
error= parser_parse_string(xml, parse_test_string, strlen(parse_test_string), xml_names, sizeof(xml_names)/sizeof(PARSER_XML_NAME));
67+
error= parser_append(xml, parse_test_string, strlen(parse_test_string), xml_names, sizeof(xml_names)/sizeof(PARSER_CHAR));
6868
if ( error )
6969
return(error);
7070

inc/test.h

-52
This file was deleted.

makefile

-33
This file was deleted.

src/test_1.xml

-23
This file was deleted.

0 commit comments

Comments
 (0)