This file is indexed.

/usr/include/gloox/dataform.h is in libgloox-dev 1.0.9-2.

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
/*
  Copyright (c) 2005-2013 by Jakob Schroeter <js@camaya.net>
  This file is part of the gloox library. http://camaya.net/gloox

  This software is distributed under a license. The full license
  agreement can be found in the file LICENSE in this distribution.
  This software may not be copied, modified, sold or distributed
  other than expressed in the named license agreement.

  This software is distributed without any warranty.
*/


#ifndef DATAFORM_H__
#define DATAFORM_H__

#include "dataformfieldcontainer.h"
#include "stanzaextension.h"

#include <string>
#include <list>

namespace gloox
{

  class Tag;
  class DataFormItem;
  class DataFormReported;

  /**
   * Describes the possible Form Types.
   */
  enum FormType
  {
    TypeForm,                     /**< The forms-processing entity is asking the forms-submitting
                                    * entity to complete a form. */
    TypeSubmit,                   /**< The forms-submitting entity is submitting data to the
                                    * forms-processing entity. */
    TypeCancel,                   /**< The forms-submitting entity has cancelled submission of data
                                    * to the forms-processing entity. */
    TypeResult,                   /**< The forms-processing entity is returning data (e.g., search
                                    * results) to the forms-submitting entity, or the data is a
                                    * generic data set. */
    TypeInvalid                   /**< The form is invalid. Only possible if the form was created
                                    * from an Tag which doesn't correctly describe a Data Form. */
  };

  /**
   * @brief An abstraction of a @xep{0004} Data Form.
   *
   *
   *
   * @author Jakob Schroeter <js@camaya.net>
   * @since 0.7
   */
  class GLOOX_API DataForm : public StanzaExtension, public DataFormFieldContainer
  {
    public:
      /**
       * A list of DataFormItems.
       */
      typedef std::list<DataFormItem*> ItemList;

      /**
       * Constructs a new, empty form.
       * @param type The form type.
       * @param instructions Natural-language instructions for filling out the form. Should not contain
       * newlines (\\n, \\r).
       * @param title The natural-language title of the form. Should not contain newlines (\\n, \\r).
       */
      DataForm( FormType type, const StringList& instructions, const std::string& title = EmptyString );

      /**
       * Constructs a new, empty form without any instructions or title set. Probably best suited for
       * result forms.
       * @param type The form type.
       * @param title The natural-language title of the form. Should not contain newlines (\\n, \\r).
       * @since 0.9
       */
      DataForm( FormType type, const std::string& title = EmptyString );

      /**
       * Constructs a new DataForm from an existing Tag/XML representation.
       * @param tag The existing form to parse.
       */
      DataForm( const Tag* tag );

      /**
       * Creates a new DataForm, copying the given one.
       * @param form The form to copy.
       */
      DataForm( const DataForm& form );

      /**
       * Virtual destructor.
       */
      virtual ~DataForm();

      /**
       * Use this function to retrieve the title of the form.
       * @return The title of the form.
       */
      const std::string& title() const { return m_title; }

      /**
       * Use this function to set the title of the form.
       * @param title The new title of the form.
       * @note The title should not contain newlines (\\n, \\r).
       */
      void setTitle( const std::string& title ) { m_title = title; }

      /**
       * Retrieves the natural-language instructions for the form.
       * @return The fill-in instructions for the form.
       */
      const StringList& instructions() const { return m_instructions; }

      /**
       * Use this function to set natural-language instructions for the form.
       * @param instructions The instructions for the form.
       * @note The instructions should not contain newlines (\\n, \\r). Instead, every line should be an
       * element of the StringMap. This allows for platform dependent newline handling on the target
       * platform.
       */
      void setInstructions( const StringList& instructions ) { m_instructions = instructions; }

      /**
       * Returns the reported field list in a DataForm.
       * @return The reported section, containing 0..n fields.
       */
      const DataFormReported* reported() const { return m_reported; }

      /**
       * Returns a list of items in a DataForm.
       * @return A list of items.
       */
      const ItemList& items() const { return m_items; }

      /**
       * Returns the form's type.
       * @return The form's type.
       * @since 0.9
       */
      FormType type() const { return m_type; }

      /**
       * Sets the form's type.
       * @param type The form's new type.
       */
      void setType( FormType type ) { m_type = type; }

      /**
       * Parses the given Tag and creates an appropriate DataForm representation.
       * @param tag The Tag to parse.
       * @return @b True on success, @b false otherwise.
       * @since 0.9
       */
      bool parse( const Tag* tag );

      /**
       * Converts to  @b true if the DataForm is valid, @b false otherwise.
       */
      operator bool() const { return m_type != TypeInvalid; }

      // reimplemented from StanzaExtension
      virtual const std::string& filterString() const;

      // reimplemented from StanzaExtension
      virtual StanzaExtension* newInstance( const Tag* tag ) const
      {
        return new DataForm( tag );
      }

      // reimplemented from StanzaExtension
      virtual Tag* tag() const;

      // reimplemented from StanzaExtension
      virtual StanzaExtension* clone() const
      {
        return new DataForm( *this );
      }

    protected:
      FormType m_type;

    private:
      StringList m_instructions;

      std::string m_title;
      DataFormReported* m_reported;
      ItemList m_items;

  };

}

#endif // DATAFORM_H__