Fixed enum comments generation, added testcases
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13184 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
72b23954fb
commit
b88de2aa89
14 changed files with 470 additions and 45 deletions
|
|
@ -49,7 +49,7 @@ class JAVA:public Language {
|
|||
bool global_variable_flag; // Flag for when wrapping a global variable
|
||||
bool old_variable_names; // Flag for old style variable names in the intermediary class
|
||||
bool member_func_flag; // flag set when wrapping a member function
|
||||
bool doxygen_javadoc_flag; //flag for converting found doxygen to javadoc
|
||||
bool doxygen; //flag for converting found doxygen to javadoc
|
||||
bool comment_creation_chatter; //flag for getting information about where comments were created in java.cxx
|
||||
|
||||
String *imclass_name; // intermediary class name
|
||||
|
|
@ -123,7 +123,7 @@ public:
|
|||
global_variable_flag(false),
|
||||
old_variable_names(false),
|
||||
member_func_flag(false),
|
||||
doxygen_javadoc_flag(true),
|
||||
doxygen(true),
|
||||
comment_creation_chatter(false),
|
||||
imclass_name(NULL),
|
||||
module_class_name(NULL),
|
||||
|
|
@ -255,6 +255,14 @@ public:
|
|||
Printf(stderr, "Deprecated command line option: %s. Proxy classes are now generated by default.\n", argv[i]);
|
||||
Swig_mark_arg(i);
|
||||
proxy_flag = true;
|
||||
} else if ((strcmp(argv[i], "-doxygen") == 0)) {
|
||||
Swig_mark_arg(i);
|
||||
doxygen = true;
|
||||
scan_doxygen_comments = true;
|
||||
} else if ((strcmp(argv[i], "-nodoxygen") == 0)) {
|
||||
Swig_mark_arg(i);
|
||||
doxygen = false;
|
||||
scan_doxygen_comments = false;
|
||||
} else if ((strcmp(argv[i], "-noproxy") == 0)) {
|
||||
Swig_mark_arg(i);
|
||||
proxy_flag = false;
|
||||
|
|
@ -528,7 +536,7 @@ public:
|
|||
// Start writing out the module class file
|
||||
emitBanner(f_module);
|
||||
//Add any structural comments to the top
|
||||
if(doxygen_javadoc_flag && structuralComments){
|
||||
if(doxygen && structuralComments){
|
||||
Printf(f_module, "%s", structuralComments);
|
||||
}
|
||||
if (package)
|
||||
|
|
@ -537,7 +545,7 @@ public:
|
|||
if (module_imports)
|
||||
Printf(f_module, "%s\n", module_imports);
|
||||
|
||||
if (doxygen_javadoc_flag){
|
||||
if (doxygen){
|
||||
String *doxygen_comments;
|
||||
if(DoxygenTranslator::getDocumentation(n, JavaDoc,doxygen_comments)){
|
||||
if(comment_creation_chatter)
|
||||
|
|
@ -1292,17 +1300,6 @@ public:
|
|||
// Add extra indentation
|
||||
Replaceall(enum_code, "\n", "\n ");
|
||||
Replaceall(enum_code, " \n", "\n");
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen_javadoc_flag){
|
||||
String *doxygen_comments;
|
||||
if(DoxygenTranslator::getDocumentation(n, JavaDoc,doxygen_comments)){
|
||||
if(comment_creation_chatter)
|
||||
Printf(proxy_class_constants_code, "/* This was generated from enumvalueDeclaration() */");
|
||||
Printf(proxy_class_constants_code, Char(doxygen_comments));
|
||||
Delete(doxygen_comments);
|
||||
}
|
||||
}
|
||||
|
||||
Printv(proxy_class_constants_code, " ", enum_code, "\n\n", NIL);
|
||||
} else {
|
||||
|
|
@ -1418,30 +1415,29 @@ public:
|
|||
}
|
||||
if (!addSymbol(name, n, scope))
|
||||
return SWIG_ERROR;
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen){
|
||||
String *doxygen_comments;
|
||||
if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){
|
||||
if(comment_creation_chatter)
|
||||
Printf(enum_code, "/* This was generated from enumvalueDeclaration() */");
|
||||
Printf(enum_code, Char(doxygen_comments));
|
||||
Delete(doxygen_comments);
|
||||
}
|
||||
}
|
||||
|
||||
if ((enum_feature == ProperEnum) && parent_name && !unnamedinstance) {
|
||||
// Wrap (non-anonymous) C/C++ enum with a proper Java enum
|
||||
// Emit the enum item.
|
||||
if (!GetFlag(n, "firstenumitem"))
|
||||
Printf(enum_code, ",\n");
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen_javadoc_flag){
|
||||
String *doxygen_comments;
|
||||
if(DoxygenTranslator::getDocumentation(n, JavaDoc,doxygen_comments)){
|
||||
if(comment_creation_chatter)
|
||||
Printf(enum_code, "/* This was generated from enumvalueDeclaration() */");
|
||||
Printf(enum_code, Char(doxygen_comments));
|
||||
Delete(doxygen_comments);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Printf(enum_code, " %s", symname);
|
||||
if (Getattr(n, "enumvalue")) {
|
||||
String *value = enumValue(n);
|
||||
Printf(enum_code, "(%s)", value);
|
||||
Delete(value);
|
||||
}
|
||||
Printf(enum_code, ",\n");
|
||||
} else {
|
||||
// Wrap C/C++ enums with constant integers or use the typesafe enum pattern
|
||||
SwigType *typemap_lookup_type = parent_name ? parent_name : NewString("enum ");
|
||||
|
|
@ -1493,7 +1489,7 @@ public:
|
|||
* file
|
||||
* ------------------------------------------------------------------------ */
|
||||
virtual int doxygenComment(Node *n){
|
||||
if (doxygen_javadoc_flag){
|
||||
if (doxygen){
|
||||
String *doxygen_comments;
|
||||
if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){
|
||||
if(comment_creation_chatter)
|
||||
|
|
@ -1527,7 +1523,7 @@ public:
|
|||
Swig_save("constantWrapper", n, "value", NIL);
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen_javadoc_flag){
|
||||
if (doxygen){
|
||||
String *doxygen_comments;
|
||||
if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){
|
||||
if(comment_creation_chatter)
|
||||
|
|
@ -1825,7 +1821,7 @@ public:
|
|||
const String *pure_interfaces = typemapLookup(n, "javainterfaces", typemap_lookup_type, WARN_NONE);
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen_javadoc_flag){
|
||||
if (doxygen){
|
||||
String *doxygen_comments;
|
||||
if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){
|
||||
if(comment_creation_chatter)
|
||||
|
|
@ -2231,7 +2227,7 @@ public:
|
|||
}
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen_javadoc_flag){
|
||||
if (doxygen){
|
||||
String *doxygen_comments;
|
||||
if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){
|
||||
if(comment_creation_chatter)
|
||||
|
|
@ -2464,7 +2460,7 @@ public:
|
|||
Printf(im_return_type, "%s", tm);
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen_javadoc_flag){
|
||||
if (doxygen){
|
||||
String *doxygen_comments;
|
||||
if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){
|
||||
if(comment_creation_chatter)
|
||||
|
|
@ -2736,7 +2732,7 @@ public:
|
|||
String *post_code = NewString("");
|
||||
|
||||
// translate and write javadoc comment if flagged
|
||||
if (doxygen_javadoc_flag){
|
||||
if (doxygen){
|
||||
String *doxygen_comments;
|
||||
if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)) {
|
||||
if(comment_creation_chatter)
|
||||
|
|
@ -4523,6 +4519,8 @@ extern "C" Language *swig_java(void) {
|
|||
|
||||
const char *JAVA::usage = (char *) "\
|
||||
Java Options (available with -java)\n\
|
||||
-doxygen - Convert C++ doxygen comments to JavaDoc comments in proxy classes (default)\n\
|
||||
-nodoxygen - Don't convert C++ doxygen comments to JavaDoc comments in proxy classes\n\
|
||||
-nopgcpp - Suppress premature garbage collection prevention parameter\n\
|
||||
-noproxy - Generate the low-level functional interface instead\n\
|
||||
of proxy classes\n\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue