/*
 * EngineManager.cs --
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 */

using System.IO;
using System.Text;
using Eagle._Attributes;
using Eagle._Components.Public;
using Eagle._Components.Public.Delegates;
using Eagle._Containers.Public;

namespace Eagle._Interfaces.Public
{
    [ObjectId("6d41d61d-1173-4034-b5c3-3e929e5c7f24")]
    public interface IEngineManager
    {
        ///////////////////////////////////////////////////////////////////////
        // SCRIPT CANCELLATION
        ///////////////////////////////////////////////////////////////////////

        ReturnCode IsCanceled(
            bool updateResult,
            ref Result result
            );

        ReturnCode CancelEvaluate(
            bool unwind,
            Result result,
            ref Result error
            );

        ReturnCode CancelAnyEvaluate(
            bool unwind,
            bool strict,
            Result result,
            ref Result error
            );

        ///////////////////////////////////////////////////////////////////////
        // SCRIPT EVALUATION
        ///////////////////////////////////////////////////////////////////////

        ReturnCode EvaluateScript(
            string text,
            ref Result result
            );

        ReturnCode EvaluateScript(
            string text,
            ref Result result,
            ref int errorLine
            );

        ReturnCode EvaluateGlobalScript(
            string text,
            ref Result result
            );

        ReturnCode EvaluateGlobalScript(
            string text,
            ref Result result,
            ref int errorLine
            );

        ReturnCode EvaluateScript(
            IScript script,
            ref Result result
            );

        ReturnCode EvaluateScript(
            IScript script,
            ref Result result,
            ref int errorLine
            );

        ReturnCode EvaluateFile(
            string fileName,
            ref Result result
            );

        ReturnCode EvaluateFile(
            string fileName,
            ref Result result,
            ref int errorLine
            );

        ReturnCode EvaluateFile(
            Encoding encoding,
            string fileName,
            ref Result result
            );

        ReturnCode EvaluateFile(
            Encoding encoding,
            string fileName,
            ref Result result,
            ref int errorLine
            );

        ReturnCode EvaluateGlobalFile(
            string fileName,
            ref Result result
            );

        ReturnCode EvaluateGlobalFile(
            string fileName,
            ref Result result,
            ref int errorLine
            );

        ReturnCode EvaluateGlobalFile(
            Encoding encoding,
            string fileName,
            ref Result result
            );

        ReturnCode EvaluateGlobalFile(
            Encoding encoding,
            string fileName,
            ref Result result,
            ref int errorLine
            );

        ReturnCode EvaluateStream(
            string name,
            TextReader textReader,
            int startIndex,
            int characters,
            ref Result result,
            ref int errorLine
            );

        ReturnCode EvaluateGlobalStream(
            string name,
            TextReader textReader,
            int startIndex,
            int characters,
            ref Result result,
            ref int errorLine
            );

        ///////////////////////////////////////////////////////////////////////
        // TRUSTED SCRIPT EVALUATION
        ///////////////////////////////////////////////////////////////////////

        ReturnCode EvaluateTrustedScript(
            string text,
            bool force,
            ref Result result
            );

        ReturnCode EvaluateTrustedScript(
            string text,
            bool force,
            ref Result result,
            ref int errorLine
            );

        ReturnCode EvaluateTrustedFile(
            Encoding encoding,
            string fileName,
            bool force,
            ref Result result
            );

        ReturnCode EvaluateTrustedFile(
            Encoding encoding,
            string fileName,
            bool force,
            ref Result result,
            ref int errorLine
            );

        ReturnCode EvaluateTrustedStream(
            string name,
            TextReader textReader,
            int startIndex,
            int characters,
            bool force,
            ref Result result
            );

        ReturnCode EvaluateTrustedStream(
            string name,
            TextReader textReader,
            int startIndex,
            int characters,
            bool force,
            ref Result result,
            ref int errorLine
            );

        ///////////////////////////////////////////////////////////////////////
        // EXPRESSION EVALUATION
        ///////////////////////////////////////////////////////////////////////

        ReturnCode EvaluateExpression(
            string text,
            ref Result result
            );

        ///////////////////////////////////////////////////////////////////////
        // SUBSTITUTION PROCESSING
        ///////////////////////////////////////////////////////////////////////

        ReturnCode SubstituteString(
            string text,
            ref Result result
            );

        ReturnCode SubstituteString(
            string text,
            SubstitutionFlags substitutionFlags,
            ref Result result
            );

        ReturnCode SubstituteGlobalString(
            string text,
            ref Result result
            );

        ReturnCode SubstituteGlobalString(
            string text,
            SubstitutionFlags substitutionFlags,
            ref Result result
            );

        ReturnCode SubstituteFile(
            string fileName,
            ref Result result
            );

        ReturnCode SubstituteFile(
            string fileName,
            SubstitutionFlags substitutionFlags,
            ref Result result
            );

        ReturnCode SubstituteGlobalFile(
            string fileName,
            ref Result result
            );

        ReturnCode SubstituteGlobalFile(
            string fileName,
            SubstitutionFlags substitutionFlags,
            ref Result result
            );

        ReturnCode SubstituteStream(
            string name,
            TextReader textReader,
            int startIndex,
            int characters,
            ref Result result
            );

        ReturnCode SubstituteStream(
            string name,
            TextReader textReader,
            int startIndex,
            int characters,
            SubstitutionFlags substitutionFlags,
            ref Result result
            );

        ReturnCode SubstituteGlobalStream(
            string name,
            TextReader textReader,
            int startIndex,
            int characters,
            ref Result result
            );

        ReturnCode SubstituteGlobalStream(
            string name,
            TextReader textReader,
            int startIndex,
            int characters,
            SubstitutionFlags substitutionFlags,
            ref Result result
            );

        ///////////////////////////////////////////////////////////////////////
        // ASYNCHRONOUS SCRIPT EVALUATION
        ///////////////////////////////////////////////////////////////////////

        ReturnCode EvaluateScript(
            string text,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error
            );

        ReturnCode EvaluateGlobalScript(
            string text,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error
            );

        ReturnCode EvaluateFile(
            string fileName,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error
            );

        ReturnCode EvaluateGlobalFile(
            string fileName,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error
            );

        ///////////////////////////////////////////////////////////////////////
        // ASYNCHRONOUS SUBSTITUTION PROCESSING
        ///////////////////////////////////////////////////////////////////////

        ReturnCode SubstituteString(
            string text,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error
            );

        ReturnCode SubstituteString(
            string text,
            SubstitutionFlags substitutionFlags,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error);

        ReturnCode SubstituteGlobalString(
            string text,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error
            );

        ReturnCode SubstituteGlobalString(
            string text,
            SubstitutionFlags substitutionFlags,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error);

        ReturnCode SubstituteFile(
            string fileName,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error
            );

        ReturnCode SubstituteFile(
            string fileName,
            SubstitutionFlags substitutionFlags,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error
            );

        ReturnCode SubstituteGlobalFile(
            string fileName,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error
            );

        ReturnCode SubstituteGlobalFile(
            string fileName,
            SubstitutionFlags substitutionFlags,
            AsynchronousCallback callback,
            IClientData clientData,
            ref Result error
            );

        ///////////////////////////////////////////////////////////////////////
        // COMMAND EXECUTION
        ///////////////////////////////////////////////////////////////////////

        ReturnCode Invoke(
            string name,
            IClientData clientData,
            ArgumentList arguments,
            ref Result result
            );
    }
}
