gio-unix-2.0: Add DesktopAppInfo.launch_uris_as_manager_with_fds()
[vala-gnome.git] / vala / valasourcereference.vala
blob24aeeda45a02d36b0922d409f0bdd6ca48f7f380
1 /* valasourcereference.vala
3 * Copyright (C) 2006-2012 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.1 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 using GLib;
25 /**
26 * Represents a reference to a location in a source file.
28 public class Vala.SourceReference {
29 /**
30 * The source file to be referenced.
32 public weak SourceFile file { get; set; }
34 /**
35 * The begin of the referenced source code.
37 public SourceLocation begin { get; set; }
39 /**
40 * The end of the referenced source code.
42 public SourceLocation end { get; set; }
44 public List<UsingDirective> using_directives { get; private set; }
46 /**
47 * Creates a new source reference.
49 * @param _file a source file
50 * @param begin the begin of the referenced source code
51 * @param end the end of the referenced source code
52 * @return newly created source reference
54 public SourceReference (SourceFile _file, SourceLocation begin, SourceLocation end) {
55 file = _file;
56 this.begin = begin;
57 this.end = end;
58 using_directives = file.current_using_directives;
61 /**
62 * Returns a string representation of this source reference.
64 * @return human-readable string
66 public string to_string () {
67 return ("%s:%d.%d-%d.%d".printf (file.get_relative_filename (), begin.line, begin.column, end.line, end.column));