summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-10-13 20:04:06 +0200
committerGravatar Jonathan Beck2009-10-13 20:04:06 +0200
commita922b714c9b75fdc67735d674758d4eaedfd32f9 (patch)
tree509ec53c18c0be36a9e650eb0f760854cd8d4957 /include
parente492ef675c404cc6c0d1cfa26e47a1c16c850d5f (diff)
downloadlibplist-a922b714c9b75fdc67735d674758d4eaedfd32f9.tar.gz
libplist-a922b714c9b75fdc67735d674758d4eaedfd32f9.tar.bz2
Add C++ binding.
Diffstat (limited to 'include')
-rw-r--r--include/plist/Array.h52
-rw-r--r--include/plist/Boolean.h43
-rw-r--r--include/plist/Data.h44
-rw-r--r--include/plist/Date.h43
-rw-r--r--include/plist/Dictionary.h58
-rw-r--r--include/plist/Integer.h43
-rw-r--r--include/plist/Node.h49
-rw-r--r--include/plist/Real.h43
-rw-r--r--include/plist/String.h44
-rw-r--r--include/plist/Structure.h53
-rw-r--r--include/plist/Utils.h42
-rw-r--r--include/plist/plist++.h38
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 @@
1/*
2 * Array.h
3 * Array node type for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef STRING_H
23#define STRING_H
24
25#include <plist/Structure.h>
26#include <vector>
27
28namespace PList
29{
30
31class Array : public Structure
32{
33 public :
34 Array();
35 Array(plist_t node);
36 Array(Array& a);
37 Array& operator=(const Array& a);
38 virtual ~Array();
39
40 Node* operator[](unsigned int index);
41 void Append(Node* node);
42 void Insert(Node* node, unsigned int pos);
43 void Remove(Node* node);
44 void Remove(unsigned int pos);
45
46 private :
47 std::vector<Node*> _array;
48};
49
50};
51
52#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 @@
1/*
2 * Boolean.h
3 * Boolean node type for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef BOOLEAN_H
23#define BOOLEAN_H
24
25#include <plist/Node.h>
26
27namespace PList
28{
29
30class Boolean : public Node
31{
32 public :
33 Boolean();
34 Boolean(bool b);
35 virtual ~Boolean();
36
37 void SetValue(bool b);
38 bool GetValue();
39};
40
41};
42
43#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 @@
1/*
2 * Data.h
3 * Data node type for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef DATA_H
23#define DATA_H
24
25#include <plist/Node.h>
26#include <vector>
27
28namespace PList
29{
30
31class Data : public Node
32{
33 public :
34 Data();
35 Data(std::vector<char>& buff);
36 virtual ~Data();
37
38 void SetValue(std::vector<char>& buff);
39 std::vector<char> GetValue();
40};
41
42};
43
44#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 @@
1/*
2 * Date.h
3 * Date node type for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef DATE_H
23#define DATE_H
24
25#include <plist/Node.h>
26
27namespace PList
28{
29
30class Date : public Node
31{
32 public :
33 Date();
34 Date(uint64_t i);
35 virtual ~Date();
36
37 void SetValue(uint64_t i);
38 uint64_t GetValue();
39};
40
41};
42
43#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 @@
1/*
2 * Dictionary.h
3 * Dictionary node type for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef DICTIONARY_H
23#define DICTIONARY_H
24
25#include <plist/Structure.h>
26#include <map>
27#include <string>
28
29namespace PList
30{
31
32class Dictionary : public Structure
33{
34 public :
35 Dictionary();
36 Dictionary(plist_t node);
37 Dictionary(Dictionary& d);
38 Dictionary& operator=(const Dictionary& d);
39 virtual ~Dictionary();
40
41 typedef std::map<std::string,Node*>::iterator iterator;
42
43 Node* operator[](std::string& key);
44 iterator Begin();
45 iterator End();
46 void Insert(std::string& key, Node* node);
47 void Remove(Node* node);
48 void Remove(std::string& key);
49
50 private :
51 std::map<std::string,Node*> _map;
52
53
54};
55
56};
57
58#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 @@
1/*
2 * Integer.h
3 * Integer node type for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef INTEGER_H
23#define INTEGER_H
24
25#include <plist/Node.h>
26
27namespace PList
28{
29
30class Integer : public Node
31{
32 public :
33 Integer();
34 Integer(uint64_t i);
35 virtual ~Integer();
36
37 void SetValue(uint64_t i);
38 uint64_t GetValue();
39};
40
41};
42
43#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 @@
1/*
2 * Node.h
3 * Abstract node type for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef NODE_H
23#define NODE_H
24
25#include <plist/plist.h>
26
27namespace PList
28{
29
30class Node
31{
32 public :
33 virtual ~Node();
34 Node(plist_t node);
35 Node(Node& node);
36 Node& operator=(const Node& node);
37
38 plist_type GetType();
39 plist_t GetPlist() const;
40
41 protected:
42 Node();
43 Node(plist_type type);
44 plist_t _node;
45};
46
47};
48
49#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 @@
1/*
2 * Real.h
3 * Real node type for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef REAL_H
23#define REAL_H
24
25#include <plist/Node.h>
26
27namespace PList
28{
29
30class Real : public Node
31{
32 public :
33 Real();
34 Real(double d);
35 virtual ~Real();
36
37 void SetValue(double d);
38 double GetValue();
39};
40
41};
42
43#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 @@
1/*
2 * String.h
3 * String node type for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef STRING_H
23#define STRING_H
24
25#include <plist/Node.h>
26#include <string>
27
28namespace PList
29{
30
31class String : public Node
32{
33 public :
34 String();
35 String(std::string& s);
36 virtual ~String();
37
38 void SetValue(std::string& s);
39 std::string GetValue();
40};
41
42};
43
44#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 @@
1/*
2 * Structure.h
3 * Structure node type for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef STRUCTURE_H
23#define STRUCTURE_H
24
25#include <plist/Node.h>
26#include <string>
27#include <vector>
28
29namespace PList
30{
31
32class Structure : public Node
33{
34 public :
35 virtual ~Structure();
36
37 uint32_t GetSize();
38
39 std::string ToXml();
40 std::vector<char> ToBin();
41
42 protected:
43 Structure();
44 Structure(plist_type type);
45
46 private:
47 Structure(Structure& s);
48 Structure& operator=(const Structure& s);
49};
50
51};
52
53#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 @@
1/*
2 * Utils.h
3 * Import functions for C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef UTILS_H
23#define UTILS_H
24
25#include <plist/Structure.h>
26#include <string>
27
28namespace PList
29{
30 class Utils
31 {
32 public:
33 static Structure* FromXml(std::string& in);
34 static Structure* FromBin(std::vector<char>& in);
35
36 private:
37 Utils();
38 ~Utils();
39 };
40};
41
42#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 @@
1/*
2 * plist++.h
3 * Main include of libplist C++ binding
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef LIBPLIST++_H
23#define LIBPLIST++_H
24
25#include "plist.h"
26#include "Array.h"
27#include "Boolean.h"
28#include "Data.h"
29#include "Date.h"
30#include "Dictionary.h"
31#include "Integer.h"
32#include "Node.h"
33#include "Real.h"
34#include "String.h"
35#include "Structure.h"
36#include "Utils.h"
37
38#endif