diff options
author | Jonathan Beck | 2009-10-13 20:04:06 +0200 |
---|---|---|
committer | Jonathan Beck | 2009-10-13 20:04:06 +0200 |
commit | a922b714c9b75fdc67735d674758d4eaedfd32f9 (patch) | |
tree | 509ec53c18c0be36a9e650eb0f760854cd8d4957 /include | |
parent | e492ef675c404cc6c0d1cfa26e47a1c16c850d5f (diff) | |
download | libplist-a922b714c9b75fdc67735d674758d4eaedfd32f9.tar.gz libplist-a922b714c9b75fdc67735d674758d4eaedfd32f9.tar.bz2 |
Add C++ binding.
Diffstat (limited to 'include')
-rw-r--r-- | include/plist/Array.h | 52 | ||||
-rw-r--r-- | include/plist/Boolean.h | 43 | ||||
-rw-r--r-- | include/plist/Data.h | 44 | ||||
-rw-r--r-- | include/plist/Date.h | 43 | ||||
-rw-r--r-- | include/plist/Dictionary.h | 58 | ||||
-rw-r--r-- | include/plist/Integer.h | 43 | ||||
-rw-r--r-- | include/plist/Node.h | 49 | ||||
-rw-r--r-- | include/plist/Real.h | 43 | ||||
-rw-r--r-- | include/plist/String.h | 44 | ||||
-rw-r--r-- | include/plist/Structure.h | 53 | ||||
-rw-r--r-- | include/plist/Utils.h | 42 | ||||
-rw-r--r-- | include/plist/plist++.h | 38 |
12 files changed, 552 insertions, 0 deletions
diff --git a/include/plist/Array.h b/include/plist/Array.h new file mode 100644 index 0000000..8f8d992 --- /dev/null +++ b/include/plist/Array.h @@ -0,0 +1,52 @@ +/* + * Array.h + * Array node type for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef STRING_H +#define STRING_H + +#include <plist/Structure.h> +#include <vector> + +namespace PList +{ + +class Array : public Structure +{ + public : + Array(); + Array(plist_t node); + Array(Array& a); + Array& operator=(const Array& a); + virtual ~Array(); + + Node* operator[](unsigned int index); + void Append(Node* node); + void Insert(Node* node, unsigned int pos); + void Remove(Node* node); + void Remove(unsigned int pos); + + private : + std::vector<Node*> _array; +}; + +}; + +#endif // STRING_H diff --git a/include/plist/Boolean.h b/include/plist/Boolean.h new file mode 100644 index 0000000..89761ca --- /dev/null +++ b/include/plist/Boolean.h @@ -0,0 +1,43 @@ +/* + * Boolean.h + * Boolean node type for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef BOOLEAN_H +#define BOOLEAN_H + +#include <plist/Node.h> + +namespace PList +{ + +class Boolean : public Node +{ + public : + Boolean(); + Boolean(bool b); + virtual ~Boolean(); + + void SetValue(bool b); + bool GetValue(); +}; + +}; + +#endif // BOOLEAN_H diff --git a/include/plist/Data.h b/include/plist/Data.h new file mode 100644 index 0000000..f7e5cd2 --- /dev/null +++ b/include/plist/Data.h @@ -0,0 +1,44 @@ +/* + * Data.h + * Data node type for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DATA_H +#define DATA_H + +#include <plist/Node.h> +#include <vector> + +namespace PList +{ + +class Data : public Node +{ + public : + Data(); + Data(std::vector<char>& buff); + virtual ~Data(); + + void SetValue(std::vector<char>& buff); + std::vector<char> GetValue(); +}; + +}; + +#endif // DATA_H diff --git a/include/plist/Date.h b/include/plist/Date.h new file mode 100644 index 0000000..df185db --- /dev/null +++ b/include/plist/Date.h @@ -0,0 +1,43 @@ +/* + * Date.h + * Date node type for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DATE_H +#define DATE_H + +#include <plist/Node.h> + +namespace PList +{ + +class Date : public Node +{ + public : + Date(); + Date(uint64_t i); + virtual ~Date(); + + void SetValue(uint64_t i); + uint64_t GetValue(); +}; + +}; + +#endif // DATE_H diff --git a/include/plist/Dictionary.h b/include/plist/Dictionary.h new file mode 100644 index 0000000..8468ab5 --- /dev/null +++ b/include/plist/Dictionary.h @@ -0,0 +1,58 @@ +/* + * Dictionary.h + * Dictionary node type for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DICTIONARY_H +#define DICTIONARY_H + +#include <plist/Structure.h> +#include <map> +#include <string> + +namespace PList +{ + +class Dictionary : public Structure +{ + public : + Dictionary(); + Dictionary(plist_t node); + Dictionary(Dictionary& d); + Dictionary& operator=(const Dictionary& d); + virtual ~Dictionary(); + + typedef std::map<std::string,Node*>::iterator iterator; + + Node* operator[](std::string& key); + iterator Begin(); + iterator End(); + void Insert(std::string& key, Node* node); + void Remove(Node* node); + void Remove(std::string& key); + + private : + std::map<std::string,Node*> _map; + + +}; + +}; + +#endif // DICTIONARY_H diff --git a/include/plist/Integer.h b/include/plist/Integer.h new file mode 100644 index 0000000..8f1ecdb --- /dev/null +++ b/include/plist/Integer.h @@ -0,0 +1,43 @@ +/* + * Integer.h + * Integer node type for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef INTEGER_H +#define INTEGER_H + +#include <plist/Node.h> + +namespace PList +{ + +class Integer : public Node +{ + public : + Integer(); + Integer(uint64_t i); + virtual ~Integer(); + + void SetValue(uint64_t i); + uint64_t GetValue(); +}; + +}; + +#endif // INTEGER_H diff --git a/include/plist/Node.h b/include/plist/Node.h new file mode 100644 index 0000000..0f6100e --- /dev/null +++ b/include/plist/Node.h @@ -0,0 +1,49 @@ +/* + * Node.h + * Abstract node type for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef NODE_H +#define NODE_H + +#include <plist/plist.h> + +namespace PList +{ + +class Node +{ + public : + virtual ~Node(); + Node(plist_t node); + Node(Node& node); + Node& operator=(const Node& node); + + plist_type GetType(); + plist_t GetPlist() const; + + protected: + Node(); + Node(plist_type type); + plist_t _node; +}; + +}; + +#endif // NODE_H diff --git a/include/plist/Real.h b/include/plist/Real.h new file mode 100644 index 0000000..272f431 --- /dev/null +++ b/include/plist/Real.h @@ -0,0 +1,43 @@ +/* + * Real.h + * Real node type for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef REAL_H +#define REAL_H + +#include <plist/Node.h> + +namespace PList +{ + +class Real : public Node +{ + public : + Real(); + Real(double d); + virtual ~Real(); + + void SetValue(double d); + double GetValue(); +}; + +}; + +#endif // REAL_H diff --git a/include/plist/String.h b/include/plist/String.h new file mode 100644 index 0000000..14becac --- /dev/null +++ b/include/plist/String.h @@ -0,0 +1,44 @@ +/* + * String.h + * String node type for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef STRING_H +#define STRING_H + +#include <plist/Node.h> +#include <string> + +namespace PList +{ + +class String : public Node +{ + public : + String(); + String(std::string& s); + virtual ~String(); + + void SetValue(std::string& s); + std::string GetValue(); +}; + +}; + +#endif // STRING_H diff --git a/include/plist/Structure.h b/include/plist/Structure.h new file mode 100644 index 0000000..a0bdcbc --- /dev/null +++ b/include/plist/Structure.h @@ -0,0 +1,53 @@ +/* + * Structure.h + * Structure node type for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef STRUCTURE_H +#define STRUCTURE_H + +#include <plist/Node.h> +#include <string> +#include <vector> + +namespace PList +{ + +class Structure : public Node +{ + public : + virtual ~Structure(); + + uint32_t GetSize(); + + std::string ToXml(); + std::vector<char> ToBin(); + + protected: + Structure(); + Structure(plist_type type); + + private: + Structure(Structure& s); + Structure& operator=(const Structure& s); +}; + +}; + +#endif // STRUCTURE_H diff --git a/include/plist/Utils.h b/include/plist/Utils.h new file mode 100644 index 0000000..b499635 --- /dev/null +++ b/include/plist/Utils.h @@ -0,0 +1,42 @@ +/* + * Utils.h + * Import functions for C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef UTILS_H +#define UTILS_H + +#include <plist/Structure.h> +#include <string> + +namespace PList +{ + class Utils + { + public: + static Structure* FromXml(std::string& in); + static Structure* FromBin(std::vector<char>& in); + + private: + Utils(); + ~Utils(); + }; +}; + +#endif // UTILS_H diff --git a/include/plist/plist++.h b/include/plist/plist++.h new file mode 100644 index 0000000..209d874 --- /dev/null +++ b/include/plist/plist++.h @@ -0,0 +1,38 @@ +/* + * plist++.h + * Main include of libplist C++ binding + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LIBPLIST++_H +#define LIBPLIST++_H + +#include "plist.h" +#include "Array.h" +#include "Boolean.h" +#include "Data.h" +#include "Date.h" +#include "Dictionary.h" +#include "Integer.h" +#include "Node.h" +#include "Real.h" +#include "String.h" +#include "Structure.h" +#include "Utils.h" + +#endif |