1 /* =========================================================================== 2 $Id$ 3 4 Project: MapServer 5 Purpose: SWIG interface file for mapscript outputFormatObj extensions 6 Author: Steve Lime 7 Sean Gillies, sgillies@frii.com 8 9 =========================================================================== 10 Copyright (c) 1996-2001 Regents of the University of Minnesota. 11 12 Permission is hereby granted, free of charge, to any person obtaining a 13 copy of this software and associated documentation files (the "Software"), 14 to deal in the Software without restriction, including without limitation 15 the rights to use, copy, modify, merge, publish, distribute, sublicense, 16 and/or sell copies of the Software, and to permit persons to whom the 17 Software is furnished to do so, subject to the following conditions: 18 19 The above copyright notice and this permission notice shall be included 20 in all copies or substantial portions of the Software. 21 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 23 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 25 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 DEALINGS IN THE SOFTWARE. 29 =========================================================================== 30 */ 31 32 %extend outputFormatObj 33 { 34 35 outputFormatObj(const char *driver, char *name=NULL) 36 { 37 outputFormatObj *format; 38 39 format = msCreateDefaultOutputFormat(NULL, driver, name); 40 41 /* in the case of unsupported formats, msCreateDefaultOutputFormat 42 should return NULL */ 43 if (!format) 44 { 45 msSetError(MS_MISCERR, "Unsupported format driver: %s", 46 "outputFormatObj()", driver); 47 return NULL; 48 } 49 50 msInitializeRendererVTable(format); 51 52 MS_REFCNT_INIT(format); 53 format->inmapfile = MS_TRUE; 54 55 return format; 56 } 57 ~outputFormatObj()58 ~outputFormatObj() 59 { 60 msFreeOutputFormat( self ); 61 } 62 63 #ifndef SWIGJAVA setExtension(const char * extension)64 void setExtension( const char *extension ) 65 { 66 msFree( self->extension ); 67 self->extension = msStrdup(extension); 68 } 69 setMimetype(const char * mimetype)70 void setMimetype( const char *mimetype ) 71 { 72 msFree( self->mimetype ); 73 self->mimetype = msStrdup(mimetype); 74 } 75 #endif 76 setOption(const char * key,const char * value)77 void setOption( const char *key, const char *value ) 78 { 79 msSetOutputFormatOption( self, key, value ); 80 } 81 validate()82 int validate() 83 { 84 return msOutputFormatValidate( self, MS_FALSE ); 85 } 86 87 %newobject getOption; 88 char *getOption(const char *key, const char *value="") 89 { 90 return msStrdup(msGetOutputFormatOption(self, key, value)); 91 } 92 93 %newobject getOptionAt; getOptionAt(int i)94 char* getOptionAt(int i) { 95 if( i >= 0 && i < self->numformatoptions ) { 96 return msStrdup(self->formatoptions[i]); 97 } 98 return NULL; 99 } 100 attachDevice(void * device)101 void attachDevice( void *device ) 102 { 103 self->device = device; 104 } 105 106 } 107 108 109