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