This file is indexed.

/usr/include/tulip/CSVImportConfigurationWidget.h is in libtulip-dev 4.6.0dfsg-2+b5.

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
/*
 *
 * This file is part of Tulip (www.tulip-software.org)
 *
 * Authors: David Auber and the Tulip development Team
 * from LaBRI, University of Bordeaux
 *
 * Tulip 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 3
 * of the License, or (at your option) any later version.
 *
 * Tulip 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 General Public License for more details.
 *
 */
///@cond DOXYGEN_HIDDEN

#ifndef CSVIMPORTCONFIGURATIONWIDGET_H
#define CSVIMPORTCONFIGURATIONWIDGET_H

#include <QWidget>
#include <QValidator>
#include <QTableWidget>

#include <tulip/CSVContentHandler.h>
#include <tulip/tulipconf.h>

class QComboBox;
class QCheckBox;
class QValidator;
class QLineEdit;

namespace Ui {
class CSVImportConifgurationWidget;
}

namespace tlp {
class CSVParser;
class CSVImportParameters;
class CSVColumn;

/**
 * @brief Configuration widget for a property.
 */
class TLP_QT_SCOPE PropertyConfigurationWidget: public QWidget {
  Q_OBJECT
public:
  PropertyConfigurationWidget(unsigned int propertyNumber, const QString& propertyName, bool propertyNameIsEditable,
                              const std::string& PropertyType, QWidget* parent = NULL);
  /**
     * Return the selected property type. The property type is not the label displayed in the combobox but correspond to the Property::propertyTypename static string variable of the property class.
     */
  std::string getPropertyType() const;
  /**
    * @brief Change the type of the property. Use the PropertyClass::propertyTypename static var.
    **/
  void setPropertyType(const std::string& propertyType);

  QString getPropertyName() const;
  bool getPropertyUsed() const;
  /**
     *  @brief Set the property name validator. Use to chek if entered graph name is valid.
     */
  void setPropertyNameValidator(QValidator* validator);
  unsigned int getPropertyNumber() const;

  QLineEdit *getNameLineEdit() {
    return propertyNameLineEdit;
  }
  QComboBox *getTypeComboBox() {
    return propertyTypeComboBox;
  }

  QCheckBox *getCheckBox() {
    return usedCheckBox;
  }

private:
  void fillPropertyTypeComboBox();
  QLineEdit *propertyNameLineEdit;
  QComboBox *propertyTypeComboBox;
  QCheckBox *usedCheckBox;
  bool nameEditable;
  unsigned int propertyNumber;

private slots:
  void nameEditFinished();
  void useStateChanged(int state);

signals:
  void propertyNameChange(QString newName);
  void stateChange(bool state);
};

/**
 * @brief Check if the property name already exist in the property list.
 **/
class TLP_QT_SCOPE PropertyNameValidator: public QValidator {
public:
  PropertyNameValidator(const std::vector<PropertyConfigurationWidget*>& widgets,QObject*parent=NULL) :
    QValidator(parent), widgets(widgets) {
  }
  virtual ~PropertyNameValidator() {

  }

  /**
   * Validate the new property name. Check if any property does not have the same name
   */
  QValidator::State validate(QString & input, int & pos) const;

private:
  const std::vector<PropertyConfigurationWidget*>& widgets;
};

/**
* @brief Simple table preview of CSV file. Load in a QTableWidget the data send by a CSVContentHandler.
**/
class TLP_QT_SCOPE CSVTableWidget : public QTableWidget, public CSVContentHandler {
public:
  CSVTableWidget(QWidget* parent=NULL);
  void begin();
  void line(unsigned int row,const std::vector<std::string>& lineTokens);
  void end(unsigned int rowNumber, unsigned int columnNumber);
  /**
    * @brief Limit the line number of the preview. Need to parse the file again to take this limit in account.
    **/
  void setMaxPreviewLineNumber(unsigned int lineNumber) {
    maxLineNumber = lineNumber;
  }

  /**
    * @brief Get the preview line number.
    **/
  unsigned int getMaxPreviewLineNumber()const {
    return maxLineNumber;
  }

  unsigned int getFirstLineIndex() {
    return firstLineIndex;
  }

  void setFirstLineIndex(unsigned int index) {
    firstLineIndex = index;
  }

private:
  unsigned int maxLineNumber;
  unsigned int firstLineIndex;
};


/**
  * @brief Widget generating a CSVImportParameters object configuring the CSV import process.
  *
  * Use a CSV parser to fill this widget with previews and CSV file statistics like number of rows and columns.
  **/
class TLP_QT_SCOPE CSVImportConfigurationWidget : public QWidget, public CSVContentHandler {
  Q_OBJECT
public:
  CSVImportConfigurationWidget(QWidget *parent = NULL);
  ~CSVImportConfigurationWidget();
  void begin();
  void line(unsigned int row,const std::vector<std::string>& lineTokens);
  void end(unsigned int rowNumber, unsigned int columnNumber);

  /**
    * @brief Update the widget contents with the new file parser.
    **/
  void setNewParser(tlp::CSVParser *parser);

  /**
  * @brief Get the import parameters.
  *
  * Use this object to configure import process of the CSVImportGraph object.
  **/
  CSVImportParameters getImportParameters()const;

  bool eventFilter(QObject *, QEvent *);


protected:

  void updateWidget();

  std::vector<CSVColumn> getPropertiesToImport()const;

  void updateLineNumbers(bool resetValues);

  bool useFirstLineAsPropertyName()const;
  void setUseFirstLineAsPropertyName(bool useFirstLineAsHeader)const;
  unsigned int rowCount()const;
  unsigned int columnCount()const;


  /**
  *@brief The index of the first line to get in the file.
  *@brief A line number from 0 to LastLineIndex.
  **/
  unsigned int getFirstLineIndex()const;

  /**
    * @brief The index of the last line to take in the file.
    **/
  unsigned int getLastLineIndex()const;
  /**
    * @brief The index of the first imported line. This index change if user use the first line as column names.
    * The first imported line is the firstLineIndex but with the
    * By example if user want to import all lines but use the first line as column names this funnction will return 1 not 0.
    **/
  unsigned int getFirstImportedLineIndex()const;

  /**
   * Empty the properties list.
   */
  void clearPropertiesTypeList();
  /**
   * Add a property to the current property list.
   */
  void addPropertyToPropertyList(const std::string& propertyName, bool isEditable, const std::string& propertyType=std::string(""));

  /**
   * @brief Creates a property configuration widget.
   *
   * @param propertyNumber The property number.
   * @param propertyName The name of the property.
   * @param propertyNameIsEditable Whether the property's name is editable.
   * @param propertyType The type of the property.
   * @param parent This widget's parent.
   * @return :PropertyConfigurationWidget*
   **/
  virtual PropertyConfigurationWidget *createPropertyConfigurationWidget(unsigned int propertyNumber,
      const QString& propertyName, bool propertyNameIsEditable, const std::string& propertyType, QWidget* parent);

  /**
    * @brief Compute the name of the column. Return the first token fo the column if the first lline is used as header r Column_x xhere x is the column index.
    **/
  QString generateColumnName(unsigned int col)const;
  /**
    * @brief Compute the column data type. Take in account the first row only if it is not used as column label
    **/
  std::string getColumnType(unsigned int col)const;

  std::vector<PropertyConfigurationWidget*> propertyWidgets;

protected slots:

  void filterPreviewLineNumber(bool filter);
  void previewLineNumberChanged(int value);

  void fromLineValueChanged(int value);
  void toLineValueChanged(int value);

  void updateTableHeaders();

  void useFirstLineAsHeaderUpdated();
  void propertyNameChanged(QString propertyName);
  void propertyStateChanged(bool activated);

signals:
  void fileInfoChanged();

private:

  /**
    * @brief Try to guess the property datatype in function of the type of the previous tokens and the type of the current token.
    **/
  std::string guessPropertyDataType(const std::string& data,const std::string& previousType)const;

  /**
    * @brief Return the type of the column in function of the old and new type.
    **/
  std::string combinePropertyDataType(const std::string& previousType,const std::string& newType)const;
  /**
    * @brief Try to guess the type of the data. Can recognize int, double, boolean or string. If the type is other return string.
    * @return The property typename of the type
    **/
  std::string guessDataType(const std::string& data)const;

  void columnSizeChanged(unsigned int i);

  //The data type of the header
  std::vector<std::string> columnHeaderType;
  //The data type of the rest of the column;
  std::vector<std::string> columnType;

  Ui::CSVImportConifgurationWidget *ui;
  PropertyNameValidator* validator;
  unsigned int maxLineNumber;
  tlp::CSVParser* parser;
};

}
#endif // CSVIMPORTCONFIGURATIONWIDGET_H
///@endcond