summaryrefslogtreecommitdiff
path: root/cpp/src/slice2docbook/Gen.h
blob: a0491ed20070924bbd151d2d54a7652fee955e94 (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
// **********************************************************************
//
// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

#ifndef GEN_H
#define GEN_H

#include <Slice/Parser.h>
#include <IceUtil/OutputUtil.h>
#include <stack>

namespace Slice
{

class Gen : private ::IceUtil::noncopyable, public ParserVisitor
{
public:

    Gen(const std::string&, const std::string&, bool, bool, bool, bool, bool);
    virtual ~Gen();

    bool operator!() const; // Returns true if there was a constructor error

    void generate(const UnitPtr&);

    virtual bool visitUnitStart(const UnitPtr&);
    virtual void visitUnitEnd(const UnitPtr&);
    virtual bool visitModuleStart(const ModulePtr&);
    virtual void visitContainer(const ContainerPtr&);
    virtual bool visitClassDefStart(const ClassDefPtr&);
    virtual bool visitExceptionStart(const ExceptionPtr&);
    virtual bool visitStructStart(const StructPtr&);
    virtual void visitEnum(const EnumPtr&);
    virtual void visitConst(const ConstPtr&);

private:

    void printHeader();
    std::string getComment(const ContainedPtr&, const ContainerPtr&, bool);
    StringList getTagged(const std::string&, std::string&);
    void printMetaData(const ContainedPtr&);
    void printComment(const ContainedPtr&);
    void printSummary(const ContainedPtr&);
    void start(const std::string&);
    void start(const std::string&, const std::string&, bool = true);
    void end();

    std::string containedToId(const ContainedPtr&);
    std::string getScopedMinimized(const ContainedPtr&, const ContainerPtr&);
    std::string toString(const SyntaxTreeBasePtr&, const ContainerPtr&, bool = true);
    std::string toString(const std::string&, const ContainerPtr&, bool = true);

    ::IceUtil::XMLOutput O;

    bool _standAlone;
    bool _noGlobals;
    std::string _chapter;
    bool _noIndex;
    bool _sortFields;
};

}

#endif