diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-08-20 14:22:07 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-08-20 14:25:49 -0700 |
| commit | 3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c (patch) | |
| tree | bbe907a4c5ebf7aa5e3f02141f6e3abd31cb7b5c /src/WixToolset.Extensibility/PreprocessorExtension.cs | |
| parent | 6dee3b45cb679786bd49a5db8fde9006d283b3e2 (diff) | |
| download | wix-3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c.tar.gz wix-3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c.tar.bz2 wix-3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c.zip | |
Move to .NET Core 2.0
Diffstat (limited to 'src/WixToolset.Extensibility/PreprocessorExtension.cs')
| -rw-r--r-- | src/WixToolset.Extensibility/PreprocessorExtension.cs | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/WixToolset.Extensibility/PreprocessorExtension.cs b/src/WixToolset.Extensibility/PreprocessorExtension.cs new file mode 100644 index 00000000..2af30a95 --- /dev/null +++ b/src/WixToolset.Extensibility/PreprocessorExtension.cs | |||
| @@ -0,0 +1,99 @@ | |||
| 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.Data; | ||
| 7 | |||
| 8 | /// <summary> | ||
| 9 | /// Base class for creating a preprocessor extension. | ||
| 10 | /// </summary> | ||
| 11 | public abstract class PreprocessorExtension : IPreprocessorExtension | ||
| 12 | { | ||
| 13 | /// <summary> | ||
| 14 | /// Gets or sets the preprocessor core for the extension. | ||
| 15 | /// </summary> | ||
| 16 | /// <value>Preprocessor core for the extension.</value> | ||
| 17 | public IPreprocessorCore Core { get; set; } | ||
| 18 | |||
| 19 | /// <summary> | ||
| 20 | /// Gets or sets the variable prefixes for the extension. | ||
| 21 | /// </summary> | ||
| 22 | /// <value>The variable prefixes for the extension.</value> | ||
| 23 | public virtual string[] Prefixes | ||
| 24 | { | ||
| 25 | get { return null; } | ||
| 26 | } | ||
| 27 | |||
| 28 | /// <summary> | ||
| 29 | /// Called at the beginning of the preprocessing of a source file. | ||
| 30 | /// </summary> | ||
| 31 | public virtual void Initialize() | ||
| 32 | { | ||
| 33 | } | ||
| 34 | |||
| 35 | /// <summary> | ||
| 36 | /// Gets the value of a variable whose prefix matches the extension. | ||
| 37 | /// </summary> | ||
| 38 | /// <param name="prefix">The prefix of the variable to be processed by the extension.</param> | ||
| 39 | /// <param name="name">The name of the variable.</param> | ||
| 40 | /// <returns>The value of the variable or null if the variable is undefined.</returns> | ||
| 41 | public virtual string GetVariableValue(string prefix, string name) | ||
| 42 | { | ||
| 43 | return null; | ||
| 44 | } | ||
| 45 | |||
| 46 | /// <summary> | ||
| 47 | /// Evaluates a function defined in the extension. | ||
| 48 | /// </summary> | ||
| 49 | /// <param name="prefix">The prefix of the function to be processed by the extension.</param> | ||
| 50 | /// <param name="function">The name of the function.</param> | ||
| 51 | /// <param name="args">The list of arguments.</param> | ||
| 52 | /// <returns>The value of the function or null if the function is not defined.</returns> | ||
| 53 | public virtual string EvaluateFunction(string prefix, string function, string[] args) | ||
| 54 | { | ||
| 55 | return null; | ||
| 56 | } | ||
| 57 | |||
| 58 | /// <summary> | ||
| 59 | /// Processes a pragma defined in the extension. | ||
| 60 | /// </summary> | ||
| 61 | /// <param name="sourceLineNumbers">The location of this pragma's PI.</param> | ||
| 62 | /// <param name="prefix">The prefix of the pragma to be processed by the extension.</param> | ||
| 63 | /// <param name="pragma">The name of the pragma.</param> | ||
| 64 | /// <param name="args">The pragma's arguments.</param> | ||
| 65 | /// <param name="parent">The parent node of the pragma.</param> | ||
| 66 | /// <returns>false if the pragma is not defined.</returns> | ||
| 67 | /// <comments>Don't return false for any condition except for unrecognized pragmas. Throw errors that are fatal to the compile. use core.OnMessage for warnings and messages.</comments> | ||
| 68 | public virtual bool ProcessPragma(SourceLineNumber sourceLineNumbers, string prefix, string pragma, string args, XContainer parent) | ||
| 69 | { | ||
| 70 | return false; | ||
| 71 | } | ||
| 72 | |||
| 73 | /// <summary> | ||
| 74 | /// Preprocess a document after normal preprocessing has completed. | ||
| 75 | /// </summary> | ||
| 76 | /// <param name="document">The document to preprocess.</param> | ||
| 77 | public virtual void PreprocessDocument(XDocument document) | ||
| 78 | { | ||
| 79 | } | ||
| 80 | |||
| 81 | /// <summary> | ||
| 82 | /// Preprocesses a parameter. | ||
| 83 | /// </summary> | ||
| 84 | /// <param name="name">Name of parameter that matches extension.</param> | ||
| 85 | /// <returns>The value of the parameter after processing.</returns> | ||
| 86 | /// <remarks>By default this method will cause an error if its called.</remarks> | ||
| 87 | public virtual string PreprocessParameter(string name) | ||
| 88 | { | ||
| 89 | return null; | ||
| 90 | } | ||
| 91 | |||
| 92 | /// <summary> | ||
| 93 | /// Called at the end of the preprocessing of a source file. | ||
| 94 | /// </summary> | ||
| 95 | public virtual void Finish() | ||
| 96 | { | ||
| 97 | } | ||
| 98 | } | ||
| 99 | } | ||
