| 1 | /* i4ucbuildersourcetype.vala |
|---|
| 2 | * |
|---|
| 3 | * Copyright (C) 2010 Matias De la Puente |
|---|
| 4 | * |
|---|
| 5 | * This program is free software: you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation, either version 3 of the License, or |
|---|
| 8 | * (at your option) any later version. |
|---|
| 9 | * |
|---|
| 10 | * This program 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 |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | * |
|---|
| 18 | * Author: |
|---|
| 19 | * Matias De la Puente <mfpuente.ar@gmail.com> |
|---|
| 20 | */ |
|---|
| 21 | using Gee; |
|---|
| 22 | |
|---|
| 23 | public class I4uc.BuilderSourceType : GLib.Object |
|---|
| 24 | { |
|---|
| 25 | private ArrayList<string> _clean_types = new ArrayList<string> (); |
|---|
| 26 | |
|---|
| 27 | public string source_type { set; get; } |
|---|
| 28 | public string object_type { set; get; } |
|---|
| 29 | public string build_command { set; get; } |
|---|
| 30 | public string output_regex { set; get; default=""; } |
|---|
| 31 | public Gee.List<string> clean_types { get { return _clean_types; } } |
|---|
| 32 | |
|---|
| 33 | public BuilderSourceType.from_key_file (KeyFile key_file, string group) throws GLib.Error, GLib.KeyFileError |
|---|
| 34 | { |
|---|
| 35 | _source_type = key_file.get_string (group, "source_type"); |
|---|
| 36 | _object_type = key_file.get_string (group, "object_type"); |
|---|
| 37 | _build_command = key_file.get_string (group, "build_command"); |
|---|
| 38 | if (key_file.has_key (group, "output_regex")) |
|---|
| 39 | _output_regex = key_file.get_string (group, "output_regex"); |
|---|
| 40 | foreach (var clean_type in key_file.get_string_list (group, "clean_types")) |
|---|
| 41 | _clean_types.add (clean_type); |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | public void to_key_file (KeyFile key_file, string group) |
|---|
| 45 | { |
|---|
| 46 | key_file.set_string (group, "source_type", _source_type); |
|---|
| 47 | key_file.set_string (group, "object_type", _object_type); |
|---|
| 48 | key_file.set_string (group, "build_command", _build_command); |
|---|
| 49 | key_file.set_string (group, "output_regex", _output_regex); |
|---|
| 50 | key_file.set_string_list (group, "clean_types", _clean_types.to_array ()); |
|---|
| 51 | } |
|---|
| 52 | } |
|---|