Skip to content

Commit

Permalink
Moves files into VS compatible structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
rioki committed Aug 25, 2020
1 parent f7bae0a commit 356e5f6
Show file tree
Hide file tree
Showing 41 changed files with 1,373 additions and 828 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

Makefile eol=lf
configure eol=lf
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
*.o
*.d
x86
x64
.vs
*.user
apidoc
config.mk
libxmlmm.a
libxmlmm.dll
libxmlmm.so
libxmlmm.pc
test-libxmlmm.exe
test-libxmlmm
libxmlmm-test.exe
29 changes: 14 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@ $(error config.mk not built. Run configure script.)
endif

CXX ?= g++
CXXFLAGS += -Iinclude -DVERSION=\"$(VERSION)\" $(XML2_CFLAGS)
CXXFLAGS += -I. -DVERSION=\"$(VERSION)\" $(XML2_CFLAGS)
LDFLAGS +=

headers = $(wildcard include/*.h)
lib_hdr = $(wildcard src/*.h)
lib_src = $(wildcard src/*.cpp)
lib_hdr = $(wildcard libxmlmm/*.h)
lib_src = $(wildcard libxmlmm/*.cpp)
lib_libs = $(XML2_LIBS)
test_hdr = $(wildcard test/*.h)
test_src = $(wildcard test/*.cpp)
test_libs = $(lib_libs) -lUnitTest++
test_hdr = $(wildcard libxmlmm-test/*.h)
test_src = $(wildcard libxmlmm-test/*.cpp)
test_libs = $(lib_libs)
extra_dist = Makefile README.md $(wildcard docs/*.md)
dist_files = $(headers) $(lib_hdr) $(lib_src) $(test_hdr) $(test_src) $(extra_dist)
dist_files = $(lib_hdr) $(lib_src) $(test_hdr) $(test_src) $(extra_dist)

ifeq ($(MSYSTEM), MINGW32)
ifeq ($(OS),Windows_NT)
EXEEXT = .exe
LIBEXT = .dll
else
EXEEXT =
EXEEXT = .exe
LIBEXT = .so
endif

Expand All @@ -33,14 +32,14 @@ all: libxmlmm$(LIBEXT)
libxmlmm$(LIBEXT): $(patsubst %.cpp, %.o, $(lib_src))
$(CXX) -shared -fPIC $(CXXFLAGS) $(LDFLAGS) $^ $(lib_libs) -Wl,--out-implib=$(patsubst %$(LIBEXT),%.a, $@) -o $@

check: test-libxmlmm$(EXEEXT)
./test-libxmlmm$(EXEEXT)
check: libxmlmm-test$(EXEEXT)
./libxmlmm-test$(EXEEXT)

test-libxmlmm$(EXEEXT): libxmlmm$(LIBEXT) $(patsubst %.cpp, %.o, $(test_src))
libxmlmm-test$(EXEEXT): libxmlmm$(LIBEXT) $(patsubst %.cpp, %.o, $(test_src))
$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(test_libs) -o $@

clean:
rm -f src/*.o src/*.d test/*.o test/*.d libxmlmm$(LIBEXT) test-libxmlmm$(EXEEXT)
rm -f libxmlmm/*.o libxmlmm/*.d libxmlmm-test/*.o libxmlmm-test/*.d libxmlmm$(LIBEXT) libxmlmm-test$(EXEEXT)

dist:
mkdir libxmlmm-$(VERSION)
Expand All @@ -50,7 +49,7 @@ dist:

install: libxmlmm$(LIBEXT)
mkdir -p $(prefix)/include/libxmlmm
cp $(headers) $(prefix)/include/libxmlmm
cp $(lib_hdr) $(prefix)/include/libxmlmm
mkdir -p $(prefix)/lib
cp libxmlmm.a $(prefix)/lib
mkdir -p $(prefix)/lib/pkgconfig
Expand Down
6 changes: 3 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# defaults
prefix=/usr/local
VERSION="0.5.0"
VERSION="0.6.0"
ERRORS=0

# Parse Arguments
Expand Down Expand Up @@ -162,8 +162,8 @@ if test $ERRORS = 0; then
echo ""
echo "Writing config.mk"
echo "CONFIG_MK_INCLUDED = 1" >> config.mk
echo "preifx ?= $prefix" >> config.mk
export_variable VERISON
echo "prefix ?= $prefix" >> config.mk
export_variable VERSION
export_variable XML2_CFLAGS
export_variable XML2_LIBS

Expand Down
76 changes: 38 additions & 38 deletions test/CDataTest.cpp → libxmlmm-test/CDataTest.cpp
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
//
// Copyright (c) 2008-2012 Sean Farrell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
// Software, and to permit persons to whom the Software is furnished to do so,
// Copyright (c) 2008-2020 Sean Farrell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
// Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//

#include <string>
#include <stdexcept>
#include "rtest.h"

#include "Document.h"
#include "Element.h"
#include "CData.h"
#include <libxmlmm/Document.h>
#include <libxmlmm/Element.h>
#include <libxmlmm/CData.h>

// NOTE: Nodes can not live w/o their Document.

Expand All @@ -35,51 +35,51 @@ SUITE(CDataTest)
TEST(cdata_get_content)
{
xml::Document doc;
std::string xml =

std::string xml =
"<?xml version=\"1.0\"?>\n"
"<test><![CDATA[This is a test.]]></test>\n";

doc.read_from_string(xml);

xml::Element* element = doc.get_root_element();
CHECK(element != NULL);

std::vector<xml::Node*> children = element->get_children();
CHECK_EQUAL(1, children.size());
CHECK_EQUAL(1, children.size());
xml::CData* c_data = dynamic_cast<xml::CData*>(children.at(0));
CHECK(c_data != NULL);
CHECK_EQUAL("This is a test.", c_data->get_content());
CHECK_EQUAL("This is a test.", c_data->get_content());
}

//------------------------------------------------------------------------------
TEST(cdata_element_get_text)
{
xml::Document doc;
std::string xml =

std::string xml =
"<?xml version=\"1.0\"?>\n"
"<test><![CDATA[This is a test.]]></test>\n";

doc.read_from_string(xml);

xml::Element* element = doc.get_root_element();
CHECK(element != NULL);
CHECK_EQUAL("This is a test.", element->get_text());

CHECK_EQUAL("This is a test.", element->get_text());
}

//------------------------------------------------------------------------------
TEST(cdata_behaves_like_text_in_xpath)
{
xml::Document doc;
std::string xml =

std::string xml =
"<?xml version=\"1.0\"?>\n"
"<test><![CDATA[This is a test.]]></test>\n";

doc.read_from_string(xml);
std::string text = doc.query_string("/test/text()");
CHECK_EQUAL("This is a test.", text);
}
}
}
Loading

0 comments on commit 356e5f6

Please sign in to comment.