1 |
// Feeping Creaturism |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#include "Jargon.hpp" |
8 |
|
9 |
Jargon::Jargon(const std::string& path) |
10 |
{ |
11 |
std::vector<std::string> args(1, FeepingCreaturism::program); |
12 |
|
13 |
args.push_back(path); |
14 |
args.push_back("jargon.xsl"); |
15 |
|
16 |
redi::pstreambuf pin("/usr/local/bin/Xalan", args, std::ios_base::in); |
17 |
ios::StreamBufInputAdapter adaptor(pin); |
18 |
ext::Handle<xml::Document> document(xml::Parse(adaptor)); |
19 |
ext::Handle<xml::Node> jargon(*document/"Jargon"); |
20 |
|
21 |
word = *jargon/"Word"; |
22 |
pronunciation = *jargon/"Pronunciation"; |
23 |
grammar = *jargon/"Grammar"; |
24 |
definition = *jargon/"Definition"; |
25 |
} |
26 |
|
27 |
std::ostream& operator<<(std::ostream& sout, const Jargon& jargon) |
28 |
{ |
29 |
ios::StreamBufOutputAdapter adaptor(*sout.rdbuf()); |
30 |
|
31 |
sout << jargon.word << '\n' << jargon.pronunciation << '\n' |
32 |
<< jargon.grammar << '\n' << jargon.definition.GetSize() << '\n'; |
33 |
|
34 |
/* ios::PrintWriter writer(adaptor); |
35 |
|
36 |
writer << jargon.definition << '\n';*/ |
37 |
|
38 |
return sout; |
39 |
} |