|
UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /* 00003 * This file is part of the LibreOffice project. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 * 00009 * This file incorporates work covered by the following license notice: 00010 * 00011 * Licensed to the Apache Software Foundation (ASF) under one or more 00012 * contributor license agreements. See the NOTICE file distributed 00013 * with this work for additional information regarding copyright 00014 * ownership. The ASF licenses this file to you under the Apache 00015 * License, Version 2.0 (the "License"); you may not use this file 00016 * except in compliance with the License. You may obtain a copy of 00017 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 00018 */ 00019 00020 #ifndef INCLUDED_registry_writer_hxx 00021 #define INCLUDED_registry_writer_hxx 00022 00023 #include "registry/writer.h" 00024 #include "registry/refltype.hxx" 00025 #include "registry/types.h" 00026 #include "registry/version.h" 00027 00028 #include "rtl/ustring.hxx" 00029 #include "sal/types.h" 00030 00031 #include <new> 00032 00033 namespace typereg { 00034 00042 class Writer { 00043 public: 00072 Writer( 00073 typereg_Version version, rtl::OUString const & documentation, 00074 rtl::OUString const & fileName, RTTypeClass typeClass, bool published, 00075 rtl::OUString const & typeName, sal_uInt16 superTypeCount, 00076 sal_uInt16 fieldCount, sal_uInt16 methodCount, 00077 sal_uInt16 referenceCount): 00078 m_handle( 00079 typereg_writer_create( 00080 version, documentation.pData, fileName.pData, typeClass, 00081 published, typeName.pData, superTypeCount, fieldCount, 00082 methodCount, referenceCount)) 00083 { 00084 if (m_handle == 0) { 00085 throw std::bad_alloc(); 00086 } 00087 } 00088 00092 ~Writer() { 00093 typereg_writer_destroy(m_handle); 00094 } 00095 00106 void setSuperTypeName(sal_uInt16 index, rtl::OUString const & typeName) { 00107 if (!typereg_writer_setSuperTypeName(m_handle, index, typeName.pData)) { 00108 throw std::bad_alloc(); 00109 } 00110 } 00111 00131 void setFieldData( 00132 sal_uInt16 index, rtl::OUString const & documentation, 00133 rtl::OUString const & fileName, RTFieldAccess flags, rtl::OUString const & name, 00134 rtl::OUString const & typeName, RTConstValue const & value) 00135 { 00136 if (!typereg_writer_setFieldData( 00137 m_handle, index, documentation.pData, fileName.pData, flags, 00138 name.pData, typeName.pData, value.m_type, value.m_value)) 00139 { 00140 throw std::bad_alloc(); 00141 } 00142 } 00143 00163 void setMethodData( 00164 sal_uInt16 index, rtl::OUString const & documentation, 00165 RTMethodMode flags, rtl::OUString const & name, 00166 rtl::OUString const & returnTypeName, sal_uInt16 parameterCount, 00167 sal_uInt16 exceptionCount) 00168 { 00169 if (!typereg_writer_setMethodData( 00170 m_handle, index, documentation.pData, flags, name.pData, 00171 returnTypeName.pData, parameterCount, exceptionCount)) 00172 { 00173 throw std::bad_alloc(); 00174 } 00175 } 00176 00194 void setMethodParameterData( 00195 sal_uInt16 methodIndex, sal_uInt16 parameterIndex, 00196 RTParamMode flags, rtl::OUString const & name, 00197 rtl::OUString const & typeName) 00198 { 00199 if (!typereg_writer_setMethodParameterData( 00200 m_handle, methodIndex, parameterIndex, flags, name.pData, 00201 typeName.pData)) 00202 { 00203 throw std::bad_alloc(); 00204 } 00205 } 00206 00220 void setMethodExceptionTypeName( 00221 sal_uInt16 methodIndex, sal_uInt16 exceptionIndex, 00222 rtl::OUString const & typeName) 00223 { 00224 if (!typereg_writer_setMethodExceptionTypeName( 00225 m_handle, methodIndex, exceptionIndex, typeName.pData)) 00226 { 00227 throw std::bad_alloc(); 00228 } 00229 } 00230 00247 void setReferenceData( 00248 sal_uInt16 index, rtl::OUString const & documentation, 00249 RTReferenceType sort, RTFieldAccess flags, 00250 rtl::OUString const & typeName) 00251 { 00252 if (!typereg_writer_setReferenceData( 00253 m_handle, index, documentation.pData, sort, flags, 00254 typeName.pData)) 00255 { 00256 throw std::bad_alloc(); 00257 } 00258 } 00259 00272 void const * getBlob(sal_uInt32 * size) { 00273 void const * p = typereg_writer_getBlob(m_handle, size); 00274 if (p == 0) { 00275 throw std::bad_alloc(); 00276 } 00277 return p; 00278 } 00279 00280 private: 00281 Writer(Writer &); // not implemented 00282 void operator =(Writer); // not implemented 00283 00284 void * m_handle; 00285 }; 00286 00287 } 00288 00289 #endif 00290 00291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1.7.3