aboutsummaryrefslogtreecommitdiff
path: root/src/stable/archivebinary.h
blob: d9172498f065faf0146107d8366fd16222d68a32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Copyright (C) 2007-2019 Xagasoft, All rights reserved.
 *
 * This file is part of the libbu++ library and is released under the
 * terms of the license contained in the file LICENSE.
 */

#ifndef BU_ARCHIVE_BINARY_H
#define BU_ARCHIVE_BINARY_H

#include <stdint.h>
#include "bu/archive.h"
#include "bu/hash.h"
#include "bu/util.h"
#include "bu/variant.h"
#include "bu/blob.h"

namespace Bu
{
    class Stream;

    /**
     */
    class ArchiveBinary : public Archive
    {
    private:
        bool bLoading;
    public:
        bool isLoading();

        ArchiveBinary( Stream &rStream, bool bLoading );
        virtual ~ArchiveBinary();
        virtual void close();

        //virtual void write( const void *pData, size_t iSize );
        //virtual void read( void *pData, size_t iSize );
        
        virtual void write(                 bool        rData );
        virtual void write(       unsigned  char        rData );
        virtual void write(                 char        rData );
        virtual void write(       signed    char        rData );
        virtual void write(       unsigned  short       rData );
        virtual void write(       signed    short       rData );
        virtual void write(       unsigned  int         rData );
        virtual void write(       signed    int         rData );
        virtual void write(       unsigned  long        rData );
        virtual void write(       signed    long        rData );
        virtual void write(       unsigned  long long   rData );
        virtual void write(       signed    long long   rData );
        virtual void write(                 float       rData );
        virtual void write(                 double      rData );
        virtual void write(                 long double rData );
        virtual void write( const           Bu::Blob    &rData );
        virtual void write( const           Bu::Text    &rData );
        
        virtual void read(           bool        &rData );
        virtual void read( unsigned  char        &rData );
        virtual void read(           char        &rData );
        virtual void read( signed    char        &rData );
        virtual void read( unsigned  short       &rData );
        virtual void read( signed    short       &rData );
        virtual void read( unsigned  int         &rData );
        virtual void read( signed    int         &rData );
        virtual void read( unsigned  long        &rData );
        virtual void read( signed    long        &rData );
        virtual void read( unsigned  long long   &rData );
        virtual void read( signed    long long   &rData );
        virtual void read(           float       &rData );
        virtual void read(           double      &rData );
        virtual void read(           long double &rData );
        virtual void read(           Bu::Blob    &rData );
        virtual void read(           Bu::Text    &rData );
        
        virtual void setProperty( const Bu::Blob &rKey,
                const Bu::Variant &rValue );
        virtual Bu::Variant getProperty( const Bu::Blob &rKey ) const;

    private:
        Stream &rStream;
        Hash<Bu::Blob, Variant> hProps;
    };
}

#endif