Files
Sourcetrail/src/lib_java/data/parser/java/JavaEnvironment.h
T
malte_langkabel 9e4a02a33a src: added optional indexer AST logging
* removed old AstVisitor
* added new implementation called CxxAstVisitor
* added CxxVerboseAstVisitor that may wrap the CxxAstVisitor to log the AST while visiting
* added the same structure for the Java visitors
* removed all the logs that were fired when recording stuff
* Added UI setting for verbose indexer logging.
* implemented AST name obfuscation for Java and Cxx
* unified test visitors for Java and Cxx
* implemented recording using directive decl
* removed most of the old onXxxParsed methods
2016-11-01 10:37:30 +01:00

55 lines
1.3 KiB
C++

#ifndef JAVA_ENVIRONMENT_H
#define JAVA_ENVIRONMENT_H
#include <string>
#include <vector>
struct JavaVM_;
typedef JavaVM_ JavaVM;
struct JNIEnv_;
typedef JNIEnv_ JNIEnv;
class _jclass;
typedef _jclass *jclass;
class _jstring;
typedef _jstring *jstring;
struct _jmethodID;
typedef struct _jmethodID *jmethodID;
class JavaEnvironmentFactory;
class JavaEnvironment
{
public:
struct NativeMethod
{
std::string name;
std::string signature;
void *function;
};
~JavaEnvironment();
bool callStaticVoidMethod(std::string className, std::string methodName, int arg1, std::string arg2, std::string arg3, std::string arg4, int arg5);
bool callStaticMethod(std::string className, std::string methodName, std::string& ret, std::string arg1);
std::string toStdString(jstring s);
jstring toJString(std::string s);
void registerNativeMethods(std::string className, std::vector<NativeMethod> methods);
private:
friend class JavaEnvironmentFactory;
JavaEnvironment(JavaVM* jvm, JNIEnv* env);
jclass getJavaClass(const std::string& className);
jmethodID getJavaStaticMethod(const std::string& className, const std::string& methodName, const std::string& methodSignature);
jmethodID getJavaStaticMethod(jclass javaClass, const std::string& methodName, const std::string& methodSignature);
JavaVM* m_jvm;
JNIEnv* m_env;
};
#endif // JAVA_ENVIRONMENT_H