My Project
UDK 3.2.7 C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
writer.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org. If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 
29 #ifndef INCLUDED_registry_writer_hxx
30 #define INCLUDED_registry_writer_hxx
31 
32 #include "registry/writer.h"
33 #include "registry/refltype.hxx"
34 #include "registry/types.h"
35 #include "registry/version.h"
36 
37 #include "rtl/ustring.hxx"
38 #include "sal/types.h"
39 
40 #include <new>
41 
42 namespace typereg {
43 
51 class Writer {
52 public:
82  typereg_Version version, rtl::OUString const & documentation,
83  rtl::OUString const & fileName, RTTypeClass typeClass, bool published,
84  rtl::OUString const & typeName, sal_uInt16 superTypeCount,
85  sal_uInt16 fieldCount, sal_uInt16 methodCount,
86  sal_uInt16 referenceCount):
87  m_handle(
89  version, documentation.pData, fileName.pData, typeClass,
90  published, typeName.pData, superTypeCount, fieldCount,
91  methodCount, referenceCount))
92  {
93  if (m_handle == 0) {
94  throw std::bad_alloc();
95  }
96  }
97 
102  typereg_writer_destroy(m_handle);
103  }
104 
115  void setSuperTypeName(sal_uInt16 index, rtl::OUString const & typeName) {
116  if (!typereg_writer_setSuperTypeName(m_handle, index, typeName.pData)) {
117  throw std::bad_alloc();
118  }
119  }
120 
141  sal_uInt16 index, rtl::OUString const & documentation,
142  rtl::OUString const & fileName, RTFieldAccess flags, rtl::OUString const & name,
143  rtl::OUString const & typeName, RTConstValue const & value)
144  {
146  m_handle, index, documentation.pData, fileName.pData, flags,
147  name.pData, typeName.pData, value.m_type, value.m_value))
148  {
149  throw std::bad_alloc();
150  }
151  }
152 
173  sal_uInt16 index, rtl::OUString const & documentation,
174  RTMethodMode flags, rtl::OUString const & name,
175  rtl::OUString const & returnTypeName, sal_uInt16 parameterCount,
176  sal_uInt16 exceptionCount)
177  {
179  m_handle, index, documentation.pData, flags, name.pData,
180  returnTypeName.pData, parameterCount, exceptionCount))
181  {
182  throw std::bad_alloc();
183  }
184  }
185 
204  sal_uInt16 methodIndex, sal_uInt16 parameterIndex,
205  RTParamMode flags, rtl::OUString const & name,
206  rtl::OUString const & typeName)
207  {
209  m_handle, methodIndex, parameterIndex, flags, name.pData,
210  typeName.pData))
211  {
212  throw std::bad_alloc();
213  }
214  }
215 
230  sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
231  rtl::OUString const & typeName)
232  {
234  m_handle, methodIndex, exceptionIndex, typeName.pData))
235  {
236  throw std::bad_alloc();
237  }
238  }
239 
257  sal_uInt16 index, rtl::OUString const & documentation,
258  RTReferenceType sort, RTFieldAccess flags,
259  rtl::OUString const & typeName)
260  {
262  m_handle, index, documentation.pData, sort, flags,
263  typeName.pData))
264  {
265  throw std::bad_alloc();
266  }
267  }
268 
281  void const * getBlob(sal_uInt32 * size) {
282  void const * p = typereg_writer_getBlob(m_handle, size);
283  if (p == 0) {
284  throw std::bad_alloc();
285  }
286  return p;
287  }
288 
289 private:
290  Writer(Writer &); // not implemented
291  void operator =(Writer); // not implemented
292 
293  void * m_handle;
294 };
295 
296 }
297 
298 #endif
299 
300 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */