// 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.
namespace WixToolset.Extensibility
{
using System;
using System.Xml.Linq;
using WixToolset.Data;
///
/// Interface for extending the WiX toolset preprocessor.
///
public interface IPreprocessorExtension
{
///
/// Gets or sets the preprocessor core for the extension.
///
/// Preprocessor core for the extension.
IPreprocessorCore Core { get; set; }
///
/// Gets the variable prefixes for the extension.
///
/// The variable prefixes for the extension.
string[] Prefixes { get; }
///
/// Called at the beginning of the preprocessing of a source file.
///
void Initialize();
///
/// Gets the value of a variable whose prefix matches the extension.
///
/// The prefix of the variable to be processed by the extension.
/// The name of the variable.
/// The value of the variable or null if the variable is undefined.
string GetVariableValue(string prefix, string name);
///
/// Evaluates a function defined in the extension.
///
/// The prefix of the function to be processed by the extension.
/// The name of the function.
/// The list of arguments.
/// The value of the function or null if the function is not defined.
string EvaluateFunction(string prefix, string function, string[] args);
///
/// Processes a pragma defined in the extension.
///
/// The location of this pragma's PI.
/// The prefix of the pragma to be processed by the extension.
/// The name of the pragma.
/// The pragma's arguments.
/// The parent node of the pragma.
/// false if the pragma is not defined.
/// Don't return false for any condition except for unrecognized pragmas. Use Core.OnMessage for errors, warnings and messages.
bool ProcessPragma(SourceLineNumber sourceLineNumbers, string prefix, string pragma, string args, XContainer parent);
///
/// Preprocess a document after normal preprocessing has completed.
///
/// The document to preprocess.
void PreprocessDocument(XDocument document);
///
/// Preprocesses a parameter.
///
/// Name of parameter that matches extension.
/// The value of the parameter after processing.
/// By default this method will cause an error if its called.
string PreprocessParameter(string name);
///
/// Called at the end of the preprocessing of a source file.
///
void Finish();
}
}