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