aboutsummaryrefslogtreecommitdiff
path: root/src/archive.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-06-07 06:15:07 +0000
committerMike Buland <eichlan@xagasoft.com>2008-06-07 06:15:07 +0000
commit3ac57795fe8e28915523de6dd95e336a3eaa8064 (patch)
tree5e06f65c451bdef412968c6631bcccfe2b15b2a3 /src/archive.cpp
parent555ba77568b6faf18ebaed06cd08615deab2d8e3 (diff)
downloadlibbu++-3ac57795fe8e28915523de6dd95e336a3eaa8064.tar.gz
libbu++-3ac57795fe8e28915523de6dd95e336a3eaa8064.tar.bz2
libbu++-3ac57795fe8e28915523de6dd95e336a3eaa8064.tar.xz
libbu++-3ac57795fe8e28915523de6dd95e336a3eaa8064.zip
This seems to have done the trick, on the 32 bit platform, anyway. Turns out
it's a bad idea to rely on the intNN_t typedefs. I enumerated all non-pointer primitives in c++ (except void, you can't store things in a void), and it works great. I also discovered C and C++ actually have unsigned char, signed char, and char, which are all distinct types. It supports all three now. In addition, I got rid of all of the specific && operators, the general one covers it all. Also, the unit tests all pass for now. Now to try it on the 64bit system.
Diffstat (limited to 'src/archive.cpp')
-rw-r--r--src/archive.cpp133
1 files changed, 128 insertions, 5 deletions
diff --git a/src/archive.cpp b/src/archive.cpp
index d6ad18d..accdeb1 100644
--- a/src/archive.cpp
+++ b/src/archive.cpp
@@ -45,6 +45,129 @@ bool Bu::Archive::isLoading()
45{ 45{
46 return bLoading; 46 return bLoading;
47} 47}
48
49Bu::Archive &Bu::Archive::operator<<(bool p)
50{
51 write( &p, sizeof(p) );
52 return *this;
53}
54Bu::Archive &Bu::Archive::operator<<(char p)
55{
56 write( &p, sizeof(p) );
57 return *this;
58}
59Bu::Archive &Bu::Archive::operator<<(signed char p)
60{
61 write( &p, sizeof(p) );
62 return *this;
63}
64Bu::Archive &Bu::Archive::operator<<(unsigned char p)
65{
66 write( &p, sizeof(p) );
67 return *this;
68}
69Bu::Archive &Bu::Archive::operator<<(signed short p)
70{
71 write( &p, sizeof(p) );
72 return *this;
73}
74Bu::Archive &Bu::Archive::operator<<(unsigned short p)
75{
76 write( &p, sizeof(p) );
77 return *this;
78}
79Bu::Archive &Bu::Archive::operator<<(signed int p)
80{
81 write( &p, sizeof(p) );
82 return *this;
83}
84Bu::Archive &Bu::Archive::operator<<(unsigned int p)
85{
86 write( &p, sizeof(p) );
87 return *this;
88}
89Bu::Archive &Bu::Archive::operator<<(signed long p)
90{
91 write( &p, sizeof(p) );
92 return *this;
93}
94Bu::Archive &Bu::Archive::operator<<(unsigned long p)
95{
96 write( &p, sizeof(p) );
97 return *this;
98}
99Bu::Archive &Bu::Archive::operator<<(signed long long p)
100{
101 write( &p, sizeof(p) );
102 return *this;
103}
104Bu::Archive &Bu::Archive::operator<<(unsigned long long p)
105{
106 write( &p, sizeof(p) );
107 return *this;
108}
109
110Bu::Archive &Bu::Archive::operator>>(bool &p)
111{
112 read( &p, sizeof(p) );
113 return *this;
114}
115Bu::Archive &Bu::Archive::operator>>(char &p)
116{
117 read( &p, sizeof(p) );
118 return *this;
119}
120Bu::Archive &Bu::Archive::operator>>(signed char &p)
121{
122 read( &p, sizeof(p) );
123 return *this;
124}
125Bu::Archive &Bu::Archive::operator>>(unsigned char &p)
126{
127 read( &p, sizeof(p) );
128 return *this;
129}
130Bu::Archive &Bu::Archive::operator>>(signed short &p)
131{
132 read( &p, sizeof(p) );
133 return *this;
134}
135Bu::Archive &Bu::Archive::operator>>(unsigned short &p)
136{
137 read( &p, sizeof(p) );
138 return *this;
139}
140Bu::Archive &Bu::Archive::operator>>(signed int &p)
141{
142 read( &p, sizeof(p) );
143 return *this;
144}
145Bu::Archive &Bu::Archive::operator>>(unsigned int &p)
146{
147 read( &p, sizeof(p) );
148 return *this;
149}
150Bu::Archive &Bu::Archive::operator>>(signed long &p)
151{
152 read( &p, sizeof(p) );
153 return *this;
154}
155Bu::Archive &Bu::Archive::operator>>(unsigned long &p)
156{
157 read( &p, sizeof(p) );
158 return *this;
159}
160Bu::Archive &Bu::Archive::operator>>(signed long long &p)
161{
162 read( &p, sizeof(p) );
163 return *this;
164}
165Bu::Archive &Bu::Archive::operator>>(unsigned long long &p)
166{
167 read( &p, sizeof(p) );
168 return *this;
169}
170/*
48Bu::Archive &Bu::Archive::operator<<(bool p) 171Bu::Archive &Bu::Archive::operator<<(bool p)
49{ 172{
50 write( &p, sizeof(p) ); 173 write( &p, sizeof(p) );
@@ -89,12 +212,12 @@ Bu::Archive &Bu::Archive::operator<<(uint64_t p)
89{ 212{
90 write( &p, sizeof(p) ); 213 write( &p, sizeof(p) );
91 return *this; 214 return *this;
92}/* 215}
93Bu::Archive &Bu::Archive::operator<<(long p) 216Bu::Archive &Bu::Archive::operator<<(long p)
94{ 217{
95 write( &p, sizeof(p) ); 218 write( &p, sizeof(p) );
96 return *this; 219 return *this;
97}*/ 220}
98Bu::Archive &Bu::Archive::operator<<(float p) 221Bu::Archive &Bu::Archive::operator<<(float p)
99{ 222{
100 write( &p, sizeof(p) ); 223 write( &p, sizeof(p) );
@@ -155,12 +278,12 @@ Bu::Archive &Bu::Archive::operator>>(uint64_t &p)
155{ 278{
156 read( &p, sizeof(p) ); 279 read( &p, sizeof(p) );
157 return *this; 280 return *this;
158}/* 281}
159Bu::Archive &Bu::Archive::operator>>(long &p) 282Bu::Archive &Bu::Archive::operator>>(long &p)
160{ 283{
161 read( &p, sizeof(p) ); 284 read( &p, sizeof(p) );
162 return *this; 285 return *this;
163}*/ 286}
164Bu::Archive &Bu::Archive::operator>>(float &p) 287Bu::Archive &Bu::Archive::operator>>(float &p)
165{ 288{
166 read( &p, sizeof(p) ); 289 read( &p, sizeof(p) );
@@ -320,7 +443,7 @@ Bu::Archive &Bu::Archive::operator&&(long double &p)
320 return *this << p; 443 return *this << p;
321 } 444 }
322} 445}
323 446*/
324 447
325Bu::Archive &Bu::operator<<(Bu::Archive &s, Bu::Archival &p) 448Bu::Archive &Bu::operator<<(Bu::Archive &s, Bu::Archival &p)
326{ 449{