/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
void FastAttributeList::add( const FastAttributeList& rOther )
{ for (size_t i=0; i < rOther.maAttributeTokens.size(); ++i)
add(rOther.maAttributeTokens[i], rOther.getAsViewByIndex(i)); for (constauto & i : rOther.maUnknownAttributes)
addUnknown(i.maNamespaceURL, i.maName, i.maValue);
}
// XFastAttributeList
sal_Bool FastAttributeList::hasAttribute( ::sal_Int32 Token )
{ for (sal_Int32 i : maAttributeTokens) if (i == Token) returntrue;
returnfalse;
}
sal_Int32 FastAttributeList::getValueToken( ::sal_Int32 Token )
{ for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i) if (maAttributeTokens[i] == Token) return getValueTokenByIndex(i);
sal_Int32 FastAttributeList::getOptionalValueToken( ::sal_Int32 Token, ::sal_Int32 Default )
{ for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i) if (maAttributeTokens[i] == Token) return getValueTokenByIndex(i);
returnDefault;
}
// performance sensitive shortcuts to avoid allocation ... bool FastAttributeList::getAsInteger( sal_Int32 nToken, sal_Int32 &rInt) const
{
rInt = 0; for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i) if (maAttributeTokens[i] == nToken)
{
rInt = getAsIntegerByIndex(i); returntrue;
} returnfalse;
}
bool FastAttributeList::getAsDouble( sal_Int32 nToken, double &rDouble) const
{
rDouble = 0.0; for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i) if (maAttributeTokens[i] == nToken)
{
rDouble = o3tl::toDouble(getAsViewByIndex(i)); returntrue;
} returnfalse;
}
bool FastAttributeList::getAsView( sal_Int32 nToken, std::string_view& rPos ) const
{ for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i)
{ if (maAttributeTokens[i] != nToken) continue;
rPos = getAsViewByIndex(i); returntrue;
}
returnfalse;
}
OUString FastAttributeList::getValue( ::sal_Int32 Token )
{ for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i) if (maAttributeTokens[i] == Token) return getValueByIndex(i);
OUString FastAttributeList::getOptionalValue( ::sal_Int32 Token )
{ for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i) if (maAttributeTokens[i] == Token) return getValueByIndex(i);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.