aboutsummaryrefslogtreecommitdiff
path: root/c++-libbu++/src/list.h
blob: b661de61354f8e121ad8cdca35b4465fff6bebfd (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
/*
 * Copyright (C) 2007-2013 Xagasoft, All rights reserved.
 *
 * This file is part of the libgats library and is released under the
 * terms of the license contained in the file LICENSE.
 */

#ifndef GATS_LIST_H
#define GATS_LIST_H

#include "gats/object.h"
#include <bu/list.h>
#include <bu/string.h>

namespace Gats
{
    class Dictionary;

    class List : public Gats::Object, public Bu::List<Gats::Object *>
    {
    public:
        List();
        virtual ~List();

        virtual Object *clone() const;
        virtual Type getType() const { return typeList; }

        virtual void write( Bu::Stream &rOut ) const;
        virtual void read( Bu::Stream &rIn, char cType );

        void append( const char *s );
        void append( const Bu::String &s );
        void append( int32_t i );
        void append( int64_t i );
        void append( double d );
        using Bu::List<Gats::Object *>::append;
        void appendStr( const Bu::String &s );
        void appendInt( int64_t i );
        void appendFloat( double d );
        void appendBool( bool b );
        void appendList( Gats::List *pL );
        void appendDict( Gats::Dictionary *pD );
        Gats::List *appendList();
        Gats::Dictionary *appendDict();
        
        void prepend( const char *s );
        void prepend( const Bu::String &s );
        void prepend( int32_t i );
        void prepend( int64_t i );
        void prepend( double d );
        using Bu::List<Gats::Object *>::prepend;
        void prependStr( const Bu::String &s );
        void prependInt( int64_t i );
        void prependFloat( double d );
        void prependBool( bool b );
        void prependList( Gats::List *pL );
        void prependDict( Gats::Dictionary *pD );
        Gats::List *prependList();
        Gats::Dictionary *prependDict();
    };
};

Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::List &l );

#endif