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 <entity.hxx>
21 : :
22 : : #include <string.h>
23 : :
24 : :
25 : : namespace DOM
26 : : {
27 : :
28 : 0 : CEntity::CEntity(CDocument const& rDocument, ::osl::Mutex const& rMutex,
29 : : xmlEntityPtr const pEntity)
30 : : : CEntity_Base(rDocument, rMutex,
31 : : NodeType_ENTITY_NODE, reinterpret_cast<xmlNodePtr>(pEntity))
32 [ # # ]: 0 : , m_aEntityPtr(pEntity)
33 : : {
34 : 0 : }
35 : :
36 : 0 : bool CEntity::IsChildTypeAllowed(NodeType const nodeType)
37 : : {
38 [ # # ]: 0 : switch (nodeType) {
39 : : case NodeType_ELEMENT_NODE:
40 : : case NodeType_PROCESSING_INSTRUCTION_NODE:
41 : : case NodeType_COMMENT_NODE:
42 : : case NodeType_TEXT_NODE:
43 : : case NodeType_CDATA_SECTION_NODE:
44 : : case NodeType_ENTITY_REFERENCE_NODE:
45 : 0 : return true;
46 : : default:
47 : 0 : return false;
48 : : }
49 : : }
50 : :
51 : : /**
52 : : For unparsed entities, the name of the notation for the entity.
53 : : */
54 : 0 : OUString SAL_CALL CEntity::getNotationName() throw (RuntimeException)
55 : : {
56 : : OSL_ENSURE(false,
57 : : "CEntity::getNotationName: not implemented (#i113683#)");
58 : 0 : return OUString();
59 : : }
60 : :
61 : : /**
62 : : The public identifier associated with the entity, if specified.
63 : : */
64 : 0 : OUString SAL_CALL CEntity::getPublicId() throw (RuntimeException)
65 : : {
66 [ # # ]: 0 : ::osl::MutexGuard const g(m_rMutex);
67 : :
68 : 0 : OUString aID;
69 [ # # ]: 0 : if(m_aEntityPtr != NULL)
70 : : {
71 [ # # ]: 0 : aID = OUString((sal_Char*)m_aEntityPtr->ExternalID, strlen((char*)m_aEntityPtr->ExternalID), RTL_TEXTENCODING_UTF8);
72 : : }
73 [ # # ]: 0 : return aID;
74 : : }
75 : :
76 : : /**
77 : : The system identifier associated with the entity, if specified.
78 : : */
79 : 0 : OUString SAL_CALL CEntity::getSystemId() throw (RuntimeException)
80 : : {
81 [ # # ]: 0 : ::osl::MutexGuard const g(m_rMutex);
82 : :
83 : 0 : OUString aID;
84 [ # # ]: 0 : if(m_aEntityPtr != NULL)
85 : : {
86 [ # # ]: 0 : aID = OUString((sal_Char*)m_aEntityPtr->SystemID, strlen((char*)m_aEntityPtr->SystemID), RTL_TEXTENCODING_UTF8);
87 : : }
88 [ # # ]: 0 : return aID;
89 : : }
90 : 0 : OUString SAL_CALL CEntity::getNodeName()throw (RuntimeException)
91 : : {
92 [ # # ]: 0 : ::osl::MutexGuard const g(m_rMutex);
93 : :
94 : 0 : OUString aName;
95 [ # # ]: 0 : if (m_aNodePtr != NULL)
96 : : {
97 : 0 : const xmlChar* xName = m_aNodePtr->name;
98 [ # # ]: 0 : aName = OUString((sal_Char*)xName, strlen((char*)xName), RTL_TEXTENCODING_UTF8);
99 : : }
100 [ # # ]: 0 : return aName;
101 : : }
102 : 0 : OUString SAL_CALL CEntity::getNodeValue() throw (RuntimeException)
103 : : {
104 : 0 : return OUString();
105 : : }
106 : : }
107 : :
108 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|