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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
// **********************************************************************
//
// Copyright (c) 2001
// Mutable Realms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************
#ifndef JAVA_UTIL_H
#define JAVA_UTIL_H
#include <Slice/Parser.h>
#include <IceUtil/OutputUtil.h>
namespace Slice
{
class SLICE_API JavaGenerator : public ::IceUtil::noncopyable
{
public:
virtual ~JavaGenerator();
protected:
JavaGenerator(const std::string&, const std::string&);
//
// Given the fully-scoped Java class name, create any intermediate
// package directories and open the class file
//
bool open(const std::string&);
void close();
::IceUtil::Output& output() const;
//
// Check a symbol against any of the Java keywords. If a
// match is found, return the symbol with a leading underscore.
//
std::string fixKwd(const std::string&) const;
//
// Convert a scoped name into a Java class name. If an optional
// scope is provided, the scope will be removed from the result.
//
std::string getAbsolute(const std::string&,
const std::string& = std::string(),
const std::string& = std::string(),
const std::string& = std::string()) const;
//
// Get the Java name for a type. If an optional scope is provided,
// the scope will be removed from the result if possible.
//
enum TypeMode
{
TypeModeIn,
TypeModeOut,
TypeModeMember,
TypeModeReturn
};
std::string typeToString(const TypePtr&, TypeMode mode,
const std::string& = std::string(),
const std::list<std::string>& = std::list<std::string>()) const;
//
// Generate code to marshal or unmarshal a type
//
void writeMarshalUnmarshalCode(::IceUtil::Output&, const std::string&, const TypePtr&, const std::string&,
bool, int&, bool = false, const std::list<std::string>& = std::list<std::string>());
//
// Generate code to marshal or unmarshal a sequence type
//
void writeSequenceMarshalUnmarshalCode(::IceUtil::Output&, const std::string&, const SequencePtr&,
const std::string&, bool, int&, bool,
const std::list<std::string>& = std::list<std::string>());
//
// Generate generic code to marshal or unmarshal a type
//
void writeGenericMarshalUnmarshalCode(::IceUtil::Output&, const std::string&, const TypePtr&,
const std::string&, const std::string&, bool, int&, bool = false,
const std::list<std::string>& = std::list<std::string>());
//
// Generate generic code to marshal or unmarshal a sequence type
//
void writeGenericSequenceMarshalUnmarshalCode(::IceUtil::Output&, const std::string&, const SequencePtr&,
const std::string&, const std::string&, bool, int&, bool,
const std::list<std::string>& = std::list<std::string>());
protected:
static std::string findMetaData(const std::list<std::string>&);
private:
void printHeader();
std::string _dir;
std::string _package;
::IceUtil::Output* _out;
};
}
#endif
|