File indexing completed on 2024-07-21 05:07:54

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef SOURCELINE_H
0012 #define SOURCELINE_H
0013 
0014 #include <QString>
0015 
0016 /**
0017 @author David Saxton
0018  */
0019 class SourceLine
0020 {
0021 public:
0022     /**
0023      * Creates an invalid source line (line is negative).
0024      */
0025     SourceLine();
0026     /// @param fileName the path to a file in the local filesystem
0027     SourceLine(const QString &fileName, int line);
0028 
0029     /// @returns the path to the source file in the local filesystem
0030     QString fileName() const
0031     {
0032         return m_fileName;
0033     }
0034     int line() const
0035     {
0036         return m_line;
0037     }
0038 
0039     bool isValid() const
0040     {
0041         return m_line >= 0;
0042     }
0043 
0044     bool operator<(const SourceLine &sourceLine) const;
0045     bool operator==(const SourceLine &sourceLine) const;
0046 
0047 protected:
0048     QString m_fileName;
0049     int m_line;
0050 };
0051 
0052 #endif