void streamContentHandler::extract(utility::outputStream& os, utility::progressListener* progress) const { if (!m_stream) return; // No decoding to perform if (!isEncoded()) { m_stream->reset(); // may not work... if (progress) utility::bufferedStreamCopy(*m_stream, os, getLength(), progress); else utility::bufferedStreamCopy(*m_stream, os); } // Need to decode data else { ref <utility::encoder::encoder> theDecoder = m_encoding.getEncoder(); m_stream->reset(); // may not work... utility::progressListenerSizeAdapter plsa(progress, getLength()); theDecoder->decode(*m_stream, os, &plsa); } }
void IMAPMessagePartContentHandler::extract (utility::outputStream& os, utility::progressListener* progress) const { ref <IMAPMessage> msg = m_message.acquire().constCast <IMAPMessage>(); ref <part> part = m_part.acquire().constCast <class part>(); // No decoding to perform if (!isEncoded()) { msg->extractPart(part, os, progress); } // Need to decode data else { // Extract part contents to temporary buffer std::ostringstream oss; utility::outputStreamAdapter tmp(oss); msg->extractPart(part, tmp, NULL); // Encode temporary buffer to output stream utility::inputStreamStringAdapter is(oss.str()); utility::progressListenerSizeAdapter plsa(progress, getLength()); ref <utility::encoder::encoder> theDecoder = m_encoding.getEncoder(); theDecoder->decode(is, os, &plsa); } }
void stringContentHandler::extract(utility::outputStream& os, utility::progressListener* progress) const { // No decoding to perform if (!isEncoded()) { m_string.extract(os, 0, m_string.length(), progress); } // Need to decode data else { ref <utility::encoder::encoder> theDecoder = m_encoding.getEncoder(); utility::inputStreamStringProxyAdapter in(m_string); utility::progressListenerSizeAdapter plsa(progress, getLength()); theDecoder->decode(in, os, &plsa); } }
int main() { LOGGER_SYS_INIT("conf/log.conf") xforce::ml::Conf conf; if (!conf.Init()) { std::cout << "fail_init_conf" << std::endl; return 1; } xforce::ml::Data data; if (!data.Init(conf)) { std::cout << "fail_init_data" << std::endl; return 2; } xforce::ml::Plsa plsa(conf, data); plsa.Start(); plsa.Stop(); return 0; }