summaryrefslogtreecommitdiff
path: root/cpp/src/IcePack/Parser.h
blob: 42282a010c2c28a0e74d80dce95245a847ecac76 (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
85
86
87
88
89
// **********************************************************************
//
// Copyright (c) 2001
// MutableRealms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************

#ifndef ICE_PACK_PARSER_H
#define ICE_PACK_PARSER_H

#include <IcePack/Admin.h>
#include <list>

#define YYSTYPE std::list<std::string>

extern int yynerrs;

int yyparse();
int yylex();

namespace IcePack
{

class Parser;

}

namespace IceInternal
{

void incRef(::IcePack::Parser*);
void decRef(::IcePack::Parser*);

}

namespace IcePack
{

typedef ::IceInternal::Handle<Parser> ParserPtr;

}

namespace IcePack
{

class Parser : public ::IceInternal::SimpleShared
{
public:

    static ParserPtr createParser(const Ice::CommunicatorPtr&, const IcePack::AdminPrx&);

    void add(const std::list<std::string>&);
    void remove(const std::list<std::string>&);
    void getAll();
    void shutdown();

    void nextLine();
    void continueLine();
    char* getPrompt();
    void scanPosition(const char*);

    void error(const char*);
    void error(const std::string&);

    void warning(const char*);
    void warning(const std::string&);

    int parse(FILE*, bool);
    int parse(const std::string&, bool);

private:

    Parser(const Ice::CommunicatorPtr&, const IcePack::AdminPrx&);

    Ice::CommunicatorPtr _communicator;
    IcePack::AdminPrx _admin;
    bool _continue;
    int _currentLine;
    std::string _currentFile;
};

extern Parser* parser; // The current parser for bison/flex

}

#endif