aboutsummaryrefslogtreecommitdiff
path: root/src/stable/archivebase.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/stable/archivebase.h')
-rw-r--r--src/stable/archivebase.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/stable/archivebase.h b/src/stable/archivebase.h
new file mode 100644
index 0000000..4745d91
--- /dev/null
+++ b/src/stable/archivebase.h
@@ -0,0 +1,75 @@
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#ifndef BU_ARCHIVE_BASE_H
9#define BU_ARCHIVE_BASE_H
10
11#include <stdint.h>
12#include <unistd.h>
13
14namespace Bu
15{
16 class ArchiveBase
17 {
18 public:
19 ArchiveBase();
20 virtual ~ArchiveBase();
21
22 virtual void close()=0;
23 virtual void write( const void *pData, size_t iLength )=0;
24 virtual void read( void *pData, size_t iLength )=0;
25 virtual bool isLoading()=0;
26 };
27
28 template<typename T> ArchiveBase &operator&&( ArchiveBase &ar, T &dat )
29 {
30 if( ar.isLoading() )
31 {
32 return ar >> dat;
33 }
34 else
35 {
36 return ar << dat;
37 }
38 }
39
40 ArchiveBase &operator<<( ArchiveBase &ar, bool p );
41 ArchiveBase &operator<<( ArchiveBase &ar, char p );
42 ArchiveBase &operator<<( ArchiveBase &ar, signed char p );
43 ArchiveBase &operator<<( ArchiveBase &ar, unsigned char p );
44 ArchiveBase &operator<<( ArchiveBase &ar, signed short p );
45 ArchiveBase &operator<<( ArchiveBase &ar, unsigned short p );
46 ArchiveBase &operator<<( ArchiveBase &ar, signed int p );
47 ArchiveBase &operator<<( ArchiveBase &ar, unsigned int p );
48 ArchiveBase &operator<<( ArchiveBase &ar, signed long p );
49 ArchiveBase &operator<<( ArchiveBase &ar, unsigned long p );
50 ArchiveBase &operator<<( ArchiveBase &ar, signed long long p );
51 ArchiveBase &operator<<( ArchiveBase &ar, unsigned long long p );
52 ArchiveBase &operator<<( ArchiveBase &ar, float p );
53 ArchiveBase &operator<<( ArchiveBase &ar, double p );
54 ArchiveBase &operator<<( ArchiveBase &ar, long double p );
55
56 ArchiveBase &operator>>( ArchiveBase &ar, bool &p );
57 ArchiveBase &operator>>( ArchiveBase &ar, char &p );
58 ArchiveBase &operator>>( ArchiveBase &ar, signed char &p );
59 ArchiveBase &operator>>( ArchiveBase &ar, unsigned char &p );
60 ArchiveBase &operator>>( ArchiveBase &ar, signed short &p );
61 ArchiveBase &operator>>( ArchiveBase &ar, unsigned short &p );
62 ArchiveBase &operator>>( ArchiveBase &ar, signed int &p );
63 ArchiveBase &operator>>( ArchiveBase &ar, unsigned int &p );
64 ArchiveBase &operator>>( ArchiveBase &ar, signed long &p );
65 ArchiveBase &operator>>( ArchiveBase &ar, unsigned long &p );
66 ArchiveBase &operator>>( ArchiveBase &ar, signed long long &p );
67 ArchiveBase &operator>>( ArchiveBase &ar, unsigned long long &p );
68 ArchiveBase &operator>>( ArchiveBase &ar, float &p );
69 ArchiveBase &operator>>( ArchiveBase &ar, double &p );
70 ArchiveBase &operator>>( ArchiveBase &ar, long double &p );
71
72
73};
74
75#endif