aboutsummaryrefslogtreecommitdiff
path: root/src/support/stylesheet_parameter_guard.cc
blob: f82c2d54d464497b0b945fe0bab82ae281084a6e (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
#include "stylesheet_parameter_guard.h"

namespace InputXSLT {

StylesheetParameterGuard::StylesheetParameterGuard(
	xalan::XalanTransformer& transformer
): transformer_(transformer) { }

StylesheetParameterGuard::StylesheetParameterGuard(
	xalan::XalanTransformer& transformer,
	const map& parameters
): transformer_(transformer) {
	this->set(parameters);
}

StylesheetParameterGuard::~StylesheetParameterGuard() {
	this->transformer_.clearStylesheetParams();
}

void StylesheetParameterGuard::set(const map& parameters) {
	for ( auto&& parameter : parameters ) {
		this->set(parameter.first, parameter.second);
	}
}

void StylesheetParameterGuard::set(
	const std::string& key,
	const std::string& value
) {
	this->transformer_.setStylesheetParam(
		key.data(),
		std::string("'" + value + "'").data()
	);
}

}