LibreOffice Module comphelper (master) 1
attributelist.hxx
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#ifndef INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
21#define INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
22
23#include <sal/config.h>
24
25#include <memory>
26#include <vector>
27
28#include <com/sun/star/util/XCloneable.hpp>
29#include <com/sun/star/xml/sax/XAttributeList.hpp>
32
33namespace comphelper
34{
35
37{
38 OUString sName;
39 OUString sType;
40 OUString sValue;
41};
42
44 public ::cppu::WeakImplHelper<css::xml::sax::XAttributeList, css::util::XCloneable>
45{
46 std::vector<TagAttribute> mAttributes;
47public:
50
51 virtual ~AttributeList() override;
52
53 // methods that are not contained in any interface
54 void AddAttribute(const OUString &sName , const OUString &sType , const OUString &sValue)
55 {
56 mAttributes.push_back({sName, sType, sValue});
57 }
58 void Clear()
59 {
60 mAttributes.clear();
61 }
62
63 // css::xml::sax::XAttributeList
64 virtual sal_Int16 SAL_CALL getLength() override
65 {
66 return static_cast<sal_Int16>(mAttributes.size());
67 }
68 virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) override
69 {
70 return mAttributes[i].sName;
71 }
72 virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) override
73 {
74 return mAttributes[i].sType;
75 }
76 virtual OUString SAL_CALL getTypeByName(const OUString& aName) override;
77 virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override
78 {
79 return mAttributes[i].sValue;
80 }
81 virtual OUString SAL_CALL getValueByName(const OUString& aName) override;
82
83 // css::util::XCloneable
84 virtual css::uno::Reference< XCloneable > SAL_CALL
85 createClone() override;
86};
87
88} // namespace comphelper
89
90#endif // INCLUDED_COMPHELPER_ATTRIBUTELIST_HXX
91
92/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override
virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) override
virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) override
virtual sal_Int16 SAL_CALL getLength() override
void AddAttribute(const OUString &sName, const OUString &sType, const OUString &sValue)
std::vector< TagAttribute > mAttributes
#define COMPHELPER_DLLPUBLIC
const char * sName
int i
def getTypeByName(typeName)