Skip to content

Commit

Permalink
add missing functions to outputformatObj that allow iterating over th…
Browse files Browse the repository at this point in the history
…e format's OPTIONS #4553
  • Loading branch information
unicolet committed Jan 29, 2013
1 parent a9ffaf8 commit a52c440
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions mapscript/java/examples/OutputFormatList.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public static void main(String[] args) {
for (int i=0; i<map.getNumoutputformats(); i++) {
outputFormatObj format = map.getOutputFormat(i);
System.out.println("["+i+"] Format name: "+format.getName());
System.out.println("\toption count: "+format.getNumformatoptions());
for(int j=0;j<format.getNumformatoptions();i++) {
System.out.println("\t["+j+"] option: "+format.getOptionAt(j));
}
}
}
}
10 changes: 9 additions & 1 deletion mapscript/swiginc/outputformat.i
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,15 @@
{
const char *retval;
retval = msGetOutputFormatOption(self, key, value);
return strdup(retval);
return retval;
}

%newobject getOptionAt;
char* getOptionAt(int i) {
if( i > 0 && i < self->numformatoptions ) {
return self->formatoptions[i];
}
return NULL;
}

void attachDevice( void *device )
Expand Down
8 changes: 5 additions & 3 deletions mapserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -752,10 +752,14 @@ extern "C" {
/************************************************************************/

typedef struct {
#ifndef SWIG
int refcount;
char **formatoptions;
#endif /* SWIG */
#ifdef SWIG
%immutable;
#endif /* SWIG */
int refcount;
int numformatoptions;
#ifdef SWIG
%mutable;
#endif /* SWIG */
Expand All @@ -767,8 +771,6 @@ extern "C" {
int imagemode; /* MS_IMAGEMODE_* value. */
int transparent;
int bands;
int numformatoptions;
char **formatoptions;
int inmapfile; /* boolean value for writing */
#ifndef SWIG
rendererVTableObj *vtable;
Expand Down

0 comments on commit a52c440

Please sign in to comment.