aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Extensibility/IPreprocessorExtension.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-08-20 14:22:07 -0700
committerRob Mensching <rob@firegiant.com>2017-08-20 14:25:49 -0700
commit3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c (patch)
treebbe907a4c5ebf7aa5e3f02141f6e3abd31cb7b5c /src/WixToolset.Extensibility/IPreprocessorExtension.cs
parent6dee3b45cb679786bd49a5db8fde9006d283b3e2 (diff)
downloadwix-3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c.tar.gz
wix-3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c.tar.bz2
wix-3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c.zip
Move to .NET Core 2.0
Diffstat (limited to 'src/WixToolset.Extensibility/IPreprocessorExtension.cs')
-rw-r--r--src/WixToolset.Extensibility/IPreprocessorExtension.cs79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/WixToolset.Extensibility/IPreprocessorExtension.cs b/src/WixToolset.Extensibility/IPreprocessorExtension.cs
new file mode 100644
index 00000000..de415526
--- /dev/null
+++ b/src/WixToolset.Extensibility/IPreprocessorExtension.cs
@@ -0,0 +1,79 @@
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
3namespace WixToolset.Extensibility
4{
5 using System;
6 using System.Xml.Linq;
7 using WixToolset.Data;
8
9 /// <summary>
10 /// Interface for extending the WiX toolset preprocessor.
11 /// </summary>
12 public interface IPreprocessorExtension
13 {
14 /// <summary>
15 /// Gets or sets the preprocessor core for the extension.
16 /// </summary>
17 /// <value>Preprocessor core for the extension.</value>
18 IPreprocessorCore Core { get; set; }
19
20 /// <summary>
21 /// Gets the variable prefixes for the extension.
22 /// </summary>
23 /// <value>The variable prefixes for the extension.</value>
24 string[] Prefixes { get; }
25
26 /// <summary>
27 /// Called at the beginning of the preprocessing of a source file.
28 /// </summary>
29 void Initialize();
30
31 /// <summary>
32 /// Gets the value of a variable whose prefix matches the extension.
33 /// </summary>
34 /// <param name="prefix">The prefix of the variable to be processed by the extension.</param>
35 /// <param name="name">The name of the variable.</param>
36 /// <returns>The value of the variable or null if the variable is undefined.</returns>
37 string GetVariableValue(string prefix, string name);
38
39 /// <summary>
40 /// Evaluates a function defined in the extension.
41 /// </summary>
42 /// <param name="prefix">The prefix of the function to be processed by the extension.</param>
43 /// <param name="function">The name of the function.</param>
44 /// <param name="args">The list of arguments.</param>
45 /// <returns>The value of the function or null if the function is not defined.</returns>
46 string EvaluateFunction(string prefix, string function, string[] args);
47
48 /// <summary>
49 /// Processes a pragma defined in the extension.
50 /// </summary>
51 /// <param name="sourceLineNumbers">The location of this pragma's PI.</param>
52 /// <param name="prefix">The prefix of the pragma to be processed by the extension.</param>
53 /// <param name="pragma">The name of the pragma.</param>
54 /// <param name="args">The pragma's arguments.</param>
55 /// <param name="parent">The parent node of the pragma.</param>
56 /// <returns>false if the pragma is not defined.</returns>
57 /// <comments>Don't return false for any condition except for unrecognized pragmas. Use Core.OnMessage for errors, warnings and messages.</comments>
58 bool ProcessPragma(SourceLineNumber sourceLineNumbers, string prefix, string pragma, string args, XContainer parent);
59
60 /// <summary>
61 /// Preprocess a document after normal preprocessing has completed.
62 /// </summary>
63 /// <param name="document">The document to preprocess.</param>
64 void PreprocessDocument(XDocument document);
65
66 /// <summary>
67 /// Preprocesses a parameter.
68 /// </summary>
69 /// <param name="name">Name of parameter that matches extension.</param>
70 /// <returns>The value of the parameter after processing.</returns>
71 /// <remarks>By default this method will cause an error if its called.</remarks>
72 string PreprocessParameter(string name);
73
74 /// <summary>
75 /// Called at the end of the preprocessing of a source file.
76 /// </summary>
77 void Finish();
78 }
79}