1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 Copyright (C) 2004 Sebastien Granjoux
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program 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 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 * File data read in .wiz file
24 *---------------------------------------------------------------------------*/
30 /*---------------------------------------------------------------------------*/
40 NPW_EXECUTE_FILE
= 1 << 0,
41 NPW_PROJECT_FILE
= 1 << 1,
42 NPW_AUTOGEN_SET
= 1 << 2,
43 NPW_AUTOGEN_FILE
= 1 << 3
47 *---------------------------------------------------------------------------*/
50 npw_file_new_file (const gchar
*destination
, const gchar
*source
)
54 g_return_val_if_fail (destination
&& source
, NULL
);
56 file
= g_slice_new(NPWFile
);
57 file
->type
= NPW_FILE
;
58 file
->destination
= g_strdup (destination
);
59 file
->source
= g_strdup (source
);
66 npw_file_free (NPWFile
* file
)
68 g_free (file
->destination
);
69 g_free (file
->source
);
70 g_slice_free (NPWFile
, file
);
74 npw_file_get_type (const NPWFile
* file
)
80 npw_file_get_destination (const NPWFile
* file
)
82 return file
->destination
;
86 npw_file_get_source (const NPWFile
* file
)
92 npw_file_set_execute (NPWFile
* file
, gboolean value
)
96 file
->attribute
|= NPW_EXECUTE_FILE
;
100 file
->attribute
&= ~NPW_EXECUTE_FILE
;
105 npw_file_get_execute (const NPWFile
* file
)
107 return file
->attribute
& NPW_EXECUTE_FILE
;
111 npw_file_set_project (NPWFile
* file
, gboolean value
)
115 file
->attribute
|= NPW_PROJECT_FILE
;
119 file
->attribute
&= ~NPW_PROJECT_FILE
;
124 npw_file_get_project (const NPWFile
* file
)
126 return file
->attribute
& NPW_PROJECT_FILE
;
130 npw_file_set_autogen (NPWFile
* file
, NPWFileBooleanValue value
)
135 file
->attribute
|= NPW_AUTOGEN_FILE
| NPW_AUTOGEN_SET
;
138 file
->attribute
|= NPW_AUTOGEN_SET
;
139 file
->attribute
&= ~NPW_AUTOGEN_FILE
;
141 case NPW_FILE_DEFAULT
:
142 file
->attribute
&= ~(NPW_AUTOGEN_SET
| NPW_AUTOGEN_FILE
);
148 npw_file_get_autogen (const NPWFile
* file
)
150 return file
->attribute
& NPW_AUTOGEN_SET
? (file
->attribute
& NPW_AUTOGEN_FILE
? NPW_FILE_TRUE
: NPW_FILE_FALSE
) : NPW_FILE_DEFAULT
;