Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
.vscode
testing/*Written.plist
22 changes: 22 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Building

## System Dependencies
In order to build this project, you need to have the following libraries installed:

* [UnitTest++](https://github.com/unittest-cpp/unittest-cpp)
* [Boost](https://www.boost.org)

On macOS this can conveniently be done through [Homebrew](https://brew.sh):

* `brew install boost unittest-cpp`

Or using [vcpkg](https://github.com/Microsoft/vcpkg):

* `vcpkg install boost unittest-cpp`

## Building with Tests
* `mkdir build && cd build`
* `cmake ..`
* If you use `vcpkg`, add the flag `-DCMAKE_TOOLCHAIN_FILE=[path/to/vcpkg]/scripts/buildsystems/vcpkg.cmake`
* `cd ..`
* `cmake --build build`
53 changes: 23 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
cmake_minimum_required (VERSION 2.6)
project (Plist)
cmake_minimum_required(VERSION 2.6)
project(Plist)
set(CMAKE_CXX_STANDARD 17)

include_directories (include)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${EXTRA_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_CXX_FLAGS} -Wall -DTEST_VERBOSE")

set (SCRIPT_EXT sh)
set (MY_BUILD_TYPE ${CMAKE_BUILD_TYPE})
IF(APPLE)
set (ARCH_DIR OSX)
set(SCRIPT_EXT sh)
set(MY_BUILD_TYPE ${CMAKE_BUILD_TYPE})
set(ARCH_DIR ".")
if(APPLE)
# on Mavericks, need to link to libstdc++ directly because libc++ is default
# and won't work
if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0)
set(EXTRA_CXX_FLAGS "-stdlib=libstdc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lstdc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lstdc++")
endif()
ELSEIF(MSVC)
set (ARCH_DIR Windows)
set (SCRIPT_EXT bat)
set (MY_BUILD_TYPE "\$(Configuration)")
ELSE()
set (ARCH_DIR Linux)
ENDIF()

link_directories (${CMAKE_SOURCE_DIR}/${ARCH_DIR}/lib)
include_directories (include ${CMAKE_SOURCE_DIR}/${ARCH_DIR}/include)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${EXTRA_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_CXX_FLAGS} -Wall -DTEST_VERBOSE")
elseif(MSVC)
set(MY_BUILD_TYPE "\$(Configuration)")
set(ARCH_DIR "${MY_BUILD_TYPE}")
set(SCRIPT_EXT bat)
endif()

add_executable(runTests src/runTests.cpp src/plistTests.cpp src/pugixml.cpp
src/Plist.cpp src/PlistDate.cpp)
find_package(Boost REQUIRED COMPONENTS locale)
find_package(UnitTest++ REQUIRED)

IF(MSVC10)
target_link_libraries(runTests UnitTest++.vsnet2010-${MY_BUILD_TYPE}.lib)
ELSE()
target_link_libraries(runTests UnitTest++)
ENDIF()
add_executable(runTests src/runTests.cpp src/plistTests.cpp src/pugixml.cpp src/Plist.cpp src/PlistDate.cpp)
target_include_directories(runTests PUBLIC ${UTPP_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
target_link_libraries(runTests UnitTest++)
add_dependencies(runTests UnitTest++)

ADD_CUSTOM_COMMAND(
add_custom_command(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
TARGET runTests
POST_BUILD
COMMAND ./runTests.${SCRIPT_EXT} ${MY_BUILD_TYPE} ${ARCH_DIR}
)
)
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2011 Animetrics Inc. (marc@animetrics.com)

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 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Binary file removed Linux/lib/libUnitTest++.a
Binary file not shown.
Binary file removed OSX/lib/libUnitTest++.a
Binary file not shown.
48 changes: 10 additions & 38 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ be cross platform with minimal dependencies. The interface is simply a set of
static methods which serialize a subset of stdlib containers to plists (as well
as the inverse operation of deserializing plists into stdlib containers).

It uses boost::any as a generic type in order to support heterogenous
It uses std::any as a generic type in order to support heterogenous
containers, e.g. a dictionary is a map<string, any> and an array is a
vector<any>. The supported stdlib containers and their associations to plist
types is shown below.
Expand All @@ -19,8 +19,8 @@ ________________________________________________________________________________
string std::string
integer short, int, long, int32_t, int64_t (always deserializes as int64_t)
real double, float (always deserializes as double)
dictionary std::map<std::string, boost::any>
array std::vector<boost::any>
dictionary std::map<std::string, std::any>
array std::vector<std::any>
date PlistDate (included class in PlistDate.hpp)
data std::vector<char>
boolean bool
Expand All @@ -33,7 +33,7 @@ See src/plistTests.cpp for examples of reading and writing all types to both
XML and binary. E.g. to read a plist from disk whose root node is a
dictionary:

map<string, boost::any> dict;
map<string, std::any> dict;
Plist::readPlist("binaryExample1.plist", dict);

The plist format (binary or XML) is automatically detected so call the same
Expand All @@ -43,7 +43,7 @@ readPlist method for XML

To write a plist, e.g. dictionary

map<string, boost::any> dict;
map<string, std::any> dict;
populateDictionary(dict);
Plist::writePlistXML("xmlExampleWritten.plist", dict);

Expand All @@ -66,38 +66,10 @@ INSTALL
-----------------

Simply copy src/Plist.hpp, src/PlistDate.hpp, src/pugixml.hpp,
src/pugiconfig.hpp, src/base64.hpp and src/pugixml.cpp to your project. If you
do not have boost::any installed on your system, also grab the include/boost
folder which contains the minimum boost headers needed for boost::any.

To compile and run the test suites (test suites will also run automatically as
part of the post build process). Note, the UnitTest++ library is required and
included.

OSX, Linux (for Linux, change OSX to Linux below):

mkdir -p OSX/Release
cd OSX/Release
cmake -DCMAKE_BUILD_TYPE=Release ../..
make
cd ../../
sh runTests.sh Release OSX

and for Debug

mkdir -p OSX/Debug
cd OSX/Debug
cmake -DCMAKE_BUILD_TYPE=Debug ../..
make
cd ../../
sh runTests.sh Debug OSX

Windows:

cd Windows
cmake ..
start Plist.sln (build solution)
cd ..
runTests.bat Release
src/pugiconfig.hpp, src/base64.hpp and src/pugixml.cpp to your project.

-----------------
BUILD
-----------------

See BUILDING.md.
186 changes: 0 additions & 186 deletions Windows/include/stdint.h

This file was deleted.

Binary file removed Windows/lib/UnitTest++.vsnet2010-Debug.lib
Binary file not shown.
Binary file removed Windows/lib/UnitTest++.vsnet2010-Release.lib
Binary file not shown.
Loading