source: proto/gml2svg/C/intel/xslt/xslt_service.cpp @ 1703

Last change on this file since 1703 was 1703, checked in by ksherdy, 8 years ago

Added gml2svg prototypes.

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1/*
2 * XsltService.cpp
3 * Copyright (C) 2007, 2008 Ken Herdy
4 * Version 0.9
5 * Licensed to the public under the Open Software License 3.0.
6 */
7
8#include "xslt_service.hpp"
9using namespace std;
10
11XsltService::XsltService()//:_transformer_pool()
12{
13        this->_transform_factory = TransformFactory::newInstance();
14        this->_transformer_pool = new std::map<const char *, Templates *>();
15}
16
17XsltService::~XsltService()
18{
19        //for each template release the template
20        std::map<const char *, Templates *>::iterator iter;
21        iter = (this->_transformer_pool)->begin();
22       
23        for(iter;iter != (this->_transformer_pool)->begin(); iter++)
24        {
25                (this->_transform_factory)->releaseTemplates(iter->second);
26        }
27       
28        TransformFactory::releaseInstance(this->_transform_factory);
29}
30
31void XsltService::registerTemplates(const char * templates_id, Source * xslt)
32{
33        Templates * templates = (this->_transform_factory)->newTemplates(xslt);
34        std::pair<const char *, Templates *> p(templates_id, templates);
35        this->_transformer_pool->insert(p);
36}
37
38Templates * XsltService::getTemplates(const char * templates_id)
39{
40        std::map<const char *, Templates *>::iterator iter;
41        iter = (this->_transformer_pool)->find(templates_id); 
42       
43        if (iter != (this->_transformer_pool)->end())
44        {
45                return iter->second;
46        }
47        else
48        {
49                return NULL;
50        }
51}
Note: See TracBrowser for help on using the repository browser.