gecko-dev/ef/Tools/JavaH/JNIHeaderGenerator.h
1999-11-02 06:38:29 +00:00

67 lines
2.2 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#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_ */