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  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_registry_writer_hxx
21 #define INCLUDED_registry_writer_hxx
22 
23 #include "registry/writer.h"
24 #include "registry/refltype.hxx"
25 #include "registry/types.h"
26 #include "registry/version.h"
27 
28 #include "rtl/ustring.hxx"
29 #include "sal/types.h"
30 
31 #include <new>
32 
33 namespace typereg {
34 
42 class Writer {
43 public:
73  typereg_Version version, rtl::OUString const & documentation,
74  rtl::OUString const & fileName, RTTypeClass typeClass, bool published,
75  rtl::OUString const & typeName, sal_uInt16 superTypeCount,
76  sal_uInt16 fieldCount, sal_uInt16 methodCount,
77  sal_uInt16 referenceCount):
78  m_handle(
80  version, documentation.pData, fileName.pData, typeClass,
81  published, typeName.pData, superTypeCount, fieldCount,
82  methodCount, referenceCount))
83  {
84  if (m_handle == 0) {
85  throw std::bad_alloc();
86  }
87  }
88 
92  ~Writer() {
93  typereg_writer_destroy(m_handle);
94  }
95 
106  void setSuperTypeName(sal_uInt16 index, rtl::OUString const & typeName) {
107  if (!typereg_writer_setSuperTypeName(m_handle, index, typeName.pData)) {
108  throw std::bad_alloc();
109  }
110  }
111 
132  sal_uInt16 index, rtl::OUString const & documentation,
133  rtl::OUString const & fileName, RTFieldAccess flags, rtl::OUString const & name,
134  rtl::OUString const & typeName, RTConstValue const & value)
135  {
137  m_handle, index, documentation.pData, fileName.pData, flags,
138  name.pData, typeName.pData, value.m_type, value.m_value))
139  {
140  throw std::bad_alloc();
141  }
142  }
143 
164  sal_uInt16 index, rtl::OUString const & documentation,
165  RTMethodMode flags, rtl::OUString const & name,
166  rtl::OUString const & returnTypeName, sal_uInt16 parameterCount,
167  sal_uInt16 exceptionCount)
168  {
170  m_handle, index, documentation.pData, flags, name.pData,
171  returnTypeName.pData, parameterCount, exceptionCount))
172  {
173  throw std::bad_alloc();
174  }
175  }
176 
195  sal_uInt16 methodIndex, sal_uInt16 parameterIndex,
196  RTParamMode flags, rtl::OUString const & name,
197  rtl::OUString const & typeName)
198  {
200  m_handle, methodIndex, parameterIndex, flags, name.pData,
201  typeName.pData))
202  {
203  throw std::bad_alloc();
204  }
205  }
206 
221  sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
222  rtl::OUString const & typeName)
223  {
225  m_handle, methodIndex, exceptionIndex, typeName.pData))
226  {
227  throw std::bad_alloc();
228  }
229  }
230 
248  sal_uInt16 index, rtl::OUString const & documentation,
249  RTReferenceType sort, RTFieldAccess flags,
250  rtl::OUString const & typeName)
251  {
253  m_handle, index, documentation.pData, sort, flags,
254  typeName.pData))
255  {
256  throw std::bad_alloc();
257  }
258  }
259 
272  void const * getBlob(sal_uInt32 * size) {
273  void const * p = typereg_writer_getBlob(m_handle, size);
274  if (p == 0) {
275  throw std::bad_alloc();
276  }
277  return p;
278  }
279 
280 private:
281  Writer(Writer &); // not implemented
282  void operator =(Writer); // not implemented
283 
284  void * m_handle;
285 };
286 
287 }
288 
289 #endif
290 
291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */