1/*
2 * This file is part of gitg
3 *
4 * Copyright (C) 2015 - Jesse van den Kieboom
5 *
6 * gitg 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.
10 *
11 * gitg 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.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with gitg. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20namespace GitgExt
21{
22	public class CommandLines : Object
23	{
24		private CommandLine[] d_command_lines;
25
26		public CommandLines(CommandLine[] command_lines)
27		{
28			d_command_lines = command_lines;
29		}
30
31		public T? get_for<T>()
32		{
33			foreach (var cmd in d_command_lines)
34			{
35				if (cmd.get_type() == typeof(T))
36				{
37					return (T)cmd;
38				}
39			}
40
41			return null;
42		}
43
44		public void parse_finished()
45		{
46			foreach (var cmd in d_command_lines)
47			{
48				cmd.parse_finished();
49			}
50		}
51
52		public void apply(Application application)
53		{
54			foreach (var cmd in d_command_lines)
55			{
56				cmd.apply(application);
57			}
58		}
59	}
60}
61
62// vi:ts=4
63