aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/archive.cpp2
-rw-r--r--src/tests/archive.cpp4
-rw-r--r--src/tests/archive2.cpp95
-rw-r--r--src/unit/file.cpp6
-rw-r--r--src/unit/fstring.cpp4
-rw-r--r--src/unit/taf.cpp6
6 files changed, 106 insertions, 11 deletions
diff --git a/src/archive.cpp b/src/archive.cpp
index 5ac2877..78fa362 100644
--- a/src/archive.cpp
+++ b/src/archive.cpp
@@ -5,7 +5,7 @@
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
6 */ 6 */
7 7
8#include "archive.h" 8#include "bu/archive.h"
9 9
10Bu::Archive::Archive( Stream &rStream, bool bLoading ) : 10Bu::Archive::Archive( Stream &rStream, bool bLoading ) :
11 bLoading( bLoading ), 11 bLoading( bLoading ),
diff --git a/src/tests/archive.cpp b/src/tests/archive.cpp
index b2778f1..10bb834 100644
--- a/src/tests/archive.cpp
+++ b/src/tests/archive.cpp
@@ -5,8 +5,8 @@
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
6 */ 6 */
7 7
8#include "archive.h" 8#include "bu/archive.h"
9#include "file.h" 9#include "bu/file.h"
10 10
11using namespace Bu; 11using namespace Bu;
12 12
diff --git a/src/tests/archive2.cpp b/src/tests/archive2.cpp
new file mode 100644
index 0000000..6d3c2c1
--- /dev/null
+++ b/src/tests/archive2.cpp
@@ -0,0 +1,95 @@
1#include "bu/archive.h"
2#include "bu/archival.h"
3#include "bu/file.h"
4
5int giId = 0;
6
7class A : public Bu::Archival
8{
9public:
10 A() :
11 iId( giId++ )
12 {
13 }
14
15 virtual ~A()
16 {
17 }
18
19 virtual void archive( Bu::Archive &ar )
20 {
21 ar && iId;
22 }
23
24 int iId;
25};
26
27class B : public Bu::Archival
28{
29public:
30 B() :
31 iId( giId++ ),
32 a1( new A ),
33 a2( new A )
34 {
35 }
36
37 virtual ~B()
38 {
39 delete a1;
40 delete a2;
41 }
42
43 virtual void archive( Bu::Archive &ar )
44 {
45 //ar && iId && a1 && a2;
46 ar << iId << a1 << a2;
47 }
48
49 int iId;
50 A *a1, *a2;
51};
52
53class C : public Bu::Archival
54{
55public:
56 C() :
57 iId( giId++ ),
58 a( new A ),
59 b( new B )
60 {
61 }
62
63 virtual ~C()
64 {
65 delete a;
66 delete b;
67 }
68
69 virtual void archive( Bu::Archive &ar )
70 {
71 //ar && iId && a && b;
72 ar << iId;
73 ar << a << b;
74 }
75
76 int iId;
77 A *a;
78 B *b;
79};
80
81void write()
82{
83 C *c = new C;
84
85 Bu::File f( "test.archive", "wb");
86 Bu::Archive ar( f, Bu::Archive::save );
87 ar << c;
88}
89
90int main()
91{
92 write();
93
94}
95
diff --git a/src/unit/file.cpp b/src/unit/file.cpp
index 5042350..abc816a 100644
--- a/src/unit/file.cpp
+++ b/src/unit/file.cpp
@@ -5,9 +5,9 @@
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
6 */ 6 */
7 7
8#include "unitsuite.h" 8#include "bu/unitsuite.h"
9#include "file.h" 9#include "bu/file.h"
10#include "exceptions.h" 10#include "bu/exceptions.h"
11 11
12#include <sys/types.h> 12#include <sys/types.h>
13#include <sys/stat.h> 13#include <sys/stat.h>
diff --git a/src/unit/fstring.cpp b/src/unit/fstring.cpp
index b00f11b..cd90835 100644
--- a/src/unit/fstring.cpp
+++ b/src/unit/fstring.cpp
@@ -5,8 +5,8 @@
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
6 */ 6 */
7 7
8#include "fstring.h" 8#include "bu/fstring.h"
9#include "unitsuite.h" 9#include "bu/unitsuite.h"
10 10
11class Unit : public Bu::UnitSuite 11class Unit : public Bu::UnitSuite
12{ 12{
diff --git a/src/unit/taf.cpp b/src/unit/taf.cpp
index f363c78..b3edf5c 100644
--- a/src/unit/taf.cpp
+++ b/src/unit/taf.cpp
@@ -5,9 +5,9 @@
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
6 */ 6 */
7 7
8#include "unitsuite.h" 8#include "bu/unitsuite.h"
9#include "file.h" 9#include "bu/file.h"
10#include "tafreader.h" 10#include "bu/tafreader.h"
11 11
12#include <string.h> 12#include <string.h>
13#include <unistd.h> 13#include <unistd.h>