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