This file is indexed.

/usr/include/avogadro/textmatrixeditor.h is in libavogadro-dev 1.1.1-0ubuntu7.

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
/**********************************************************************
  TextMatrixEditor - Text editor that edits 3x3 matrices

  Copyright (C) 2011 David C. Lonie

  This file is part of the Avogadro molecular editor project.
  For more information, see <http://avogadro.openmolecules.net/>

  Avogadro is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  Avogadro 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.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  02110-1301, USA.
 **********************************************************************/

#ifndef TEXTMATRIXEDITOR_H
#define TEXTMATRIXEDITOR_H

#include <avogadro/global.h> // For A_EXPORT

#include <QtGui/QTextEdit>

#include <Eigen/Core>

class QRegExp;

namespace Avogadro
{

/**
 * @class TextMatrixEditor textmatrixeditor.h <avogadro/textmatrixeditor.h>
 * @brief Widget to edit 3x3 matrices in plain text
 * @author David C. Lonie
 *
 * TextMatrixEditor is a QTextEdit that displays and allows editing of a 3x3
 * matrix as plain text. Input is validated with each keystroke, and the text
 * turns red if the input is invalid. The matrix can be set/get with matrix()
 * and setMatrix(). The delimiters used to separate columns can be set and
 * accessed through the pointer returned by delimiters(). The default
 * delimiter regexp is
 * QRegExp("\\s+|,|;|\\||\\[|\\]|\\{|\\}|\\(|\\)|\\&|/|<|>"). resetMatrix()
 * will replace the text with the last known good matrix.
 */
class A_EXPORT TextMatrixEditor : public QTextEdit
{
  Q_OBJECT
public:
  //! Constructor
  explicit TextMatrixEditor(QWidget *parent = 0);
  //! Destructor
  virtual ~TextMatrixEditor();

  //! @return Allowed column separators. See class definition for default.
  QRegExp * delimiters() {return this->m_delimiters;}
  //! @return Allowed column separators. See class definition for default
  const QRegExp * delimiters() const {return this->m_delimiters;}

  //! @return The current matrix
  Eigen::Matrix3d matrix() const;

signals:
  //! Emitted when the text cannot be parsed into a matrix
  void isInvalid();
  //! Emitted when the text has been parsed into a matrix
  void isValid();

public slots:
  //! Set the matrix. This will update the text.
  void setMatrix(const Eigen::Matrix3d &mat);
  //! Reset the text to the last known good matrix.
  void resetMatrix();

protected slots:
  /**
   * Check if input can be parsed. Sets m_matrix, emits isValid(), and returns
   * true if so. Otherwise emits isInvalid() and returns false.
   */
  bool validate();

  //! Turn the text red.
  void markAsInvalid();

  //! Reset the text appearance.
  void markAsValid();

protected:
  //! Stores the text properties while invalid.
  QTextCharFormat *m_charFormat;
  //! Acceptable column separators. See class definition for default.
  QRegExp *m_delimiters;
  //! Stores the current (or last known good) matrix.
  Eigen::Matrix3d m_matrix;
};

} // namespace Avogadro

#endif // TEXTMATRIXEDITOR_H