1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3  * anjuta-token-file.h
4  * Copyright (C) Sébastien Granjoux 2009 <seb.sfo@free.fr>
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef _ANJUTA_TOKEN_FILE_H_
21 #define _ANJUTA_TOKEN_FILE_H_
22 
23 #include <gio/gio.h>
24 #include <glib.h>
25 
26 #include <libanjuta/anjuta-token.h>
27 
28 G_BEGIN_DECLS
29 
30 #define ANJUTA_TOKEN_FILE_TYPE                     (anjuta_token_file_get_type ())
31 #define ANJUTA_TOKEN_FILE(obj)                      (G_TYPE_CHECK_INSTANCE_CAST ((obj), ANJUTA_TOKEN_FILE_TYPE, AnjutaTokenFile))
32 #define ANJUTA_TOKEN_FILE_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), ANJUTA_TOKEN_FILE_TYPE, AnjutaTokenFileClass))
33 #define IS_ANJUTA_TOKEN_FILE(obj)                  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ANJUTA_TOKEN_FILE_TYPE))
34 #define IS_ANJUTA_TOKEN_FILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), ANJUTA_TOKEN_FILE_TYPE))
35 #define GET_ANJUTA_TOKEN_FILE_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), ANJUTA_TOKEN_FILE_TYPE, AnjutaTokenFileClass))
36 
37 typedef struct _AnjutaTokenFile AnjutaTokenFile;
38 typedef struct _AnjutaTokenFileClass AnjutaTokenFileClass;
39 
40 typedef struct
41 {
42 	gchar *filename;
43 	guint line;
44 	guint column;
45 } AnjutaTokenFileLocation;
46 
47 GType anjuta_token_file_get_type (void);
48 
49 AnjutaTokenFile *anjuta_token_file_new (GFile *file);
50 void anjuta_token_file_free (AnjutaTokenFile *file);
51 
52 AnjutaToken* anjuta_token_file_load (AnjutaTokenFile *file, GError **error);
53 gboolean anjuta_token_file_unload (AnjutaTokenFile *file);
54 gboolean anjuta_token_file_save (AnjutaTokenFile *file, GError **error);
55 void anjuta_token_file_move (AnjutaTokenFile *file, GFile *new_file);
56 
57 gboolean anjuta_token_file_update (AnjutaTokenFile *file, AnjutaToken *token);
58 
59 gboolean anjuta_token_file_get_token_location (AnjutaTokenFile *file, AnjutaTokenFileLocation *location, AnjutaToken *token);
60 gsize anjuta_token_file_get_token_position (AnjutaTokenFile *file, AnjutaToken *token);
61 GFile *anjuta_token_file_get_file (AnjutaTokenFile *file);
62 AnjutaToken *anjuta_token_file_get_content (AnjutaTokenFile *file);
63 gboolean anjuta_token_file_is_dirty (AnjutaTokenFile *file);
64 
65 
66 G_END_DECLS
67 
68 #endif
69