remove obsolete ref modifier and callback keyword
[vala-lang.git] / vala / valasourcereference.vala
blob71b7c67d8938d6d83591ee3a4cbf1cac2a7c6168
1 /* valasourcereference.vala
3 * Copyright (C) 2006-2007 Jürg Billeter
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Jürg Billeter <j@bitron.ch>
23 /**
24 * Represents a reference to a location in a source file.
26 public class Vala.SourceReference {
27 /**
28 * The source file to be referenced.
30 public weak SourceFile file { get; set; }
32 /**
33 * The first line number of the referenced source code.
35 public int first_line { get; set; }
37 /**
38 * The first column number of the referenced source code.
40 public int first_column { get; set; }
42 /**
43 * The last line number of the referenced source code.
45 public int last_line { get; set; }
47 /**
48 * The last column number of the referenced source code.
50 public int last_column { get; set; }
52 /**
53 * The text describing the referenced source code.
55 public string comment { get; set; }
57 /**
58 * Creates a new source reference.
60 * @param file a source file
61 * @param first_line first line number
62 * @param first_column first column number
63 * @param last_line last line number
64 * @param last_column last column number
65 * @return newly created source reference
67 public SourceReference (SourceFile _file, int _first_line = 0, int _first_column = 0, int _last_line = 0, int _last_column = 0) {
68 file = _file;
69 first_line = _first_line;
70 first_column = _first_column;
71 last_line = _last_line;
72 last_column = _last_column;
75 /**
76 * Creates a new commented source reference.
78 * @param file a source file
79 * @param first_line first line number
80 * @param first_column first column number
81 * @param last_line last line number
82 * @param last_column last column number
83 * @param comment code comment
84 * @return newly created source reference
86 public SourceReference.with_comment (SourceFile _file, int _first_line, int _first_column, int _last_line, int _last_column, string _comment) {
87 file = _file;
88 first_line = _first_line;
89 first_column = _first_column;
90 last_line = _last_line;
91 last_column = _last_column;
92 comment = _comment;
95 /**
96 * Returns a string representation of this source reference.
98 * @return human-readable string
100 public string! to_string () {
101 return ("%s:%d.%d-%d.%d".printf (file.filename, first_line, first_column, last_line, last_column));