1 /****************************************************************************** 2 * $Id: MajorObject.i b1fd4d61e877e5d9de96ed4a590b06adf80a905f 2021-02-25 02:44:52 -0500 Elliott Sales de Andrade $ 3 * 4 * Project: GDAL SWIG Interfaces. 5 * Purpose: SWIG Definitions for GDALMajorObject. 6 * Author: Kevin Ruland, kruland@ku.edu 7 * 8 ****************************************************************************** 9 * Copyright (c) 2005, Kevin Ruland 10 * 11 * Permission is hereby granted, free of charge, to any person obtaining a 12 * copy of this software and associated documentation files (the "Software"), 13 * to deal in the Software without restriction, including without limitation 14 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 15 * and/or sell copies of the Software, and to permit persons to whom the 16 * Software is furnished to do so, subject to the following conditions: 17 * 18 * The above copyright notice and this permission notice shall be included 19 * in all copies or substantial portions of the Software. 20 * 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 * DEALINGS IN THE SOFTWARE. 28 *****************************************************************************/ 29 30 /* For Python we don't import, but include MajorObject.i to avoid */ 31 /* cyclic dependency between gdal.py and ogr.py. */ 32 /* We should probably define a new module for MajorObject, or merge gdal and ogr */ 33 /* modules */ 34 #ifndef FROM_PYTHON_OGR_I 35 #ifdef PERL_CPAN_NAMESPACE 36 %module "Geo::GDAL" 37 #elif defined(SWIGCSHARP) 38 %module Gdal 39 #elif defined(SWIGPYTHON) 40 %module (package="osgeo") gdal 41 #else 42 %module gdal 43 #endif 44 #endif /* FROM_PYTHON_OGR_I */ 45 46 %rename (MajorObject) GDALMajorObjectShadow; 47 48 class GDALMajorObjectShadow { 49 private: 50 GDALMajorObjectShadow(); 51 ~GDALMajorObjectShadow(); 52 53 public: 54 %extend { 55 /* 56 * GetDescription 57 */ GetDescription()58 const char *GetDescription() { 59 return GDALGetDescription( self ); 60 } 61 62 /* 63 * SetDescription 64 */ 65 %apply Pointer NONNULL {const char * pszNewDesc}; SetDescription(const char * pszNewDesc)66 void SetDescription( const char *pszNewDesc ) { 67 GDALSetDescription( self, pszNewDesc ); 68 } 69 %clear const char * pszNewDesc; 70 71 72 %apply (char **CSL) {(char **)}; GetMetadataDomainList()73 char ** GetMetadataDomainList( ) { 74 return GDALGetMetadataDomainList( self ); 75 } 76 %clear char **; 77 78 /* 79 * GetMetadata methods 80 */ 81 %apply (char **dict) { char ** }; 82 char ** GetMetadata_Dict( const char * pszDomain = "" ) { 83 return GDALGetMetadata( self, pszDomain ); 84 } 85 %clear char **; 86 87 %apply (char **options) {char **}; 88 char **GetMetadata_List( const char *pszDomain = "" ) { 89 return GDALGetMetadata( self, pszDomain ); 90 } 91 %clear char **; 92 93 /* 94 * SetMetadata methods 95 */ 96 97 #ifdef SWIGJAVA 98 %apply (char **options) { char ** papszMetadata }; 99 CPLErr SetMetadata( char ** papszMetadata, const char * pszDomain = "" ) { 100 return GDALSetMetadata( self, papszMetadata, pszDomain ); 101 } 102 %clear char **papszMetadata; 103 #else 104 %apply (char **dict) { char ** papszMetadata }; 105 CPLErr SetMetadata( char ** papszMetadata, const char * pszDomain = "" ) { 106 return GDALSetMetadata( self, papszMetadata, pszDomain ); 107 } 108 %clear char **papszMetadata; 109 #endif 110 111 CPLErr SetMetadata( char * pszMetadataString , const char *pszDomain = "" ) { 112 char *tmpList[2]; 113 tmpList[0] = pszMetadataString; 114 tmpList[1] = 0; 115 return GDALSetMetadata( self, tmpList, pszDomain ); 116 } 117 118 /* 119 * GetMetadataItem 120 */ 121 %apply Pointer NONNULL {const char * pszName}; 122 const char *GetMetadataItem( const char *pszName, const char *pszDomain = "" ) { 123 return GDALGetMetadataItem( self, pszName, pszDomain); 124 } 125 126 /* 127 * SetMetadataItem 128 */ 129 CPLErr SetMetadataItem( const char * pszName, const char * pszValue, 130 const char * pszDomain = "" ) { 131 return GDALSetMetadataItem( self, pszName, pszValue, pszDomain); 132 } 133 %clear const char * pszName; 134 135 } /* %extend */ 136 }; 137