summaryrefslogtreecommitdiff
path: root/src/rtfx.cpp
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2004-07-22 22:30:48 +0000
committerStef Walter <stef@memberwebs.com>2004-07-22 22:30:48 +0000
commit879f4addd4c94492c21c36c0be98122a879907bf (patch)
tree81dba160573131e476cad13e8421aff07ccb5d11 /src/rtfx.cpp
parent7c93b2bab50b1ee28aee190a064b11daed247d83 (diff)
- Comments and formatting changes.
Diffstat (limited to 'src/rtfx.cpp')
-rw-r--r--src/rtfx.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/rtfx.cpp b/src/rtfx.cpp
index 7576d51..a620498 100644
--- a/src/rtfx.cpp
+++ b/src/rtfx.cpp
@@ -57,19 +57,25 @@ int main(int argc, char* argv[])
try
{
+ // The input file
FILE* file = fopen(argv[1], "rb");
if(!file)
{
- fprintf(stderr, "rtfx: couldn't open file: %s: %s\n", argv[1], strerror(errno));
+ fprintf(stderr, "rtfx: couldn't open rtf file: %s: %s\n", argv[1], strerror(errno));
return 1;
}
+ // Default options
RtfParserOptions options;
- RtfParser handler(options);
- RtfReader rtf;
- rtf.setHandler(&handler);
+ // Reads RTF tags and blocks
+ RtfParser rtf;
+
+ // Interprets tags and blocks from RTFParser
+ XMLComposer composer(options);
+ rtf.setHandler(&composer);
+
bool ret = rtf.parse(file);
fclose(file);
@@ -79,8 +85,9 @@ int main(int argc, char* argv[])
return 1;
}
-
- DOM::Document doc = handler.getDocument();
+ // TODO: This is disgusting. We need to bug the sablotron guys
+ // for a better way to serialize a document.
+ DOM::Document doc = composer.getDocument();
string xml = doc.serialize();
FILE* out = fopen(argv[2], "wb");
@@ -93,7 +100,6 @@ int main(int argc, char* argv[])
fwrite(xml.c_str(), 1, xml.length(), out);
fclose(out);
return 0;
-
}
catch(DOM::DOMException& e)
{