diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-11-12 17:05:30 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-11-12 17:05:30 +0000 |
commit | 509d136e9adb60c56369565b9545e613cac3678e (patch) | |
tree | f118d676edeae2d5e17f48b32b180d4761b60520 /src/archivebase.cpp | |
parent | 3166bd631a093f42ea44a4b0f4d914cf51518bd4 (diff) | |
download | libbu++-509d136e9adb60c56369565b9545e613cac3678e.tar.gz libbu++-509d136e9adb60c56369565b9545e613cac3678e.tar.bz2 libbu++-509d136e9adb60c56369565b9545e613cac3678e.tar.xz libbu++-509d136e9adb60c56369565b9545e613cac3678e.zip |
I've started my campaign to clean up all of the header files in libbu++ as far
as includes go. This required a little bit of reworking as far as archive goes,
but I've been planning on changing it aronud for a bit anyway.
The final result here is that you may need to add some more includes in your
own code, libbu++ doesn't include as many random things you didn't ask for
anymore, most of these seem to be bu/hash.h, unistd.h, and time.h.
Also, any Archive functions and operators should use ArchiveBase when they can
instead of Archive, archivebase.h is a much lighterweight include that will
be used everywhere in core that it can be, there are a few classes that actually
want a specific archiver to be used, they will use it (such as the nids storage
class).
So far, except for adding header files, nothing has changed in functionality,
and no other code changes should be required, although the above mentioned
archive changeover is reccomended.
Diffstat (limited to 'src/archivebase.cpp')
-rw-r--r-- | src/archivebase.cpp | 190 |
1 files changed, 190 insertions, 0 deletions
diff --git a/src/archivebase.cpp b/src/archivebase.cpp new file mode 100644 index 0000000..41b7ebe --- /dev/null +++ b/src/archivebase.cpp | |||
@@ -0,0 +1,190 @@ | |||
1 | #include "bu/archivebase.h" | ||
2 | |||
3 | Bu::ArchiveBase::ArchiveBase() | ||
4 | { | ||
5 | } | ||
6 | |||
7 | Bu::ArchiveBase::~ArchiveBase() | ||
8 | { | ||
9 | } | ||
10 | |||
11 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, bool p) | ||
12 | { | ||
13 | ar.write( &p, sizeof(p) ); | ||
14 | return ar; | ||
15 | } | ||
16 | |||
17 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, char p) | ||
18 | { | ||
19 | ar.write( &p, sizeof(p) ); | ||
20 | return ar; | ||
21 | } | ||
22 | |||
23 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, signed char p) | ||
24 | { | ||
25 | ar.write( &p, sizeof(p) ); | ||
26 | return ar; | ||
27 | } | ||
28 | |||
29 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, unsigned char p) | ||
30 | { | ||
31 | ar.write( &p, sizeof(p) ); | ||
32 | return ar; | ||
33 | } | ||
34 | |||
35 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, signed short p) | ||
36 | { | ||
37 | ar.write( &p, sizeof(p) ); | ||
38 | return ar; | ||
39 | } | ||
40 | |||
41 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, unsigned short p) | ||
42 | { | ||
43 | ar.write( &p, sizeof(p) ); | ||
44 | return ar; | ||
45 | } | ||
46 | |||
47 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, signed int p) | ||
48 | { | ||
49 | ar.write( &p, sizeof(p) ); | ||
50 | return ar; | ||
51 | } | ||
52 | |||
53 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, unsigned int p) | ||
54 | { | ||
55 | ar.write( &p, sizeof(p) ); | ||
56 | return ar; | ||
57 | } | ||
58 | |||
59 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, signed long p) | ||
60 | { | ||
61 | ar.write( &p, sizeof(p) ); | ||
62 | return ar; | ||
63 | } | ||
64 | |||
65 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, unsigned long p) | ||
66 | { | ||
67 | ar.write( &p, sizeof(p) ); | ||
68 | return ar; | ||
69 | } | ||
70 | |||
71 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, signed long long p) | ||
72 | { | ||
73 | ar.write( &p, sizeof(p) ); | ||
74 | return ar; | ||
75 | } | ||
76 | |||
77 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, unsigned long long p) | ||
78 | { | ||
79 | ar.write( &p, sizeof(p) ); | ||
80 | return ar; | ||
81 | } | ||
82 | |||
83 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, float p) | ||
84 | { | ||
85 | ar.write( &p, sizeof(p) ); | ||
86 | return ar; | ||
87 | } | ||
88 | |||
89 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, double p) | ||
90 | { | ||
91 | ar.write( &p, sizeof(p) ); | ||
92 | return ar; | ||
93 | } | ||
94 | |||
95 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, long double p) | ||
96 | { | ||
97 | ar.write( &p, sizeof(p) ); | ||
98 | return ar; | ||
99 | } | ||
100 | |||
101 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, bool &p) | ||
102 | { | ||
103 | ar.read( &p, sizeof(p) ); | ||
104 | return ar; | ||
105 | } | ||
106 | |||
107 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, char &p) | ||
108 | { | ||
109 | ar.read( &p, sizeof(p) ); | ||
110 | return ar; | ||
111 | } | ||
112 | |||
113 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, signed char &p) | ||
114 | { | ||
115 | ar.read( &p, sizeof(p) ); | ||
116 | return ar; | ||
117 | } | ||
118 | |||
119 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, unsigned char &p) | ||
120 | { | ||
121 | ar.read( &p, sizeof(p) ); | ||
122 | return ar; | ||
123 | } | ||
124 | |||
125 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, signed short &p) | ||
126 | { | ||
127 | ar.read( &p, sizeof(p) ); | ||
128 | return ar; | ||
129 | } | ||
130 | |||
131 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, unsigned short &p) | ||
132 | { | ||
133 | ar.read( &p, sizeof(p) ); | ||
134 | return ar; | ||
135 | } | ||
136 | |||
137 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, signed int &p) | ||
138 | { | ||
139 | ar.read( &p, sizeof(p) ); | ||
140 | return ar; | ||
141 | } | ||
142 | |||
143 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, unsigned int &p) | ||
144 | { | ||
145 | ar.read( &p, sizeof(p) ); | ||
146 | return ar; | ||
147 | } | ||
148 | |||
149 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, signed long &p) | ||
150 | { | ||
151 | ar.read( &p, sizeof(p) ); | ||
152 | return ar; | ||
153 | } | ||
154 | |||
155 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, unsigned long &p) | ||
156 | { | ||
157 | ar.read( &p, sizeof(p) ); | ||
158 | return ar; | ||
159 | } | ||
160 | |||
161 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, signed long long &p) | ||
162 | { | ||
163 | ar.read( &p, sizeof(p) ); | ||
164 | return ar; | ||
165 | } | ||
166 | |||
167 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, unsigned long long &p) | ||
168 | { | ||
169 | ar.read( &p, sizeof(p) ); | ||
170 | return ar; | ||
171 | } | ||
172 | |||
173 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, float &p) | ||
174 | { | ||
175 | ar.read( &p, sizeof(p) ); | ||
176 | return ar; | ||
177 | } | ||
178 | |||
179 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, double &p) | ||
180 | { | ||
181 | ar.read( &p, sizeof(p) ); | ||
182 | return ar; | ||
183 | } | ||
184 | |||
185 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, long double &p) | ||
186 | { | ||
187 | ar.read( &p, sizeof(p) ); | ||
188 | return ar; | ||
189 | } | ||
190 | |||