main
cs 57 lines 2.62 KB
Raw
1 // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3 namespace WixToolset.Extensibility
4 {
5 using System.Xml.Linq;
6 using WixToolset.Extensibility.Data;
7
8 /// <summary>
9 /// Interface for extending the WiX toolset preprocessor.
10 /// </summary>
11 public interface IPreprocessorExtension
12 {
13 /// <summary>
14 /// Gets the variable prefixes for the extension.
15 /// </summary>
16 /// <value>The variable prefixes for the extension.</value>
17 string[] Prefixes { get; }
18
19 /// <summary>
20 /// Called at the beginning of the preprocessing of a source file.
21 /// </summary>
22 void PrePreprocess(IPreprocessContext context);
23
24 /// <summary>
25 /// Gets the value of a variable whose prefix matches the extension.
26 /// </summary>
27 /// <param name="prefix">The prefix of the variable to be processed by the extension.</param>
28 /// <param name="name">The name of the variable.</param>
29 /// <returns>The value of the variable or null if the variable is undefined.</returns>
30 string GetVariableValue(string prefix, string name);
31
32 /// <summary>
33 /// Evaluates a function defined in the extension.
34 /// </summary>
35 /// <param name="prefix">The prefix of the function to be processed by the extension.</param>
36 /// <param name="function">The name of the function.</param>
37 /// <param name="args">The list of arguments.</param>
38 /// <returns>The value of the function or null if the function is not defined.</returns>
39 string EvaluateFunction(string prefix, string function, string[] args);
40
41 /// <summary>
42 /// Processes a pragma defined in the extension.
43 /// </summary>
44 /// <param name="prefix">The prefix of the pragma to be processed by the extension.</param>
45 /// <param name="pragma">The name of the pragma.</param>
46 /// <param name="args">The pragma's arguments.</param>
47 /// <param name="parent">The parent node of the pragma.</param>
48 /// <returns>false if the pragma is not defined.</returns>
49 /// <comments>Don't return false for any condition except for unrecognized pragmas. Use Core.OnMessage for errors, warnings and messages.</comments>
50 bool ProcessPragma(string prefix, string pragma, string args, XContainer parent);
51
52 /// <summary>
53 /// Called at the end of the preprocessing of a source file.
54 /// </summary>
55 void PostPreprocess(IPreprocessResult result);
56 }
57 }