LibreOffice Module xmloff (master)  1
xmlcnimp.cxx
Go to the documentation of this file.
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 "SvXMLAttrCollection.hxx"
21 #include <xmloff/xmlcnimp.hxx>
22 #include <rtl/ustring.hxx>
23 
25 {
26 }
27 
29  pimpl( new SvXMLAttrCollection( *(rCopy.pimpl) ) )
30 {
31 }
32 
34 {
35  pimpl.reset( new SvXMLAttrCollection( *rCopy.pimpl ) );
36  return *this;
37 }
38 
40 {
41  pimpl = std::move( rCopy.pimpl );
42  return *this;
43 }
44 
45 // Need destructor defined (despite it being empty) to avoid "checked_delete"
46 // compiler errors.
48 {
49 }
50 
52 {
53  return ( *(rCmp.pimpl) == *pimpl );
54 }
55 
56 bool SvXMLAttrContainerData::AddAttr( const OUString& rLName,
57  const OUString& rValue )
58 {
59  assert( !rLName.isEmpty() && "empty attribute name is invalid");
60  assert( rLName.indexOf(':') == -1 && "colon in name?");
61  return pimpl->AddAttr(rLName, rValue);
62 }
63 
64 bool SvXMLAttrContainerData::AddAttr( const OUString& rPrefix,
65  const OUString& rNamespace,
66  const OUString& rLName,
67  const OUString& rValue )
68 {
69  assert( !rLName.isEmpty() && "empty attribute name is invalid");
70  assert( rPrefix.indexOf(':') == -1 && "colon in prefix?");
71  assert( rLName.indexOf(':') == -1 && "colon in name?");
72  return pimpl->AddAttr(rPrefix, rNamespace, rLName, rValue);
73 }
74 
75 bool SvXMLAttrContainerData::AddAttr( const OUString& rPrefix,
76  const OUString& rLName,
77  const OUString& rValue )
78 {
79  assert( !rLName.isEmpty() && "empty attribute name is invalid");
80  assert( rPrefix.indexOf(':') == -1 && "colon in prefix?");
81  assert( rLName.indexOf(':') == -1 && "colon in name?");
82  return pimpl->AddAttr(rPrefix, rLName, rValue);
83 }
84 
86  const OUString& rLName,
87  const OUString& rValue )
88 {
89  assert( !rLName.isEmpty() && "empty attribute name is invalid");
90  assert( rLName.indexOf(':') == -1 && "colon in name?");
91  return pimpl->SetAt(i, rLName, rValue);
92 }
93 
95  const OUString& rPrefix,
96  const OUString& rNamespace,
97  const OUString& rLName,
98  const OUString& rValue )
99 {
100  assert( !rLName.isEmpty() && "empty attribute name is invalid");
101  assert( rPrefix.indexOf(':') == -1 && "colon in prefix?");
102  assert( rLName.indexOf(':') == -1 && "colon in name?");
103  return pimpl->SetAt(i, rPrefix, rNamespace, rLName, rValue);
104 }
105 
107  const OUString& rPrefix,
108  const OUString& rLName,
109  const OUString& rValue )
110 {
111  assert( !rLName.isEmpty() && "empty attribute name is invalid");
112  assert( rPrefix.indexOf(':') == -1 && "colon in prefix?");
113  assert( rLName.indexOf(':') == -1 && "colon in name?");
114  return pimpl->SetAt(i, rPrefix, rLName, rValue);
115 }
116 
118 {
119  pimpl->Remove(i);
120 }
121 
123 {
124  return pimpl->GetAttrCount();
125 }
126 
127 const OUString& SvXMLAttrContainerData::GetAttrLName(size_t i) const
128 {
129  return pimpl->GetAttrLName(i);
130 }
131 
132 const OUString& SvXMLAttrContainerData::GetAttrValue(size_t i) const
133 {
134  return pimpl->GetAttrValue(i);
135 }
136 
138 {
139  return pimpl->GetAttrNamespace(i);
140 }
141 
142 OUString SvXMLAttrContainerData::GetAttrPrefix( size_t i ) const
143 {
144  return pimpl->GetAttrPrefix(i);
145 }
146 
147 const OUString& SvXMLAttrContainerData::GetNamespace( sal_uInt16 i ) const
148 {
149  return pimpl->GetNamespace(i);
150 }
151 
152 const OUString& SvXMLAttrContainerData::GetPrefix( sal_uInt16 i ) const
153 {
154  return pimpl->GetPrefix(i);
155 }
156 
158 {
159  return pimpl->GetFirstNamespaceIndex();
160 }
161 
162 sal_uInt16 SvXMLAttrContainerData::GetNextNamespaceIndex( sal_uInt16 nIdx ) const
163 {
164  return pimpl->GetNextNamespaceIndex( nIdx );
165 }
166 
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvXMLAttrContainerData & operator=(const SvXMLAttrContainerData &rCmp)
Definition: xmlcnimp.cxx:33
OUString GetAttrPrefix(size_t i) const
Definition: xmlcnimp.cxx:142
size_t GetAttrCount() const
Definition: xmlcnimp.cxx:122
const OUString & GetNamespace(sal_uInt16 i) const
Definition: xmlcnimp.cxx:147
OUString GetAttrNamespace(size_t i) const
Definition: xmlcnimp.cxx:137
sal_uInt16 GetFirstNamespaceIndex() const
Definition: xmlcnimp.cxx:157
sal_uInt16 GetNextNamespaceIndex(sal_uInt16 nIdx) const
Definition: xmlcnimp.cxx:162
void Remove(size_t i)
Definition: xmlcnimp.cxx:117
bool operator==(const SvXMLAttrContainerData &rCmp) const
Definition: xmlcnimp.cxx:51
const OUString & GetPrefix(sal_uInt16 i) const
Definition: xmlcnimp.cxx:152
std::unique_ptr< SvXMLAttrCollection > pimpl
Definition: xmlcnimp.hxx:33
const OUString & GetAttrValue(size_t i) const
Definition: xmlcnimp.cxx:132
bool AddAttr(const OUString &rLName, const OUString &rValue)
Definition: xmlcnimp.cxx:56
const OUString & GetAttrLName(size_t i) const
Definition: xmlcnimp.cxx:127
bool SetAt(size_t i, const OUString &rLName, const OUString &rValue)
Definition: xmlcnimp.cxx:85