| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.expr; |
| 9 | |
| 10 | import net.sf.saxon.trace.ExpressionPresenter; |
| 11 | import net.sf.saxon.trans.XPathException; |
| 12 | |
| 13 | /** |
| 14 | * An export agent performs the job of exporting an expression to a SEF file. Normally |
| 15 | * the expression itself acts as its own export agent, and includes an export() method |
| 16 | * to do the exporting. In a few cases, notably literals containing function items, |
| 17 | * extra machinery is required to export a value, and a |
| 18 | * {@link com.saxonica.functions.hof.UserFunctionReference.BoundUserFunction} |
| 19 | * in particular includes custom export methods to handle different cases. |
| 20 | */ |
| 21 | |
| 22 | public interface ExportAgent { |
| 23 | |
| 24 | /** |
| 25 | * Diagnostic print of expression structure. The abstract expression tree |
| 26 | * is written to the supplied output destination. |
| 27 | * |
| 28 | * @param out the expression presenter used to display the structure |
| 29 | * @throws XPathException if the export fails, for example if an expression is found that won't work |
| 30 | * in the target environment. |
| 31 | */ |
| 32 | |
| 33 | void export(ExpressionPresenter out) throws XPathException; |
| 34 | } |