Branch data Line data Source code
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 : : #include <rtl/alloc.h>
21 : :
22 : : #include "specialtypemanager.hxx"
23 : :
24 : : extern "C"
25 : : {
26 : : sal_Bool SAL_CALL initTypeMapper( const sal_Char* pRegName );
27 : : sal_uInt32 SAL_CALL getTypeBlop(const sal_Char* pTypeName, sal_uInt8** pBlop);
28 : : }
29 : :
30 : : using ::rtl::OString;
31 : 0 : SpecialTypeManager::SpecialTypeManager()
32 : : {
33 [ # # ][ # # ]: 0 : m_pImpl = new SpecialTypeManagerImpl();
34 [ # # ]: 0 : acquire();
35 : 0 : }
36 : :
37 : 0 : SpecialTypeManager::~SpecialTypeManager()
38 : : {
39 [ # # ]: 0 : release();
40 [ # # ]: 0 : }
41 : :
42 : 0 : void SpecialTypeManager::acquire()
43 : : {
44 : 0 : TypeManager::acquire();
45 : 0 : }
46 : :
47 : 0 : void SpecialTypeManager::release()
48 : : {
49 [ # # ]: 0 : if (0 == TypeManager::release())
50 : : {
51 [ # # ]: 0 : delete m_pImpl;
52 : : }
53 : 0 : }
54 : :
55 : 0 : sal_Bool SpecialTypeManager::init(const OString& registryName)
56 : : {
57 : 0 : return initTypeMapper( registryName.getStr() );
58 : : }
59 : :
60 : 0 : TypeReader SpecialTypeManager::getTypeReader(const OString& name)
61 : : {
62 : 0 : TypeReader reader;
63 : :
64 : 0 : sal_uInt8* pBlop = NULL;
65 : 0 : sal_uInt32 blopSize = 0;
66 : :
67 [ # # ][ # # ]: 0 : if ( (blopSize = getTypeBlop( name.getStr(), &pBlop)) > 0 )
68 : : {
69 [ # # ][ # # ]: 0 : reader = TypeReader(pBlop, blopSize, sal_True);
[ # # ]
70 : : }
71 : :
72 [ # # ]: 0 : if ( pBlop )
73 : : {
74 : 0 : rtl_freeMemory(pBlop);
75 : : }
76 : :
77 : 0 : return reader;
78 : : }
79 : :
80 : 0 : RTTypeClass SpecialTypeManager::getTypeClass(const OString& name)
81 : : {
82 [ # # ]: 0 : if (m_pImpl->m_t2TypeClass.count(name) > 0)
83 : : {
84 : 0 : return m_pImpl->m_t2TypeClass[name];
85 : : } else
86 : : {
87 : : }
88 : :
89 : 0 : return RT_TYPE_INVALID;
90 : : }
91 : :
92 : :
93 : :
94 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|