1 /*
2  * This file is part of EvinceD.
3  * EvinceD is based on GtkD.
4  *
5  * EvinceD is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation; either version 3
8  * of the License, or (at your option) any later version, with
9  * some exceptions, please read the COPYING file.
10  *
11  * EvinceD is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with EvinceD; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
19  */
20 
21 // generated automatically - do not change
22 // find conversion definition on APILookup.txt
23 
24 
25 module evince.document.SourceLink;
26 
27 private import evince.document.c.functions;
28 public  import evince.document.c.types;
29 private import glib.ConstructionException;
30 private import glib.MemorySlice;
31 private import glib.Str;
32 private import gobject.ObjectG;
33 private import gtkd.Loader;
34 
35 
36 /** */
37 public final class SourceLink
38 {
39 	/** the main Gtk struct */
40 	protected EvSourceLink* evSourceLink;
41 	protected bool ownedRef;
42 
43 	/** Get the main Gtk struct */
44 	public EvSourceLink* getSourceLinkStruct(bool transferOwnership = false)
45 	{
46 		if (transferOwnership)
47 			ownedRef = false;
48 		return evSourceLink;
49 	}
50 
51 	/** the main Gtk struct as a void* */
52 	protected void* getStruct()
53 	{
54 		return cast(void*)evSourceLink;
55 	}
56 
57 	/**
58 	 * Sets our main struct and passes it to the parent class.
59 	 */
60 	public this (EvSourceLink* evSourceLink, bool ownedRef = false)
61 	{
62 		this.evSourceLink = evSourceLink;
63 		this.ownedRef = ownedRef;
64 	}
65 
66 	~this ()
67 	{
68 		if ( Linker.isLoaded(LIBRARY_EVINCEDOCUMENT) && ownedRef )
69 			ev_source_link_free(evSourceLink);
70 	}
71 
72 
73 	/** */
74 	public @property string filename()
75 	{
76 		return Str.toString(evSourceLink.filename);
77 	}
78 
79 	/** Ditto */
80 	public @property void filename(string value)
81 	{
82 		evSourceLink.filename = Str.toStringz(value);
83 	}
84 
85 	/** */
86 	public @property int line()
87 	{
88 		return evSourceLink.line;
89 	}
90 
91 	/** Ditto */
92 	public @property void line(int value)
93 	{
94 		evSourceLink.line = value;
95 	}
96 
97 	/** */
98 	public @property int col()
99 	{
100 		return evSourceLink.col;
101 	}
102 
103 	/** Ditto */
104 	public @property void col(int value)
105 	{
106 		evSourceLink.col = value;
107 	}
108 
109 	/** */
110 	public static GType getType()
111 	{
112 		return ev_source_link_get_type();
113 	}
114 
115 	/** */
116 	public this(string filename, int line, int col)
117 	{
118 		auto __p = ev_source_link_new(Str.toStringz(filename), line, col);
119 
120 		if(__p is null)
121 		{
122 			throw new ConstructionException("null returned by new");
123 		}
124 
125 		this(cast(EvSourceLink*) __p);
126 	}
127 
128 	/** */
129 	public SourceLink copy()
130 	{
131 		auto __p = ev_source_link_copy(evSourceLink);
132 
133 		if(__p is null)
134 		{
135 			return null;
136 		}
137 
138 		return ObjectG.getDObject!(SourceLink)(cast(EvSourceLink*) __p, true);
139 	}
140 
141 	/** */
142 	public void free()
143 	{
144 		ev_source_link_free(evSourceLink);
145 		ownedRef = false;
146 	}
147 }