blob: e4cbc103bbfb8fda5b8da383f84c1975441f124a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#ifndef INPUTXSLT_SRC_TRANSFORMATION_FACADE_H_
#define INPUTXSLT_SRC_TRANSFORMATION_FACADE_H_
#include <xalanc/XalanTransformer/XalanTransformer.hpp>
#include <string>
#include <memory>
#include <sstream>
#include <functional>
#include "common.h"
#include "support/include_entity_resolver.h"
#include "support/stylesheet_parameter_guard.h"
#include "support/error/error_multiplexer.h"
#include "support/error/error_capacitor.h"
#include "support/error/warning_capacitor.h"
namespace InputXSLT {
class TransformationFacade {
public:
typedef std::unique_ptr<TransformationFacade> ptr;
template <typename... Arguments>
static ptr try_create(
const std::function<void(const ErrorCapacitor::error_cache&)>&,
Arguments&&...
);
TransformationFacade(
xalan::XSLTInputSource,
IncludeEntityResolver*
);
TransformationFacade(
xalan::XSLTInputSource,
xalan::XSLTInputSource,
IncludeEntityResolver*
);
void generate(std::basic_ostream<char>&);
void generate(std::basic_ostream<char>&, const xalan::XObjectPtr&);
void generate(xalan::FormatterListener&);
void generate(xalan::FormatterListener&, const xalan::XObjectPtr&);
WarningCapacitor::warning_cache_ptr getCachedWarnings();
private:
const xalan::XalanParsedSource* input_;
const xalan::XalanCompiledStylesheet* transformation_;
xalan::XalanTransformer transformer_;
ErrorMultiplexer error_multiplexer_;
WarningCapacitor warning_capacitor_;
};
template <typename... Arguments>
auto TransformationFacade::try_create(
const std::function<void(const ErrorCapacitor::error_cache&)>& handleErrors,
Arguments&&... arguments
) -> ptr {
try {
return ptr(
new InputXSLT::TransformationFacade(
std::forward<Arguments>(arguments)...
)
);
}
catch (const ErrorCapacitor::exception& exception) {
handleErrors(*exception);
return ptr();
}
}
}
#endif // INPUTXSLT_SRC_TRANSFORMATION_FACADE_H_
|