UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 00029 #ifndef INCLUDED_registry_writer_hxx 00030 #define INCLUDED_registry_writer_hxx 00031 00032 #include "registry/writer.h" 00033 #include "registry/refltype.hxx" 00034 #include "registry/types.h" 00035 #include "registry/version.h" 00036 00037 #include "rtl/ustring.hxx" 00038 #include "sal/types.h" 00039 00040 #include <new> 00041 00042 namespace typereg { 00043 00051 class Writer { 00052 public: 00081 Writer( 00082 typereg_Version version, rtl::OUString const & documentation, 00083 rtl::OUString const & fileName, RTTypeClass typeClass, bool published, 00084 rtl::OUString const & typeName, sal_uInt16 superTypeCount, 00085 sal_uInt16 fieldCount, sal_uInt16 methodCount, 00086 sal_uInt16 referenceCount): 00087 m_handle( 00088 typereg_writer_create( 00089 version, documentation.pData, fileName.pData, typeClass, 00090 published, typeName.pData, superTypeCount, fieldCount, 00091 methodCount, referenceCount)) 00092 { 00093 if (m_handle == 0) { 00094 throw std::bad_alloc(); 00095 } 00096 } 00097 00101 ~Writer() { 00102 typereg_writer_destroy(m_handle); 00103 } 00104 00115 void setSuperTypeName(sal_uInt16 index, rtl::OUString const & typeName) { 00116 if (!typereg_writer_setSuperTypeName(m_handle, index, typeName.pData)) { 00117 throw std::bad_alloc(); 00118 } 00119 } 00120 00140 void setFieldData( 00141 sal_uInt16 index, rtl::OUString const & documentation, 00142 rtl::OUString const & fileName, RTFieldAccess flags, rtl::OUString const & name, 00143 rtl::OUString const & typeName, RTConstValue const & value) 00144 { 00145 if (!typereg_writer_setFieldData( 00146 m_handle, index, documentation.pData, fileName.pData, flags, 00147 name.pData, typeName.pData, value.m_type, value.m_value)) 00148 { 00149 throw std::bad_alloc(); 00150 } 00151 } 00152 00172 void setMethodData( 00173 sal_uInt16 index, rtl::OUString const & documentation, 00174 RTMethodMode flags, rtl::OUString const & name, 00175 rtl::OUString const & returnTypeName, sal_uInt16 parameterCount, 00176 sal_uInt16 exceptionCount) 00177 { 00178 if (!typereg_writer_setMethodData( 00179 m_handle, index, documentation.pData, flags, name.pData, 00180 returnTypeName.pData, parameterCount, exceptionCount)) 00181 { 00182 throw std::bad_alloc(); 00183 } 00184 } 00185 00203 void setMethodParameterData( 00204 sal_uInt16 methodIndex, sal_uInt16 parameterIndex, 00205 RTParamMode flags, rtl::OUString const & name, 00206 rtl::OUString const & typeName) 00207 { 00208 if (!typereg_writer_setMethodParameterData( 00209 m_handle, methodIndex, parameterIndex, flags, name.pData, 00210 typeName.pData)) 00211 { 00212 throw std::bad_alloc(); 00213 } 00214 } 00215 00229 void setMethodExceptionTypeName( 00230 sal_uInt16 methodIndex, sal_uInt16 exceptionIndex, 00231 rtl::OUString const & typeName) 00232 { 00233 if (!typereg_writer_setMethodExceptionTypeName( 00234 m_handle, methodIndex, exceptionIndex, typeName.pData)) 00235 { 00236 throw std::bad_alloc(); 00237 } 00238 } 00239 00256 void setReferenceData( 00257 sal_uInt16 index, rtl::OUString const & documentation, 00258 RTReferenceType sort, RTFieldAccess flags, 00259 rtl::OUString const & typeName) 00260 { 00261 if (!typereg_writer_setReferenceData( 00262 m_handle, index, documentation.pData, sort, flags, 00263 typeName.pData)) 00264 { 00265 throw std::bad_alloc(); 00266 } 00267 } 00268 00281 void const * getBlob(sal_uInt32 * size) { 00282 void const * p = typereg_writer_getBlob(m_handle, size); 00283 if (p == 0) { 00284 throw std::bad_alloc(); 00285 } 00286 return p; 00287 } 00288 00289 private: 00290 Writer(Writer &); // not implemented 00291 void operator =(Writer); // not implemented 00292 00293 void * m_handle; 00294 }; 00295 00296 } 00297 00298 #endif 00299 00300 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */