1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "SvXMLAttrCollection.hxx"
21 #include <xmloff/xmlcnimp.hxx>
22 #include <rtl/ustring.hxx>
24 SvXMLAttrContainerData::SvXMLAttrContainerData() : m_pImpl( new SvXMLAttrCollection
)
28 SvXMLAttrContainerData::SvXMLAttrContainerData(const SvXMLAttrContainerData
&rCopy
) :
29 m_pImpl( new SvXMLAttrCollection( *(rCopy
.m_pImpl
) ) )
33 SvXMLAttrContainerData
& SvXMLAttrContainerData::operator=(const SvXMLAttrContainerData
&rCopy
)
35 m_pImpl
.reset( new SvXMLAttrCollection( *rCopy
.m_pImpl
) );
39 SvXMLAttrContainerData
& SvXMLAttrContainerData::operator=(SvXMLAttrContainerData
&& rCopy
) noexcept
41 m_pImpl
= std::move( rCopy
.m_pImpl
);
45 // Need destructor defined (despite it being empty) to avoid "checked_delete"
47 SvXMLAttrContainerData::~SvXMLAttrContainerData()
51 bool SvXMLAttrContainerData::operator ==( const SvXMLAttrContainerData
& rCmp
) const
53 return ( *(rCmp
.m_pImpl
) == *m_pImpl
);
56 bool SvXMLAttrContainerData::AddAttr( const OUString
& rLName
,
57 const OUString
& rValue
)
59 assert( !rLName
.isEmpty() && "empty attribute name is invalid");
60 assert( rLName
.indexOf(':') == -1 && "colon in name?");
61 return m_pImpl
->AddAttr(rLName
, rValue
);
64 bool SvXMLAttrContainerData::AddAttr( const OUString
& rPrefix
,
65 const OUString
& rNamespace
,
66 const OUString
& rLName
,
67 const OUString
& rValue
)
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 m_pImpl
->AddAttr(rPrefix
, rNamespace
, rLName
, rValue
);
75 bool SvXMLAttrContainerData::AddAttr( const OUString
& rPrefix
,
76 const OUString
& rLName
,
77 const OUString
& rValue
)
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 m_pImpl
->AddAttr(rPrefix
, rLName
, rValue
);
85 bool SvXMLAttrContainerData::SetAt( size_t i
,
86 const OUString
& rLName
,
87 const OUString
& rValue
)
89 assert( !rLName
.isEmpty() && "empty attribute name is invalid");
90 assert( rLName
.indexOf(':') == -1 && "colon in name?");
91 return m_pImpl
->SetAt(i
, rLName
, rValue
);
94 bool SvXMLAttrContainerData::SetAt( size_t i
,
95 const OUString
& rPrefix
,
96 const OUString
& rNamespace
,
97 const OUString
& rLName
,
98 const OUString
& rValue
)
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 m_pImpl
->SetAt(i
, rPrefix
, rNamespace
, rLName
, rValue
);
106 bool SvXMLAttrContainerData::SetAt( size_t i
,
107 const OUString
& rPrefix
,
108 const OUString
& rLName
,
109 const OUString
& rValue
)
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 m_pImpl
->SetAt(i
, rPrefix
, rLName
, rValue
);
117 void SvXMLAttrContainerData::Remove( size_t i
)
122 size_t SvXMLAttrContainerData::GetAttrCount() const
124 return m_pImpl
->GetAttrCount();
127 const OUString
& SvXMLAttrContainerData::GetAttrLName(size_t i
) const
129 return m_pImpl
->GetAttrLName(i
);
132 const OUString
& SvXMLAttrContainerData::GetAttrValue(size_t i
) const
134 return m_pImpl
->GetAttrValue(i
);
137 OUString
SvXMLAttrContainerData::GetAttrNamespace( size_t i
) const
139 return m_pImpl
->GetAttrNamespace(i
);
142 OUString
SvXMLAttrContainerData::GetAttrPrefix( size_t i
) const
144 return m_pImpl
->GetAttrPrefix(i
);
147 const OUString
& SvXMLAttrContainerData::GetNamespace( sal_uInt16 i
) const
149 return m_pImpl
->GetNamespace(i
);
152 const OUString
& SvXMLAttrContainerData::GetPrefix( sal_uInt16 i
) const
154 return m_pImpl
->GetPrefix(i
);
157 sal_uInt16
SvXMLAttrContainerData::GetFirstNamespaceIndex() const
159 return m_pImpl
->GetFirstNamespaceIndex();
162 sal_uInt16
SvXMLAttrContainerData::GetNextNamespaceIndex( sal_uInt16 nIdx
) const
164 return m_pImpl
->GetNextNamespaceIndex( nIdx
);
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */