Git Product home page Git Product logo

plistcpp's Introduction

-----------------
DESCRIPTION
-----------------

This is a C++ Property List (plist) serialization library (MIT license).
It supports both XML and binary versions of the plist format and is designed to
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 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. 

plist           C++
__________________________________________________________________________________

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, std::any>
array           std::vector<std::any>
date            PlistDate (included class in PlistDate.hpp)
data            std::vector<char>
boolean         bool

-----------------
USAGE
-----------------

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, std::any> dict; 
		Plist::readPlist("binaryExample1.plist", dict);

The plist format (binary or XML) is automatically detected so call the same
readPlist method for XML

		Plist::readPlist("XMLExample1.plist", dict);

To write a plist, e.g. dictionary

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

and for a binary plist

		Plist::writePlistBinary("binaryExampleWritten.plist", dict);

The other public methods allow for reading and writing from streams and byte
arrays.  Again, see the test suite code src/plistTests.cpp for comprehensive
examples. 

-----------------
LIMITATIONS
-----------------

Unicode strings are currently not supported. 

-----------------
INSTALL
-----------------

Simply copy src/Plist.hpp, src/PlistDate.hpp, and src/base64.hpp to your project.

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

See BUILDING.md.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.