CPPSERV


Home Projects Jobs Clientele Contact
CPPSERV Documentation Download TODO Mailing lists Bug tracker News RSS Feed Browse source

CompileTimeTaglib.cpp

Go to the documentation of this file.
00001 #include <servlet/taglib/CompileTimeTaglib.h>
00002 #include <servlet/taglib/Generator.h>
00003 #include <stdexcept>
00004 #include <iostream>
00005 namespace servlet
00006 {
00007 namespace taglib
00008 {
00009 
00010 CompileTimeTaglib::CompileTimeTaglib(const std::string& prefix)
00011     : Taglib(prefix)
00012 {
00013 }
00014 
00015 CompileTimeTaglib::TagFactoryBase::~TagFactoryBase()
00016 {
00017 }
00018 
00019 Generator* CompileTimeTaglib::getTag(const std::string& name)
00020 {
00021     tagfactorymap_t::iterator f = m_factoryMap.find(name);
00022     if(f == m_factoryMap.end())
00023         throw std::runtime_error("Generator for tag \""+name+"\" is not registered");
00024     std::string fullname = getPrefix()+":"+name;
00025     return f->second->makeTag(fullname);
00026 }
00027 
00028 void CompileTimeTaglib::releaseTag(Generator* tag)
00029 {
00030     delete tag;
00031 }
00032 
00033 void CompileTimeTaglib::registerTag(const std::string& name, TagFactoryBase* factory)
00034 {
00035     m_factoryMap[name] = factory;
00036 }
00037 
00038 } // namespace taglib
00039 } // namespace servlet

SourceForge.net Logo