LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / include / comphelper / attributelist.hxx
blob0309ab60855edc4a9c60d173386fee00a3cc287a
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 #ifndef INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
21 #define INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
23 #include <sal/config.h>
25 #include <memory>
26 #include <vector>
28 #include <com/sun/star/util/XCloneable.hpp>
29 #include <com/sun/star/xml/sax/XAttributeList.hpp>
30 #include <cppuhelper/implbase.hxx>
31 #include <comphelper/comphelperdllapi.h>
33 namespace comphelper
36 struct TagAttribute
38 OUString sName;
39 OUString sType;
40 OUString sValue;
43 class COMPHELPER_DLLPUBLIC AttributeList final :
44 public ::cppu::WeakImplHelper<css::xml::sax::XAttributeList, css::util::XCloneable>
46 std::vector<TagAttribute> mAttributes;
47 public:
48 AttributeList();
49 AttributeList(const AttributeList &r);
51 virtual ~AttributeList() override;
53 // methods that are not contained in any interface
54 void AddAttribute(const OUString &sName , const OUString &sType , const OUString &sValue)
56 mAttributes.push_back({sName, sType, sValue});
58 void Clear()
60 mAttributes.clear();
63 // css::xml::sax::XAttributeList
64 virtual sal_Int16 SAL_CALL getLength() override
66 return static_cast<sal_Int16>(mAttributes.size());
68 virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) override
70 return mAttributes[i].sName;
72 virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) override
74 return mAttributes[i].sType;
76 virtual OUString SAL_CALL getTypeByName(const OUString& aName) override;
77 virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override
79 return mAttributes[i].sValue;
81 virtual OUString SAL_CALL getValueByName(const OUString& aName) override;
83 // css::util::XCloneable
84 virtual css::uno::Reference< XCloneable > SAL_CALL
85 createClone() override;
88 } // namespace comphelper
90 #endif // INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */