Channel* LoggingConfigurator::createChannel(AbstractConfiguration* pConfig) { AutoPtr<Channel> pChannel(LoggingFactory::defaultFactory().createChannel(pConfig->getString("class"))); AutoPtr<Channel> pWrapper(pChannel); AbstractConfiguration::Keys props; pConfig->keys(props); for (AbstractConfiguration::Keys::const_iterator it = props.begin(); it != props.end(); ++it) { if (*it == "pattern") { AutoPtr<Formatter> pPatternFormatter(new PatternFormatter(pConfig->getString(*it))); pWrapper = new FormattingChannel(pPatternFormatter, pChannel); } else if (*it == "formatter") { AutoPtr<FormattingChannel> pFormattingChannel(new FormattingChannel(0, pChannel)); if (pConfig->hasProperty("formatter.class")) { AutoPtr<AbstractConfiguration> pFormatterConfig(pConfig->createView(*it)); AutoPtr<Formatter> pFormatter(createFormatter(pFormatterConfig)); pFormattingChannel->setFormatter(pFormatter); } else pFormattingChannel->setProperty(*it, pConfig->getString(*it)); #if defined(__GNUC__) && __GNUC__ < 3 pWrapper = pFormattingChannel.duplicate(); #else pWrapper = pFormattingChannel; #endif } } return pWrapper.duplicate(); }
void WKTWriter::writeFormatted(const Geometry *geometry, bool isFormatted, Writer *writer) { CLocalizer clocale; this->isFormatted=isFormatted; formatter=createFormatter(geometry->getPrecisionModel()); appendGeometryTaggedText(geometry, 0, writer); }
void LoggingConfigurator::configureFormatters(AbstractConfiguration* pConfig) { AbstractConfiguration::Keys formatters; pConfig->keys(formatters); for (AbstractConfiguration::Keys::const_iterator it = formatters.begin(); it != formatters.end(); ++it) { AutoPtr<AbstractConfiguration> pFormatterConfig(pConfig->createView(*it)); AutoPtr<Formatter> pFormatter(createFormatter(pFormatterConfig)); LoggingRegistry::defaultRegistry().registerFormatter(*it, pFormatter); } }
IEclPlusHelper * createEclPlusHelper(IProperties * globals) { // Check to see what kind of helper to return ! IFormatType * format = createFormatter(globals); IEclPlusHelper * helper = NULL; if(globals->hasProp("action")) { const char * action = globals->queryProp("action"); if(!stricmp(action, "list")) { helper = new ListHelper(LINK(globals), format); } // Now re-enable delete else if(!stricmp(action, "delete")) { helper = new DeleteHelper(LINK(globals), format); } else if(!stricmp(action, "dump")) { helper = new DumpHelper(LINK(globals), format); } else if(!stricmp(action, "graph")) { helper = new GraphHelper(LINK(globals), format); } else if(!stricmp(action, "view")) { helper = new ViewHelper(LINK(globals), format); } else if(!stricmp(action, "query")) { helper = new QueryHelper(LINK(globals), format); } else if(!stricmp(action, "abort")) { helper = new AbortHelper(LINK(globals), format); } else if(!stricmp(action, "rerun")) { helper = new RerunHelper(LINK(globals), format); } else { ::Release(format); throw MakeStringException(-1, "unknown action"); } } else ::Release(format); return helper; }