Permalink
Browse files

add missing functions to outputformatObj that allow iterating over th…

…e format's OPTIONS #4553
  • Loading branch information...
1 parent a9ffaf8 commit a52c440dc2ea105f319b3ae44f38c5810e0b05fc @unicolet unicolet committed Jan 29, 2013
Showing with 18 additions and 4 deletions.
  1. +4 −0 mapscript/java/examples/OutputFormatList.java
  2. +9 −1 mapscript/swiginc/outputformat.i
  3. +5 −3 mapserver.h
@@ -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));
+ }
}
}
}
@@ -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 )
View
@@ -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 */
@@ -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;

0 comments on commit a52c440

Please sign in to comment.