6 |
|
|
7 |
|
#include "Jargon.hpp" |
8 |
|
|
9 |
< |
Jargon::Jargon(const std::string& path) |
9 |
> |
Jargon::Jargon(const ext::String& path, bool include) |
10 |
|
{ |
11 |
|
std::vector<std::string> args(1, FeepingCreaturism::program); |
12 |
|
|
13 |
+ |
args.push_back("-p"); |
14 |
+ |
args.push_back("include"); |
15 |
+ |
args.push_back(lexical_cast<ext::String>(include) + "()"); |
16 |
|
args.push_back(path); |
17 |
|
args.push_back("jargon.xsl"); |
18 |
|
|
19 |
< |
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'; |
19 |
> |
redi::ipstream pin("/usr/local/bin/Xalan", args); |
20 |
|
|
21 |
< |
/* ios::PrintWriter writer(adaptor); |
21 |
> |
do |
22 |
> |
{ |
23 |
> |
std::string line; |
24 |
|
|
25 |
< |
writer << jargon.definition << '\n';*/ |
25 |
> |
std::getline(pin, line); |
26 |
|
|
27 |
< |
return sout; |
27 |
> |
buffer << line << '\n'; |
28 |
> |
} |
29 |
> |
while (pin.good()); |
30 |
|
} |