gecko-dev/ef/Tools/JavaH/JNIHeaderGenerator.h

63 lines
2.1 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _JNI_HEADER_GENERATOR_H_
#define _JNI_HEADER_GENERATOR_H_
#include "HeaderGenerator.h"
/* Header generator for JNI-style internal native methods.
* Almost identical to the sun header generator, except that
* it generates method declarations of the form
*
* JNIEXPORT JNICALL(returnType) foo()
*
* rather than
*
* JNIEXPORT returnType JNICALL foo()
*
* as generated by Sun. We will need to generate the first form
* in order to support x86 Unices like Linux.
*/
class JNIHeaderGenerator : public HeaderGenerator {
public:
JNIHeaderGenerator(ClassCentral &central) :
HeaderGenerator(central) { }
virtual ~JNIHeaderGenerator() { }
/* Return a string that is the C++ representation of the given type, as
* used as arguments to C++ functions and return types.
* Sub-classes might want to re-define this if they want to return
* different representations. This routine allocates memory (using malloc)
* for the string that it generates; it is the responsibility of the
* caller to free this memory (using free()).
*/
virtual char *getArgString(const Type &type);
protected:
virtual bool needParents() { return false; }
#ifndef USE_PR_IO
virtual bool genHeaderFile(ClassFileSummary &summ, PRFileDesc *fp);
#else
virtual bool genHeaderFile(ClassFileSummary &summ, FILE *fp);
#endif
private:
};
#endif /* _JNI_HEADER_GENERATOR_H_ */