--- FeepingCreaturism/Jargon.cpp 2004/08/31 06:18:58 202 +++ FeepingCreaturism/Jargon.cpp 2004/09/06 09:13:51 224 @@ -5,35 +5,34 @@ // $Id$ #include "Jargon.hpp" +#include "Matcher.hpp" -Jargon::Jargon(const std::string& path) +Jargon::Jargon(const ext::String& path, bool include) { std::vector args(1, FeepingCreaturism::program); + args.push_back("-p"); + args.push_back("include"); + args.push_back(lexical_cast(include) + "()"); args.push_back(path); args.push_back("jargon.xsl"); - redi::pstreambuf pin("/usr/local/bin/Xalan", args, std::ios_base::in); - ios::StreamBufInputAdapter adaptor(pin); - ext::Handle document(xml::Parse(adaptor)); - ext::Handle jargon(*document/"jargon"); - - word = *jargon/"word"; - pronunciation = *jargon/"pronunciation"; - grammar = *jargon/"grammar"; - definition = *jargon/"definition"; -} + redi::ipstream pin("/usr/local/bin/Xalan", args); -std::ostream& operator<<(std::ostream& sout, const Jargon& jargon) -{ - ios::StreamBufOutputAdapter adaptor(*sout.rdbuf()); + if (include) + { + std::string ignore; - sout << jargon.word << '\n' << jargon.pronunciation << '\n' - << jargon.grammar << '\n' << jargon.definition.GetSize() << '\n'; + std::getline(pin, ignore); + } -/* ios::PrintWriter writer(adaptor); + do + { + std::string line; - writer << jargon.definition << '\n';*/ + std::getline(pin, line); - return sout; + buffer << line << '\n'; + } + while (pin.good()); }