1 /* libcmis 2 * Version: MPL 1.1 / GPLv2+ / LGPLv2+ 3 * 4 * The contents of this file are subject to the Mozilla Public License Version 5 * 1.1 (the "License"); you may not use this file except in compliance with 6 * the License or as specified alternatively below. You may obtain a copy of 7 * the License at http://www.mozilla.org/MPL/ 8 * 9 * Software distributed under the License is distributed on an "AS IS" basis, 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 * for the specific language governing rights and limitations under the 12 * License. 13 * 14 * Major Contributor(s): 15 * Copyright (C) 2011 SUSE <cbosdonnat@suse.com> 16 * 17 * 18 * All Rights Reserved. 19 * 20 * For minor contributions see the git repository. 21 * 22 * Alternatively, the contents of this file may be used under the terms of 23 * either the GNU General Public License Version 2 or later (the "GPLv2+"), or 24 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"), 25 * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable 26 * instead of those above. 27 */ 28 29 #include <libcmis-c/property-type.h> 30 31 #include "internals.hxx" 32 libcmis_vector_property_type_free(libcmis_vector_property_type * vector)33void libcmis_vector_property_type_free( libcmis_vector_property_type* vector ) 34 { 35 delete vector; 36 } 37 38 libcmis_vector_property_type_size(libcmis_vector_property_type * vector)39size_t libcmis_vector_property_type_size( libcmis_vector_property_type* vector ) 40 { 41 size_t size = 0; 42 if ( vector != NULL ) 43 size = vector->handle.size( ); 44 return size; 45 } 46 47 libcmis_vector_property_type_get(libcmis_vector_property_type * vector,size_t i)48libcmis_PropertyTypePtr libcmis_vector_property_type_get( libcmis_vector_property_type* vector, size_t i ) 49 { 50 libcmis_PropertyTypePtr item = NULL; 51 if ( vector != NULL && i < vector->handle.size( ) ) 52 { 53 libcmis::PropertyTypePtr type = vector->handle[i]; 54 item = new ( std::nothrow ) libcmis_property_type( ); 55 if ( item ) 56 item->handle = type; 57 } 58 return item; 59 } 60 61 libcmis_property_type_free(libcmis_PropertyTypePtr type)62void libcmis_property_type_free( libcmis_PropertyTypePtr type ) 63 { 64 delete type; 65 } 66 67 libcmis_property_type_getId(libcmis_PropertyTypePtr type)68char* libcmis_property_type_getId( libcmis_PropertyTypePtr type ) 69 { 70 if ( type != NULL && type->handle.get( ) != NULL ) 71 return strdup( type->handle->getId( ).c_str( ) ); 72 else 73 return NULL; 74 } 75 76 libcmis_property_type_getLocalName(libcmis_PropertyTypePtr type)77char* libcmis_property_type_getLocalName( libcmis_PropertyTypePtr type ) 78 { 79 if ( type != NULL && type->handle.get( ) != NULL ) 80 return strdup( type->handle->getLocalName( ).c_str( ) ); 81 else 82 return NULL; 83 } 84 85 libcmis_property_type_getLocalNamespace(libcmis_PropertyTypePtr type)86char* libcmis_property_type_getLocalNamespace( libcmis_PropertyTypePtr type ) 87 { 88 if ( type != NULL && type->handle.get( ) != NULL ) 89 return strdup( type->handle->getLocalNamespace( ).c_str( ) ); 90 else 91 return NULL; 92 } 93 94 libcmis_property_type_getDisplayName(libcmis_PropertyTypePtr type)95char* libcmis_property_type_getDisplayName( libcmis_PropertyTypePtr type ) 96 { 97 if ( type != NULL && type->handle.get( ) != NULL ) 98 return strdup( type->handle->getDisplayName( ).c_str( ) ); 99 else 100 return NULL; 101 } 102 103 libcmis_property_type_getQueryName(libcmis_PropertyTypePtr type)104char* libcmis_property_type_getQueryName( libcmis_PropertyTypePtr type ) 105 { 106 if ( type != NULL && type->handle.get( ) != NULL ) 107 return strdup( type->handle->getQueryName( ).c_str( ) ); 108 else 109 return NULL; 110 } 111 112 libcmis_property_type_getType(libcmis_PropertyTypePtr type)113libcmis_property_type_Type libcmis_property_type_getType( libcmis_PropertyTypePtr type ) 114 { 115 if ( type != NULL && type->handle.get( ) != NULL ) 116 return libcmis_property_type_Type( type->handle->getType( ) ); 117 else 118 return libcmis_String; 119 } 120 121 libcmis_property_type_getXmlType(libcmis_PropertyTypePtr type)122char* libcmis_property_type_getXmlType( libcmis_PropertyTypePtr type ) 123 { 124 if ( type != NULL && type->handle.get( ) != NULL ) 125 return strdup( type->handle->getXmlType( ).c_str( ) ); 126 else 127 return NULL; 128 } 129 130 libcmis_property_type_isMultiValued(libcmis_PropertyTypePtr type)131bool libcmis_property_type_isMultiValued( libcmis_PropertyTypePtr type ) 132 { 133 bool value = false; 134 if ( type != NULL && type->handle.get( ) != NULL ) 135 value = type->handle->isMultiValued( ); 136 return value; 137 } 138 139 libcmis_property_type_isUpdatable(libcmis_PropertyTypePtr type)140bool libcmis_property_type_isUpdatable( libcmis_PropertyTypePtr type ) 141 { 142 bool value = false; 143 if ( type != NULL && type->handle.get( ) != NULL ) 144 value = type->handle->isUpdatable( ); 145 return value; 146 } 147 148 libcmis_property_type_isInherited(libcmis_PropertyTypePtr type)149bool libcmis_property_type_isInherited( libcmis_PropertyTypePtr type ) 150 { 151 bool value = false; 152 if ( type != NULL && type->handle.get( ) != NULL ) 153 value = type->handle->isInherited( ); 154 return value; 155 } 156 157 libcmis_property_type_isRequired(libcmis_PropertyTypePtr type)158bool libcmis_property_type_isRequired( libcmis_PropertyTypePtr type ) 159 { 160 bool value = false; 161 if ( type != NULL && type->handle.get( ) != NULL ) 162 value = type->handle->isRequired( ); 163 return value; 164 } 165 166 libcmis_property_type_isQueryable(libcmis_PropertyTypePtr type)167bool libcmis_property_type_isQueryable( libcmis_PropertyTypePtr type ) 168 { 169 bool value = false; 170 if ( type != NULL && type->handle.get( ) != NULL ) 171 value = type->handle->isQueryable( ); 172 return value; 173 } 174 175 libcmis_property_type_isOrderable(libcmis_PropertyTypePtr type)176bool libcmis_property_type_isOrderable( libcmis_PropertyTypePtr type ) 177 { 178 bool value = false; 179 if ( type != NULL && type->handle.get( ) != NULL ) 180 value = type->handle->isOrderable( ); 181 return value; 182 } 183 184 libcmis_property_type_isOpenChoice(libcmis_PropertyTypePtr type)185bool libcmis_property_type_isOpenChoice( libcmis_PropertyTypePtr type ) 186 { 187 bool value = false; 188 if ( type != NULL && type->handle.get( ) != NULL ) 189 value = type->handle->isOpenChoice( ); 190 return value; 191 } 192 libcmis_property_type_update(libcmis_PropertyTypePtr propDef,libcmis_vector_object_type_Ptr types)193void libcmis_property_type_update( libcmis_PropertyTypePtr propDef, 194 libcmis_vector_object_type_Ptr types ) 195 { 196 if ( propDef != NULL && propDef->handle.get( ) != NULL && types != NULL ) 197 { 198 std::vector< libcmis::ObjectTypePtr > typesHandle = types->handle; 199 propDef->handle->update( typesHandle ); 200 } 201 } 202