bump product version to 4.1.6.2
[LibreOffice.git] / unoxml / source / dom / documenttype.cxx
blob30a1e054c1edbd625603d583c13d1f59a25605f6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <documenttype.hxx>
22 #include <string.h>
24 #include <entitiesmap.hxx>
25 #include <notationsmap.hxx>
28 namespace DOM
31 CDocumentType::CDocumentType(
32 CDocument const& rDocument, ::osl::Mutex const& rMutex,
33 xmlDtdPtr const pDtd)
34 : CDocumentType_Base(rDocument, rMutex,
35 NodeType_DOCUMENT_TYPE_NODE, reinterpret_cast<xmlNodePtr>(pDtd))
36 , m_aDtdPtr(pDtd)
40 /**
41 A NamedNodeMap containing the general entities, both external and
42 internal, declared in the DTD.
44 Reference< XNamedNodeMap > SAL_CALL CDocumentType::getEntities() throw (RuntimeException)
46 ::osl::MutexGuard const g(m_rMutex);
48 Reference< XNamedNodeMap > aMap;
49 if (m_aDtdPtr != NULL)
51 aMap.set(new CEntitiesMap(this));
53 return aMap;
56 /**
57 The internal subset as a string, or null if there is none.
59 OUString SAL_CALL CDocumentType::getInternalSubset() throw (RuntimeException)
61 OSL_ENSURE(false,
62 "CDocumentType::getInternalSubset: not implemented (#i113683#)");
63 return OUString();
66 /**
67 The name of DTD; i.e., the name immediately following the DOCTYPE
68 keyword.
70 OUString SAL_CALL CDocumentType::getName() throw (RuntimeException)
72 ::osl::MutexGuard const g(m_rMutex);
74 OUString aName;
75 if (m_aDtdPtr != NULL)
77 aName = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->name), RTL_TEXTENCODING_UTF8);
79 return aName;
82 /**
83 A NamedNodeMap containing the notations declared in the DTD.
85 Reference< XNamedNodeMap > SAL_CALL CDocumentType::getNotations() throw (RuntimeException)
87 ::osl::MutexGuard const g(m_rMutex);
89 Reference< XNamedNodeMap > aMap;
90 if (m_aDtdPtr != NULL)
92 aMap.set(new CNotationsMap(this));
94 return aMap;
97 /**
98 The public identifier of the external subset.
100 OUString SAL_CALL CDocumentType::getPublicId() throw (RuntimeException)
102 ::osl::MutexGuard const g(m_rMutex);
104 OUString aId;
105 if (m_aDtdPtr != NULL)
107 aId = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->ExternalID), RTL_TEXTENCODING_UTF8);
109 return aId;
113 The system identifier of the external subset.
115 OUString SAL_CALL CDocumentType::getSystemId() throw (RuntimeException)
117 ::osl::MutexGuard const g(m_rMutex);
119 OUString aId;
120 if (m_aDtdPtr != NULL)
122 aId = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->SystemID), RTL_TEXTENCODING_UTF8);
124 return aId;
127 OUString SAL_CALL CDocumentType::getNodeName()throw (RuntimeException)
129 return getName();
132 OUString SAL_CALL CDocumentType::getNodeValue() throw (RuntimeException)
134 return OUString();
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */