This file is indexed.

/usr/include/cxxtools/xml/startelement.h is in libcxxtools-dev 2.0-4ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
/*
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * As a special exception, you may use this file as part of a free
 * software library without restriction. Specifically, if other files
 * instantiate templates or use macros or inline functions from this
 * file, or you compile this file and link it with other files to
 * produce an executable, this file does not by itself cause the
 * resulting executable to be covered by the GNU General Public
 * License. This exception does not however invalidate any other
 * reasons why the executable file might be covered by the GNU Library
 * General Public License.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
#ifndef cxxtools_xml_StartElement_h
#define cxxtools_xml_StartElement_h

#include <cxxtools/xml/api.h>
#include <cxxtools/xml/node.h>
#include <cxxtools/xml/namespace.h>
#include <cxxtools/xml/namespacecontext.h>
#include <cxxtools/string.h>
#include <list>

namespace cxxtools {

namespace xml {

    /**
     * @brief A class representing a single attribute of a tag from an XML document.
     *
     * An XML attribute consists of the attribute's name and the attribute's value.
     * The name can be retrieved using the method name(). The value can be retrieved
     * using the method value().
     *
     * The attributes of a tag are retrieved from the document when the opening tag
     * is parsed. The attributes are stored in a StartElement object from where they
     * can be retrieved.
     */
    class CXXTOOLS_XML_API Attribute
    {
        public:
            //! Constructs a new Attribute object with an empty name and value.
            Attribute();

            /**
             * @brief Constructs a new Attribute using the given name and value.
             *
             * @param name The name of the XML attribute.
             * @param value The value of the XML attribute.
             */
            Attribute(const String& name, const String& value);

            //! Empty destructor
            virtual ~Attribute();

            /**
             * @brief Returns the name of this attribute.
             * @return The attribute's name.
             */
            const String& name() const
            {return _name;}

            String& name()
            {return _name;}

            /**
             * @brief Sets the name of this attribute.
             * @param name The new name of this attribute.
             */
            void setName(const String name)
            {_name = name;}

            /**
             * @brief Returns the value of this attribute.
             * @return The attribute's value.
             */
            const String& value() const
            {return _value;}

            String& value()
            {return _value;}

            /**
             * @brief Sets the value of this attribute.
             * @param value The new value of this attribute.
             */
            void setValue(const String value)
            {_value = value;}

            void clear()
            { _name.clear(); _value.clear(); }

        private:
            //! The name of this attribute.
            String _name;

            //! The value of this attribute.
            String _value;
    };


    /**
     * @brief A start element (Node) which represents an opening tag of an XML document.
     *
     * A start element is created when the parser reaches a start tag, for example $&lt;a>$.
     * A StartElement object not only stores the name of the tag and its namespace information,
     * but also stores the attributes of the tag. These attributes can be accessed by calling
     * attributes(), attribute() and hasAttribute().
     *
     * Use name() to get the name of the tag which was closed.
     *
     * When parsing $<a>test</a>$ a StartElement, a Character and finally an EndElement node is
     * created. If an empty tag is parsed, like for example $</a>$, a StartElement and an EndElement
     * is created.
     *
     * @see EndElement
     * @see Node
     * @see Attribute
     */
    class CXXTOOLS_XML_API StartElement : public Node
    {
        public:
            //! Constructs a new StartElement object with no name and an empty attribute list.
            StartElement();

            /**
             * @brief Constructs a new StartElement object with the given string as tag name.
             *
             * @param name The name of the EndElement object. This is an optional parameter.
             * Default is an empty string.
             */
            StartElement(const String& name);

            //! Empty destructor
            ~StartElement();

            /**
             * @brief Clones this StartElement object by creating a duplicate on the heap and returning it.
             * @return A cloned version of this StartElement object.
             */
            StartElement* clone() const
            {return new StartElement(*this);}


            void clear()
            {
                _name.clear();
                _attributes.clear();
            }

            /**
             * @brief Returns the tag name of the opening tag for which this StartElement object was created.
             *
             * When parsing <a>test</a> a StartElement, a Character and finally an EndElement node is
             * created. The StartElement has the name "a". If an empty tag is parsed, like for example </a>,
             * only a StartElement and an EndElement ("a") is created.
             *
             * @return The tag name of the opening tag for which this StartElement object was created.
             */
            String& name() {return _name;}

            /**
             * @brief Returns the tag name of the opening tag for which this StartElement object was created.
             *
             * When parsing <a>test</a> a StartElement, a Character and finally an EndElement node is
             * created. The StartElement has the name "a". If an empty tag is parsed, like for example </a>,
             * only a StartElement and an EndElement ("a") is created.
             *
             * @return The tag name of the opening tag for which this StartElement object was created.
             */
            const String& name() const
            {return _name;}

            /**
             * @brief Sets the tag name of the end start for which this StartElement object was created.
             * @param name The new name for this StartElement object.
             */
            void setName(const String name)
            {_name = name;}

            /**
             * @brief Add the given attribute to the attribute list of this start tag.
             *
             * This StartElement object holds a list of attributes, which consist of the attribute name
             * and the attribute value. The attributes can be read using attributes() or attribute().
             *
             * @param attribute The attribute which is added to this object's attribute list.
             */
            void addAttribute(const Attribute& attribute)
            {_attributes.push_back(attribute);}

            /**
             * @brief Returns the attribute list of this StartElement which contains all attributes of the tag.
             *
             * This StartElement object holds a list of attributes, which consist of the attribute name
             * and the attribute value. This method returns all attributes of the represented tag. The list
             * can be iterated using a iterator. To access a specific attribute the method attribute() can be
             * used.
             *
             * @return A list containing all attributes of the tag this StartElement represents.
             */
            const std::list<Attribute>& attributes() const
            {return _attributes;}

            /**
             * @brief Returns the value of the attribute with the given name.
             *
             * This StartElement object holds a list of attributes, which consist of the attribute name
             * and the attribute value. This methods returns the value of a single attribute. To access
             * all attributes of this StartElement the method attributes() can be used.
             *
             * If no attribute with the given name exists, an empty string is returned.
             *
             * @param attributeName The value of the attribute with this name is returned.
             * @return The value of the request attribute; or an empty string if there is no attribute
             * with this name.
             */
            const String& attribute(const String attributeName) const;

            /**
             * @return Checks if the StartElement has an attribute with the given name.
             *
             * This method returns $true$ if an attribute with the given name exists in this
             * StartElement. If no attribute with this name exist $false$ is returned.
             *
             * @param attributeName It is checked if an attribute with this attribute name exists.
             * @return $true$ if an attribute with this name exists; $false$ otherwise.
             */
            bool hasAttribute(const String attributeName) const;

            /**
             * @brief Returns the namespace conText of this StartElement.
             *
             * @return NamespaceContext The namespace conText of this StartElment.
             * @see NamespaceContext
             */
            const NamespaceContext& namespaceContext() const
            {return _namespaceContext;}

            /**
             * @brief Sets the namespace conText for this StartElement.
             *
             * @param conText The new namespace conText for this StartElment.
             * @see NamespaceContext
             */
            void setNamespaceContext(const NamespaceContext& conText)
            {_namespaceContext = conText;}

            /**
             * @brief Returns the namespace uri for the given tag prefix in this StartElments namespace conText.
             *
             * The namespace uri is determined using the method NamespaceContext::namespaceUri().
             * If no namespace uri exists for this prefix an empty string is returned.
             *
             * @param prefix The prefix for which the namespace uri is returned.
             * @return The namespace uri for the given prefix; or an empty string if no namespace uri exists
             * for this prefix.
             */
            const String& namespaceUri(const String& prefix) const
            {return _namespaceContext.namespaceUri(prefix);}

            /**
             * @brief Compares this StartElement object with the given node.
             *
             * This method returns $true$ if the given node also is a StartElement object and
             * the content of both StartElement objects is the same. Otherwise it returns $false$.
             *
             * @param node This Node object is compared to the current StartElement node object.
             * @return $true if this StartElement object is the same as the given node.
             */
            virtual bool operator==(const Node& node) const;

        private:
            //! The name of the underlying tag.
            String _name;

            //! The list which contains all attributes of the underlying tag.
            std::list<Attribute> _attributes;

            //! The namespace conText of this StartElement.
            NamespaceContext _namespaceContext;
    };

}

}

#endif