This file is indexed.

/usr/include/Wt/WStandardItem is in libwt-dev 3.3.0-1build1.

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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 */
#ifndef WSTANDARD_ITEM_H_
#define WSTANDARD_ITEM_H_

#include <map>
#include <string>
#include <vector>
#include <Wt/WModelIndex>
#include <Wt/WGlobal>

namespace Wt {

class WStandardItemModel;
class WString;

/*! \class WStandardItem Wt/WStandardItem Wt/WStandardItem
 *  \brief An item in a WStandardItemModel.
 *
 * The item provides access to various data properties: \link
 * setText() text\endlink, \link setIcon() icon\endlink, \link
 * setStyleClass() CSS style class\endlink, \link setToolTip() tool
 * tip\endlink, and \link setChecked() check state\endlink, and
 * data flags (setFlags() and setCheckable()).
 *
 * An item may contain a table of children items: the initial geometry
 * may be specified in the constructor, or using the methods
 * setRowCount() and setModelCount(). Unspecified items are 0. You can
 * set or inspect children items using the setChild() and child()
 * methods.
 *
 * It is possible to reimplement this class and specialize the methods
 * for data acess (setData() and data()), or provide custom sorting
 * functionality by reimplementing 
 * \if cpp
 * operator<().
 * \elseif java
 * compare().
 * \endif
 *
 * \ingroup modelview
 */
class WT_API WStandardItem
{
public:
  /*! \brief Creates an empty standard item.
   */
  WStandardItem();

  /*! \brief Creates an item with a text.
   *
   * \sa setText()
   */
  WStandardItem(const WString& text);

  /*! \brief Creates an item with an icon and a text.
   *
   * \sa setText(), setIcon()
   */
  WStandardItem(const std::string& iconUri, const WString& text);

  /*! \brief Creates an item with an initial geometry.
   *
   * \sa setRowCount(), setColumnCount()
   */
  WStandardItem(int rows, int columns = 1);

  /*! \brief Destructor.
   */
  virtual ~WStandardItem();

  /*! \brief Sets the text.
   *
   * The text is stored as \link Wt::DisplayRole DisplayRole\endlink data.
   *
   * The default text is empty ("").
   *
   * \sa text(), setData()
   */
  void setText(const WString& text);

  /*! \brief Returns the text.
   *
   * \sa setText()
   */
  WString text() const;

  /*! \brief Sets the icon url.
   *
   * The icon is stored as \link Wt::DecorationRole
   * DecorationRole\endlink data.
   *
   * The default icon url is empty ("").
   *
   * \sa icon(), setData()
   */
  void setIcon(const std::string& uri);

  /*! \brief Returns the icon url.
   *
   * \sa setIcon()
   */
  std::string icon() const;

  /*! \brief Sets the CSS style class.
   *
   * The style class is stored as \link Wt::StyleClassRole
   * StyleClassRole\endlink data.
   *
   * The default style class is empty ("").
   *
   * \sa styleClass(), setData()
   */
  void setStyleClass(const WString& styleClass);

  /*! \brief Returns the item style class.
   *
   * \sa setStyleClass()
   */
  WString styleClass() const;

  /*! \brief Sets a tool tip.
   *
   * The tool tip is stored as \link Wt::ToolTipRole ToolTipRole\endlink data.
   *
   * The default tool tip is empty ("").
   *
   * \sa toolTip(), setData()
   */
  void setToolTip(const WString& toolTip);

  /*! \brief Returns the tool tip.
   *
   * \sa setToolTip()
   */
  WString toolTip() const;

  /*! \brief Sets a link.
   *
   * The link is stored as \link Wt::LinkRole LinkRole\endlink data.
   *
   * \sa setData()
   */
  void setLink(const WLink& link);

  /*! \brief Returns a link.
   *
   * \sa setLink()
   */
  WLink link() const;

  /*! \brief Sets a link to an internal path (<b>deprecated</b>).
   *
   * The internal path is stored as \link Wt::LinkRole LinkRole\endlink data..
   *
   * \deprecated Use setLink() instead.
   */
  void setInternalPath(const std::string& internalpath);

  /*! \brief Returns the link to an internal path (<b>deprecated</b>).
   *
   * \sa setInternalPath()
   *
   * \deprecated Use link() instead.
   */
  std::string internalPath() const;

  /*! \brief Sets a link to a URL (<b>deprecated</b>).
   *
   * The URL is stored as \link Wt::LinkRole LinkRole\endlink data.
   *
   * \deprecated Use setLink() instead.
   */
  void setUrl(const std::string& url);

  /*! \brief Returns the linked URL (<b>deprecated</b>).
   *
   * \sa setUrl()
   *
   * \deprecated Use link() instead.
   */
  std::string url() const;

  /*! \brief Checks or unchecks the item.
   *
   * The value is stored as \link Wt::CheckStateRole
   * CheckStateRole\endlink data.
   *
   * By default, an item is not checked.
   *
   * Note: this requires that the item is checkable (see setCheckable()).
   *
   * If the item is tri-state, you may consider using setCheckState() instead
   * which supports also setting the third Wt::PartiallyChecked state.
   *
   * \sa setCheckable(), setCheckState()
   */
  void setChecked(bool checked);

  /*! \brief Returns whether the item is checked.
   *
   * \sa setChecked()
   */
  bool isChecked() const;

  /*! \brief Sets the check state.
   *
   * Like setChecked(), this sets the check state, but allows also setting
   * the Wt::PartiallyChecked state when the item is tri-state checkable.
   *
   * The value is stored as \link Wt::CheckStateRole CheckStateRole\endlink
   * data.
   *
   * \sa setCheckable(), setData()
   */
  void setCheckState(CheckState checked);

  /*! \brief Returns the item's check state.
   *
   * \sa setCheckState()
   */
  CheckState checkState() const;

  /*! \brief Sets the flags.
   *
   * The default flag value is \link Wt::ItemIsSelectable
   * ItemIsSelectable\endlink.
   *
   * \sa ItemFlag, flags(), setCheckable()
   */
  void setFlags(WFlags<ItemFlag> flags);

  /*! \brief Returns the flags.
   *
   * \sa setFlags()
   */
  WFlags<ItemFlag> flags() const;

  /*! \brief Makes the item checkable.
   *
   * Adds \link Wt::ItemIsUserCheckable ItemIsUserCheckable
   * \endlink to the item's flags.
   *
   * \sa setFlags(), setChecked()
   */
  void setCheckable(bool checkable);

  /*! \brief Returns whether the item is checkable.
   *
   * \sa setCheckable()
   */
  bool isCheckable() const;

  /*! \brief Makes the item tri-state checkable.
   *
   * When \p tristate is \c true, the item is checkable with three
   * states: Wt::Unchecked, Wt::Checked, and Wt::PartiallyChecked.
   *
   * This requires that the item is also checkable (see setCheckable())
   *
   * \sa setCheckable()
   */
  void setTristate(bool tristate);

  /*! \brief Returns whether the item is tri-state checkable.
   *
   * \sa setTristate()
   */
  bool isTristate() const;

  void setEditable(bool editable);
  bool isEditable() const;

  /*! \brief Sets item data.
   *
   * Sets item data for the given role.
   *
   * \sa data()
   */
  virtual void setData(const boost::any& data, int role = UserRole);

  /*! \brief Returns item data.
   *
   * Returns item data for the given role.
   *
   * \sa data()
   */
  virtual boost::any data(int role = UserRole) const;

  /*! \brief Returns whether the item has any children.
   *
   * This is a convenience method and checks whether rowCount() and
   * columnCount() differ both from 0.
   *
   * \sa rowCount(), columnCount()
   */
  bool hasChildren() const;

  /*! \brief Sets the row count.
   *
   * If \p rows is bigger than the current row count, empty rows
   * are appended.
   *
   * If \p rows is smaller than the current row count, rows are
   * deleted at the end.
   *
   * \note If \p rows > 0, and columnCount() == 0, columnCount
   * is first increased to 1 using setColumnCount(1).
   *
   * \sa setColumnCount(), rowCount()
   */
  void setRowCount(int rows);

  /*! \brief Returns the row count.
   *
   * \sa setRowCount()
   */
  int rowCount() const;

  /*! \brief Sets the column count.
   *
   * If \p columns is bigger than the current column count, empty
   * columns are appended.
   *
   * If \p columns is smaller than the current column count,
   * columns are deleted at the end.
   *
   * \sa setRowCount(), columnCount()
   */
  void setColumnCount(int columns);

  /*! \brief Returns the column count.
   *
   * \sa setRowCount()
   */
  int columnCount() const;

  /*! \brief Add a single column of items.
   *
   * Appends a single column of \p items. If necessary,
   * the row count is increased.
   *
   * Equivalent to:
   * \code
   * insertColumn(columnCount(), items);
   * \endcode
   *
   * \sa insertColumn(), appendRow()
   */
  void appendColumn(const std::vector<WStandardItem *>& items);

  /*! \brief Inserts a single column of items.
   *
   * Inserts a single column of \p items at column
   * \p column. If necessary, the row count is increased.
   * 
   * \sa WStandardItem::insertRow()
   */
  void insertColumn(int column, const std::vector<WStandardItem *>& items);

  /*! \brief Add a single row of items.
   *
   * Appends a single row of \p items. If necessary,
   * the column count is increased.
   *
   * Equivalent to:
   * \code
   * insertRow(rowCount(), items);
   * \endcode
   *
   * \sa insertRow(), appendColumn()
   */
  void appendRow(const std::vector<WStandardItem *>& items);

  /*! \brief Inserts a single row of items.
   *
   * Inserts a single row of <i>items</i> at row \p row. If
   * necessary, the column count is increased.
   * 
   * \sa insertColumn()
   */
  void insertRow(int row, const std::vector<WStandardItem *>& items);

  /*! \brief Inserts a number of empty columns.
   *
   * Inserts <i>count</i> empty columns at position \p column.
   * 
   * \sa insertRows()
   */
  void insertColumns(int column, int count);

  /*! \brief Inserts a number of empty rows.
   *
   * Inserts <i>count</i> empty rows at position \p row.
   * 
   * \sa insertColumns()
   */
  void insertRows(int row, int count);

  /*! \brief Appends a row containing one item.
   *
   * This is a convenience method for nodes with a single column (for
   * example for tree nodes). This adds a row with a single item, and
   * is equivalent to:
   *
   * \code
   * insertRow(rowCount(), item);
   * \endcode
   * 
   * \sa insertRow(int, WStandardItem *)
   */
  void appendRow(WStandardItem *item);

  /*! \brief Inserts a row containing one item.
   *
   * This is a convenience method for nodes with a single column (for
   * example for tree nodes). This inserts a row with a single item,
   * and is equivalent to:
   *
   * \if cpp
   * \code
   * std::vector<WStandardItem *> r;
   * r.push_back(item);
   * insertRow(row, r);
   * \endcode
   * \elseif java
   * \code 
   * List<WStandardItem> r;
   * r.add(item);
   * insertRow(row, r);
   * \endcode
   * \endif
   * 
   * \sa insertRow(int, const std::vector<WStandardItem *>&)
   */
  void insertRow(int row, WStandardItem *item);

  /*! \brief Appends multiple rows containing one item.
   *
   * This is a convenience method for nodes with a single column (for
   * example for tree nodes). This adds a number of rows, each
   * containing a single item, and is equivalent to:
   *
   * \code
   * insertRows(rowCount(), items);
   * \endcode
   * 
   * \sa insertRows(int, const std::vector<WStandardItem *>&)
   */
  void appendRows(const std::vector<WStandardItem *>& items);

  /*! \brief Inserts multiple rows containing one item.
   *
   * This is a convenience method for nodes with a single column (for
   * example for tree nodes). This inserts a number of rows at row
   * \p row, each containing a single item, and is equivalent to:
   *
   * \if cpp
   * \code
   * for (unsigned i = 0; i < items.size(); ++i)
   *   insertRow(row + i, items[i]);
   * \endcode
   * \endif
   * 
   * \sa insertRow(int, WStandardItem *)
   */
  void insertRows(int row, const std::vector<WStandardItem *>& items);

  /*! \brief Sets a child item.
   *
   * Sets a child item <i>item</i> at position (\p row,
   * \p column). If an item was previously set, it is deleted
   * first.
   *
   * If necessary, the rowCount() and/or the columnCount() is increased.
   *
   * \sa child().
   */
  void setChild(int row, int column, WStandardItem *item);

  /*! \brief Sets a child item.
   *
   * This is a convenience method for nodes with a single column
   * (e.g. tree nodes), and is equivalent to:
   * \code
   * setChild(row, 0, item);
   * \endcode
   *
   * \sa setChild(int, int, WStandardItem *).
   */
  void setChild(int row, WStandardItem *item);

  /*! \brief Returns a child item.
   *
   * Returns the child item at position (<i>row</i>, \p column).
   * This may be \c 0 if an item was not previously set, or if the
   * position is out of bounds.
   *
   * \sa setChild(int, int, WStandardItem *).
   */
  WStandardItem *child(int row, int column = 0) const;

  /*! \brief Takes a child out of the item.
   *
   * Returns the child item at position (<i>row</i>, \p column),
   * and removes it (by setting \c 0 instead). Ownership of the item is
   * transferred to the caller.
   *
   * \sa child(), setChild(int, int, WStandardItem *)
   */
  WStandardItem *takeChild(int row, int column);

  /*! \brief Takes a column of children out of the item.
   *
   * Returns the column \p column, and removes the
   * column from the model (reducing the column count by
   * one). Ownership of all items is transferred to the caller.
   *
   * \sa takeRow(), removeColumn()
   */
  std::vector<WStandardItem *> takeColumn(int column);

  /*! \brief Takes a row of children out of the item.
   *
   * Returns the row \p row, and removes the row from the
   * model (reducing the row count by one). Ownership of all items is
   * transferred to the caller.
   *
   * \sa takeColumn(), removeRow()
   */
  std::vector<WStandardItem *> takeRow(int row);

  /*! \brief Removes a single column.
   *
   * Removes the column \p column from the model (reducing the
   * column count by one). Is equivalent to:
   * \code
   * removeColumns(column, 1);
   * \endcode
   *
   * \sa removeColumns(), takeColumn()
   */
  void removeColumn(int column);

  /*! \brief Removes a number of columns.
   *
   * Removes \p count columns from the model (reducing the
   * column count by \p count).
   *
   * \sa removeColumn(), removeRows()
   */
  void removeColumns(int column, int count);

  /*! \brief Removes a single row.
   *
   * Removes the row \p row from the model (reducing the
   * row count by one). Is equivalent to:
   * \code
   * removeRows(row, 1);
   * \endcode
   *
   * \sa removeRows(), takeRow()
   */
  void removeRow(int row);

  /*! \brief Removes a number of rows.
   *
   * Removes \p count rows from the model (reducing the
   * row count by \p count).
   *
   * \sa removeRow(), removeColumns()
   */
  void removeRows(int row, int count);

  /*! \brief Returns the model index for this item.
   *
   * \sa WStandardItemModel::indexFromItem()
   */
  WModelIndex index() const;

  /*! \brief Returns the model.
   *
   * This is the model that this item belongs to, or 0 if the item is
   * not associated with a model.
   */
  WStandardItemModel *model() const { return model_; }

  /*! \brief Returns the parent item.
   *
   * Returns the parent item.
   *
   * \sa setChild()
   */
  WStandardItem *parent() const { return parent_; }

  /*! \brief Returns the row index.
   *
   * Returns the row index of this item in the parent.
   *
   * \sa column()
   */
  int row() const { return row_; }

  /*! \brief Returns the column index.
   *
   * Returns the column index of this item in the parent.
   *
   * \sa column()
   */
  int column() const { return column_; }

  /*! \brief Returns a clone of this item.
   *
   * \sa WStandardItemModel::setItemPrototype()
   */
  virtual WStandardItem *clone() const;

  /*! \brief Compares the item with another item.
   *
   * This is used during sorting (from sortChildren()), and returns
   * which of the two items is the lesser, based on their data.
   *
   * The default implementation compares the data based on the value
   * corresponding to the WStandardItemModel::sortRole().
   *
   * \sa sortChildren(), WStandardItemModel::setSortRole()
   */
  virtual bool operator< (const WStandardItem& other) const;

  /*! \brief Sorts the children according to a given column and sort order.
   *
   * Children of this item, and all children items are sorted
   * recursively. Existing model indexes will be invalidated by
   * the operation (will point to other items).
   *
   * The WStandardItemModel::layoutAboutToBeChanged and
   * WStandardItemModel::layoutChanged signals are emitted before and
   * after the operation so that you get a chance to invalidate or
   * update model indexes.
   * 
   * \if cpp
   * \sa operator<(), WStandardItemModel::setSortRole()
   * \elseif java
   * \sa compare(), WStandardItemModel::setSortRole()
   * \endif
   */
  virtual void sortChildren(int column, SortOrder order);

protected:
  /*! \brief Set the model for this WStandardItem and its children.
   *
   * You may override this method if you want to change its behaviour.
   */
  virtual void setModel(WStandardItemModel *model);

private:
#ifndef WT_TARGET_JAVA
  typedef std::map<int, boost::any> DataMap;
#else
  typedef std::treemap<int, boost::any> DataMap;
#endif
  typedef std::vector<WStandardItem *> Column;
  typedef std::vector<Column> ColumnList;

  /*! \brief Compares the item with another item.
   *
   * This is used during sorting (from sortChildren()), and returns
   * which of the two items is the lesser, based on their data.
   *
   * The default implementation compares the data based on the value
   * corresponding to the WStandardItemModel::sortRole().
   *
   * \sa sortChildren(), WStandardItemModel::setSortRole()
   */
  int compare(const WStandardItem& other) const;

  WStandardItemModel *model_;
  WStandardItem      *parent_;
  int                 row_, column_;

  DataMap          data_;
  WFlags<ItemFlag> flags_;

  ColumnList *columns_;

  void signalModelDataChange();
  void adoptChild(int row, int column, WStandardItem *item);
  void orphanChild(WStandardItem *item);
  void recursiveSortChildren(int column, SortOrder order);
  void renumberColumns(int column);
  void renumberRows(int row);

  friend class WStandardItemModel;
};

}

#endif // WSTANDARD_ITEM_H_