blob: 35729c8abba5d76a51ff0b27df09599a8be7fa9b [file] [log] [blame]
Christopher Wiley89e35862015-08-30 10:57:07 -07001#ifndef AIDL_GENERATE_JAVA_H_
2#define AIDL_GENERATE_JAVA_H_
Adam Lesinskiffa16862014-01-23 18:17:42 -08003
Adam Lesinskiffa16862014-01-23 18:17:42 -08004#include <string>
5
Christopher Wiley038485e2015-09-12 11:14:14 -07006#include "aidl_language.h"
7#include "ast_java.h"
Christopher Wileya30a45e2015-10-17 10:56:59 -07008#include "io_delegate.h"
Christopher Wiley038485e2015-09-12 11:14:14 -07009
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070010namespace android {
11namespace aidl {
12
Christopher Wiley9f4c7ae2015-08-24 14:07:32 -070013using std::string;
14using std::vector;
Adam Lesinskiffa16862014-01-23 18:17:42 -080015
Christopher Wileydb154a52015-09-28 16:32:25 -070016namespace java {
17
Christopher Wiley84c1eac2015-09-23 13:29:28 -070018class JavaTypeNamespace;
19
Adam Lesinskiffa16862014-01-23 18:17:42 -080020int generate_java(const string& filename, const string& originalSrc,
Christopher Wileya30a45e2015-10-17 10:56:59 -070021 AidlInterface* iface, java::JavaTypeNamespace* types,
22 const IoDelegate& io_delegate);
Adam Lesinskiffa16862014-01-23 18:17:42 -080023
Christopher Wileydb154a52015-09-28 16:32:25 -070024android::aidl::java::Class* generate_binder_interface_class(
Casey Dahlin1ae2bc52015-10-07 18:49:10 -070025 const AidlInterface* iface, java::JavaTypeNamespace* types);
Christopher Wileydb154a52015-09-28 16:32:25 -070026
27} // namespace java
Adam Lesinskiffa16862014-01-23 18:17:42 -080028
Adam Lesinskiffa16862014-01-23 18:17:42 -080029string append(const char* a, const char* b);
30
31class VariableFactory
32{
33public:
Christopher Wileydb154a52015-09-28 16:32:25 -070034 using Variable = ::android::aidl::java::Variable;
35 using Type = ::android::aidl::java::Type;
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070036
Adam Lesinskiffa16862014-01-23 18:17:42 -080037 VariableFactory(const string& base); // base must be short
Christopher Wiley8f6816e2015-09-22 17:03:47 -070038 Variable* Get(const Type* type);
Adam Lesinskiffa16862014-01-23 18:17:42 -080039 Variable* Get(int index);
40private:
41 vector<Variable*> m_vars;
42 string m_base;
43 int m_index;
44};
45
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070046} // namespace android
47} // namespace aidl
Adam Lesinskiffa16862014-01-23 18:17:42 -080048
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070049#endif // AIDL_GENERATE_JAVA_H_