summaryrefslogtreecommitdiff
path: root/src/tests/archive2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/archive2.cpp')
-rw-r--r--src/tests/archive2.cpp102
1 files changed, 0 insertions, 102 deletions
diff --git a/src/tests/archive2.cpp b/src/tests/archive2.cpp
deleted file mode 100644
index e8d3360..0000000
--- a/src/tests/archive2.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#include "bu/archive.h"
9#include "bu/archival.h"
10#include "bu/file.h"
11
12int giId = 0;
13
14class A : public Bu::Archival
15{
16public:
17 A() :
18 iId( giId++ )
19 {
20 }
21
22 virtual ~A()
23 {
24 }
25
26 virtual void archive( Bu::ArchiveBase &ar )
27 {
28 ar && iId;
29 }
30
31 int iId;
32};
33
34class B : public Bu::Archival
35{
36public:
37 B() :
38 iId( giId++ ),
39 a1( new A ),
40 a2( new A )
41 {
42 }
43
44 virtual ~B()
45 {
46 delete a1;
47 delete a2;
48 }
49
50 virtual void archive( Bu::ArchiveBase &ar )
51 {
52 //ar && iId && a1 && a2;
53 ar << iId << a1 << a2;
54 }
55
56 int iId;
57 A *a1, *a2;
58};
59
60class C : public Bu::Archival
61{
62public:
63 C() :
64 iId( giId++ ),
65 a( new A ),
66 b( new B )
67 {
68 }
69
70 virtual ~C()
71 {
72 delete a;
73 delete b;
74 }
75
76 virtual void archive( Bu::ArchiveBase &ar )
77 {
78 //ar && iId && a && b;
79 ar << iId;
80 ar << a << b;
81 }
82
83 int iId;
84 A *a;
85 B *b;
86};
87
88void write()
89{
90 C *c = new C;
91
92 Bu::File f( "test.archive", Bu::File::Write );
93 Bu::Archive ar( f, Bu::Archive::save );
94 ar << c;
95}
96
97int main()
98{
99 write();
100
101}
102