~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to languages/cpp/declarationinfo.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
   begin                : Sat Jul 21 2001
3
 
   copyright            : (C) 2001 by Victor R�er
4
 
   email                : victor_roeder@gmx.de
5
 
   copyright            : (C) 2002,2003 by Roberto Raggi
6
 
   email                : roberto@kdevelop.org
7
 
   copyright            : (C) 2005 by Adam Treat
8
 
   email                : manyoso@yahoo.com
9
 
   copyright            : (C) 2006 by David Nolden
10
 
   email                : david.nolden.kdevelop@art-master.de
11
 
***************************************************************************/
12
 
 
13
 
/***************************************************************************
14
 
 *                                                                         *
15
 
 *   This program is free software; you can redistribute it and/or modify  *
16
 
 *   it under the terms of the GNU General Public License as published by  *
17
 
 *   the Free Software Foundation; either version 2 of the License, or     *
18
 
 *   (at your option) any later version.                                   *
19
 
 *                                                                         *
20
 
 ***************************************************************************/
21
 
 
22
 
#ifndef DECLARATIONINFO_H
23
 
#define DECLARATIONINFO_H
24
 
 
25
 
#include <qstring.h>
26
 
 
27
 
struct DeclarationInfo {
28
 
    class File {
29
 
      QString m_file;
30
 
      public:
31
 
        File( const QString& file = "" ) : m_file( file ) {
32
 
        }
33
 
 
34
 
        operator QString() const {
35
 
          return m_file;
36
 
        }
37
 
    };
38
 
 
39
 
    DeclarationInfo() : startLine(0), startCol(0), endLine(0), endCol(0) {
40
 
    }
41
 
    
42
 
    operator bool() {
43
 
      return !name.isEmpty();
44
 
    }
45
 
    
46
 
    QString locationToText() const {
47
 
      return QString("line %1 col %2 - line %3 col %4\nfile: %5").arg(startLine).arg(startCol).arg(endLine).arg(endCol).arg(file);
48
 
    }
49
 
    
50
 
    QString toText() const {
51
 
      if( name.isEmpty() ) return "";
52
 
        
53
 
      QString ret;
54
 
      ret = QString("name: " + name + "\n" ) + locationToText();
55
 
      if( !comment.isEmpty() ) {
56
 
        ret += "\n\"" + comment + "\"";
57
 
      }
58
 
      return ret;
59
 
    }
60
 
    
61
 
    int startLine, startCol;
62
 
    int endLine, endCol;
63
 
 
64
 
    File file;
65
 
    QString name;
66
 
    QString comment;
67
 
};
68
 
 
69
 
 
70
 
 
71
 
#endif
72
 
// kate: indent-mode csands; tab-width 4;