gio-unix-2.0: Add DesktopAppInfo.launch_uris_as_manager_with_fds()
[vala-gnome.git] / libvaladoc / content / run.vala
blobd2edd1650715015358aa0299609066b7e5213eb5
1 /* run.vala
3 * Copyright (C) 2008-2009 Didier Villevalois
4 * Copyright (C) 2008-2012 Florian Brosch
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library 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 GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * Author:
21 * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
25 public class Valadoc.Content.Run : InlineContent, Inline {
26 public enum Style {
27 NONE,
28 BOLD,
29 ITALIC,
30 UNDERLINED,
31 MONOSPACED,
32 STROKE,
33 LANG_KEYWORD,
34 LANG_LITERAL,
35 LANG_BASIC_TYPE,
36 LANG_TYPE,
37 LANG_PREPROCESSOR,
38 LANG_COMMENT,
39 LANG_ESCAPE,
41 XML_ESCAPE,
42 XML_ELEMENT,
43 XML_ATTRIBUTE,
44 XML_ATTRIBUTE_VALUE,
45 XML_COMMENT,
46 XML_CDATA;
48 public static Style? from_string (string str) {
49 switch (str) {
50 case "none":
51 return Style.NONE;
53 case "bold":
54 return Style.BOLD;
56 case "italic":
57 return Style.ITALIC;
59 case "underlined":
60 return Style.UNDERLINED;
62 case "monospaced":
63 return Style.MONOSPACED;
65 case "stroke":
66 return Style.STROKE;
68 case "lang-escape":
69 return Style.LANG_ESCAPE;
71 case "lang-keyword":
72 return Style.LANG_KEYWORD;
74 case "lang-literal":
75 return Style.LANG_LITERAL;
77 case "lang-basic-type":
78 return Style.LANG_BASIC_TYPE;
80 case "lang-type":
81 return Style.LANG_TYPE;
83 case "lang-preprocessor":
84 return Style.LANG_PREPROCESSOR;
86 case "lang-comment":
87 return Style.LANG_COMMENT;
89 case "xml-escape":
90 return Style.XML_ESCAPE;
92 case "xml-element":
93 return Style.XML_ELEMENT;
95 case "xml-attribute":
96 return Style.XML_ATTRIBUTE;
98 case "xml-attribute-value":
99 return Style.XML_ATTRIBUTE_VALUE;
101 case "xml-comment":
102 return Style.XML_COMMENT;
104 case "xml-cdata":
105 return Style.XML_CDATA;
108 return null;
111 public unowned string to_string () {
112 switch (this) {
113 case Style.NONE:
114 return "none";
116 case Style.BOLD:
117 return "bold";
119 case Style.ITALIC:
120 return "italic";
122 case Style.UNDERLINED:
123 return "underlined";
125 case Style.MONOSPACED:
126 return "monospaced";
128 case Style.STROKE:
129 return "stroke";
131 case Style.LANG_ESCAPE:
132 return "lang-escape";
134 case Style.LANG_KEYWORD:
135 return "lang-keyword";
137 case Style.LANG_LITERAL:
138 return "lang-literal";
140 case Style.LANG_BASIC_TYPE:
141 return "lang-basic-type";
143 case Style.LANG_TYPE:
144 return "lang-type";
146 case Style.LANG_PREPROCESSOR:
147 return "lang-preprocessor";
149 case Style.LANG_COMMENT:
150 return "lang-comment";
152 case Style.XML_ESCAPE:
153 return "xml-escape";
155 case Style.XML_ELEMENT:
156 return "xml-element";
158 case Style.XML_ATTRIBUTE:
159 return "xml-attribute";
161 case Style.XML_ATTRIBUTE_VALUE:
162 return "xml-attribute-value";
164 case Style.XML_COMMENT:
165 return "xml-comment";
167 case Style.XML_CDATA:
168 return "xml-cdata";
171 assert (true);
172 return "";
176 public Style style { get; set; }
178 internal Run (Style style) {
179 base ();
180 _style = style;
183 public override void check (Api.Tree api_root, Api.Node container, string file_path,
184 ErrorReporter reporter, Settings settings)
186 // Check inline content
187 base.check (api_root, container, file_path, reporter, settings);
190 public override void accept (ContentVisitor visitor) {
191 visitor.visit_run (this);
194 public override ContentElement copy (ContentElement? new_parent = null) {
195 Run run = new Run (style);
196 run.parent = new_parent;
198 foreach (Inline element in content) {
199 Inline copy = element.copy (run) as Inline;
200 run.content.add (copy);
203 return run;