summaryrefslogtreecommitdiffstats
path: root/kttsd/filters/xhtml2ssml
diff options
context:
space:
mode:
Diffstat (limited to 'kttsd/filters/xhtml2ssml')
-rw-r--r--kttsd/filters/xhtml2ssml/main.cpp16
-rw-r--r--kttsd/filters/xhtml2ssml/xhtml2ssml.cpp34
-rw-r--r--kttsd/filters/xhtml2ssml/xhtml2ssml.h20
-rw-r--r--kttsd/filters/xhtml2ssml/xmlelement.cpp28
-rw-r--r--kttsd/filters/xhtml2ssml/xmlelement.h34
5 files changed, 66 insertions, 66 deletions
diff --git a/kttsd/filters/xhtml2ssml/main.cpp b/kttsd/filters/xhtml2ssml/main.cpp
index 822d068..01655ad 100644
--- a/kttsd/filters/xhtml2ssml/main.cpp
+++ b/kttsd/filters/xhtml2ssml/main.cpp
@@ -1,17 +1,17 @@
-#include <qapplication.h>
-#include <qfile.h>
-#include <qxml.h>
-#include <qmap.h>
+#include <tqapplication.h>
+#include <tqfile.h>
+#include <tqxml.h>
+#include <tqmap.h>
#include <iostream>
#include "xhtml2ssml.h"
#include "xmlelement.h"
int main(int argc, char *argv[]) {
- QApplication a(argc, argv);
- QFile f("demonstration.html");
- QXmlInputSource input(&f);
- QXmlSimpleReader reader;
+ TQApplication a(argc, argv);
+ TQFile f("demonstration.html");
+ TQXmlInputSource input(&f);
+ TQXmlSimpleReader reader;
XHTMLToSSMLParser *parser = new XHTMLToSSMLParser();
reader.setContentHandler(parser);
reader.parse(input);
diff --git a/kttsd/filters/xhtml2ssml/xhtml2ssml.cpp b/kttsd/filters/xhtml2ssml/xhtml2ssml.cpp
index 7c77b9e..5649cc9 100644
--- a/kttsd/filters/xhtml2ssml/xhtml2ssml.cpp
+++ b/kttsd/filters/xhtml2ssml/xhtml2ssml.cpp
@@ -19,10 +19,10 @@
* *
***************************************************************************/
-#include <qstring.h>
-#include <qdict.h>
-#include <qxml.h>
-#include <qfile.h>
+#include <tqstring.h>
+#include <tqdict.h>
+#include <tqxml.h>
+#include <tqfile.h>
#include <iostream>
#include "xmlelement.h"
@@ -32,13 +32,13 @@
/// Document parsing begin. Init stuff here.
bool XHTMLToSSMLParser::startDocument() {
/// Read the file which maps xhtml tags -> ssml tags. Look at the file for more information.
- QFile file("tagmappingrc");
+ TQFile file("tagmappingrc");
if(!file.open(IO_ReadOnly)) {
std::cerr << "Could not read config file 'tagmappingrc'. Please check that it exists and is readable.\n";
// Kill further parsing
return false;
}
- QTextStream stream(&file);
+ TQTextStream stream(&file);
// File parsing.
bool linestatus = true;
while(!stream.atEnd()) {
@@ -51,37 +51,37 @@ bool XHTMLToSSMLParser::startDocument() {
return true;
}
-bool XHTMLToSSMLParser::startElement(const QString &, const QString &, const QString &qName, const QXmlAttributes &atts) {
- QString attributes = "";
+bool XHTMLToSSMLParser::startElement(const TQString &, const TQString &, const TQString &qName, const TQXmlAttributes &atts) {
+ TQString attributes = "";
if(atts.length() > 0) {
const int attsLength = atts.lenght();
for(int i = 0; i < attsLength; ++i)
attributes += " " + atts.qName(i) + "=\"" + atts.value(i) + "\"";
}
- QString fromelement = qName + attributes;
+ TQString fromelement = qName + attributes;
// If this element is one of the keys that was specified in the configuration file, get what it should be converted to and
// append to the output string.
- QString toelement = m_xhtml2ssml[fromelement];
+ TQString toelement = m_xhtml2ssml[fromelement];
if(toelement)
m_output.append(XMLElement::fromQString(toelement).startTag());
return true;
}
-bool XHTMLToSSMLParser::endElement(const QString &, const QString &, const QString &qName) {
- QString fromelement = qName;
- QString toelement = m_xhtml2ssml[fromelement];
+bool XHTMLToSSMLParser::endElement(const TQString &, const TQString &, const TQString &qName) {
+ TQString fromelement = qName;
+ TQString toelement = m_xhtml2ssml[fromelement];
if(toelement)
m_output.append(XMLElement::fromQString(toelement).endTag());
return true;
}
-bool XHTMLToSSMLParser::characters(const QString &characters) {
+bool XHTMLToSSMLParser::characters(const TQString &characters) {
m_output.append(characters);
return true;
}
-QString XHTMLToSSMLParser::convertedText() {
+TQString XHTMLToSSMLParser::convertedText() {
return m_output.simplifyWhiteSpace();
}
@@ -89,7 +89,7 @@ QString XHTMLToSSMLParser::convertedText() {
/// It makes entries in the m_xhtml2ssml map accordingly.
/// @param line A line from a file to parse
/// @returns true if the syntax of the line was okay and the parsing succeeded - false otherwise.
-bool XHTMLToSSMLParser::readFileConfigEntry(const QString &line) {
+bool XHTMLToSSMLParser::readFileConfigEntry(const TQString &line) {
// comments
if(line.stripWhiteSpace().startsWith("#")) {
return true;
@@ -97,7 +97,7 @@ bool XHTMLToSSMLParser::readFileConfigEntry(const QString &line) {
// break into QStringList
// the second parameter to split is the string, with all space simplified and all space around the : removed, i.e
// "something : somethingelse" -> "something:somethingelse"
- QStringList keyvalue = QStringList::split(":", line.simplifyWhiteSpace().replace(" :", ":").replace(": ", ":"));
+ TQStringList keyvalue = TQStringList::split(":", line.simplifyWhiteSpace().replace(" :", ":").replace(": ", ":"));
if(keyvalue.count() != 2)
return false;
m_xhtml2ssml[keyvalue[0]] = keyvalue[1];
diff --git a/kttsd/filters/xhtml2ssml/xhtml2ssml.h b/kttsd/filters/xhtml2ssml/xhtml2ssml.h
index 7271dc0..2e45dee 100644
--- a/kttsd/filters/xhtml2ssml/xhtml2ssml.h
+++ b/kttsd/filters/xhtml2ssml/xhtml2ssml.h
@@ -22,40 +22,40 @@
#ifndef _XHTML2SSML_H_
#define _XHTML2SSML_H_
-#include <qxml.h>
-#include <qmap.h>
+#include <tqxml.h>
+#include <tqmap.h>
-typedef QMap<QString, QString> QStringMap;
+typedef TQMap<TQString, TQString> QStringMap;
class QString;
-class XHTMLToSSMLParser : public QXmlDefaultHandler {
+class XHTMLToSSMLParser : public TQXmlDefaultHandler {
public:
/// No need to reimplement constructor..
/// The document parsing starts
bool startDocument();
/// start of an element encountered (<element foo="bar">)
- bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts);
+ bool startElement(const TQString &namespaceURI, const TQString &localName, const TQString &qName, const TQXmlAttributes &atts);
/// end of an element encountered (</element>)
- bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName);
+ bool endElement(const TQString &namespaceURI, const TQString &localName, const TQString &qName);
/// text encountered (blah bah blah)
- bool characters(const QString &);
+ bool characters(const TQString &);
/// Get the output text that was generated during the parsing.
/// @returns The converted text.
- QString convertedText();
+ TQString convertedText();
/// Parse a line from the configuration file which maps xhtml : ssml equivalent.
/// It makes entries in the m_xhtml2ssml map accordingly.
/// @param line A line from a file to parse
/// @returns true if the syntax of the line was okay and the parsing succeeded - false otherwise.
- bool readFileConfigEntry(const QString &line);
+ bool readFileConfigEntry(const TQString &line);
private:
/// Dict of xhtml tags -> ssml tags
QStringMap m_xhtml2ssml;
/// The output of the conversion
- QString m_output;
+ TQString m_output;
};
#endif
diff --git a/kttsd/filters/xhtml2ssml/xmlelement.cpp b/kttsd/filters/xhtml2ssml/xmlelement.cpp
index 53fa4f6..920fd57 100644
--- a/kttsd/filters/xhtml2ssml/xmlelement.cpp
+++ b/kttsd/filters/xhtml2ssml/xmlelement.cpp
@@ -19,7 +19,7 @@
***************************************************************************/
#include "xmlelement.h"
-#include <qstringlist.h>
+#include <tqstringlist.h>
#include <iostream>
/// Constructors
@@ -27,7 +27,7 @@ XMLElement::XMLElement() {
m_name = "";
m_attrmapper = AttributeToValueMap();
}
-XMLElement::XMLElement(const QString &name) {
+XMLElement::XMLElement(const TQString &name) {
m_name = name;
m_attrmapper = AttributeToValueMap();
}
@@ -49,11 +49,11 @@ XMLElement XMLElement::operator=(const XMLElement &element) {
return *this;
}
-QString XMLElement::name() {
+TQString XMLElement::name() {
return m_name;
}
-QString XMLElement::startTag() {
- QString output = "<" + m_name + " ";
+TQString XMLElement::startTag() {
+ TQString output = "<" + m_name + " ";
for(AttributeToValueMap::Iterator it = m_attrmapper.begin(); it != m_attrmapper.end(); ++it) {
output.append(it.key() + "=\"" + it.data() + "\" ");
}
@@ -63,25 +63,25 @@ QString XMLElement::startTag() {
return output;
}
-QString XMLElement::endTag() {
+TQString XMLElement::endTag() {
return "</" + m_name + ">";
}
-void XMLElement::setAttribute(const QString &attr, const QString &value) {
+void XMLElement::setAttribute(const TQString &attr, const TQString &value) {
m_attrmapper[attr] = value;
}
-QString XMLElement::attribute(const QString &attr) {
+TQString XMLElement::attribute(const TQString &attr) {
return m_attrmapper[attr];
}
-QString XMLElement::toQString() {
- QString tag = startTag();
+TQString XMLElement::toQString() {
+ TQString tag = startTag();
return tag.left(tag.length() - 1).right(tag.length() - 2);
}
-XMLElement XMLElement::fromQString(const QString &str) {
- QStringList sections = QStringList::split(" ", str);
- QString tagname = sections[0];
+XMLElement XMLElement::fromQString(const TQString &str) {
+ TQStringList sections = TQStringList::split(" ", str);
+ TQString tagname = sections[0];
XMLElement e(tagname.latin1());
sections.pop_front();
@@ -89,7 +89,7 @@ XMLElement XMLElement::fromQString(const QString &str) {
if(sections.count()) {
const int sectionsCount = sections.count();
for(int i = 0; i < sectionsCount; ++i) {
- QStringList list = QStringList::split("=", sections[i]);
+ TQStringList list = TQStringList::split("=", sections[i]);
if(list.count() != 2) {
std::cerr << "XMLElement::fromQString: Cannot convert list: " << list.join("|") << ". `" << str << "' is not in valid format.\n";
return XMLElement(" ");
diff --git a/kttsd/filters/xhtml2ssml/xmlelement.h b/kttsd/filters/xhtml2ssml/xmlelement.h
index c78cd6f..f3d8789 100644
--- a/kttsd/filters/xhtml2ssml/xmlelement.h
+++ b/kttsd/filters/xhtml2ssml/xmlelement.h
@@ -22,16 +22,16 @@
#ifndef XMLELEMENT_H
#define XMLELEMENT_H
-#include <qmap.h>
+#include <tqmap.h>
class QString;
-typedef QMap<QString, QString> AttributeToValueMap;
+typedef TQMap<TQString, TQString> AttributeToValueMap;
class XMLElement {
public:
XMLElement();
- XMLElement(const QString &name);
+ XMLElement(const TQString &name);
~XMLElement();
/// Copy constructor
@@ -42,11 +42,11 @@ public:
/// Get the name of the tag (the text between the greater than and less than symbols).
/// @returns the name of the tag.
- QString name();
+ TQString name();
/// set the name of the tag.
/// @param name the new name of the tag.
- void setName(const QString &name);
+ void setName(const TQString &name);
/// Get a textual representation of the starting of the tag with all attributes and their values set out.
/// @verbatim
@@ -55,35 +55,35 @@ public:
/// element.startTag(); <- <elem foo="bar">
/// @endverbatim
/// @returns A textual representation of the start of the element.
- QString startTag();
+ TQString startTag();
/// Get a textual representation of the closed tag that XMLElement represents.
/// @returns A textual representation of the closed tag represented by the XMLElement.
- QString endTag();
+ TQString endTag();
/// Create an attribute and set its value.
/// @param attr The attribute.
/// @param value The value of the attribute.
- void setAttribute(const QString &attr, const QString &value);
+ void setAttribute(const TQString &attr, const TQString &value);
/// Get the value of an attribute.
/// @param attr The attribute.
/// @returns The value of @param attr
- QString attribute(const QString &attr);
+ TQString attribute(const TQString &attr);
- /// Convert to a QString.
- /// Had issues with QMap and custom classes. For now you can just convert to/from QString and use
+ /// Convert to a TQString.
+ /// Had issues with TQMap and custom classes. For now you can just convert to/from TQString and use
/// That as the key/value pair.
- /// @returns A QString representation of the XMLAttribute.
- QString toQString();
+ /// @returns A TQString representation of the XMLAttribute.
+ TQString toQString();
- /// Create an XMLElement from a QString.
- /// @param str The QString to convert from. Must be of the following syntax- "foo name=\"bar\""
- static XMLElement fromQString(const QString &str);
+ /// Create an XMLElement from a TQString.
+ /// @param str The TQString to convert from. Must be of the following syntax- "foo name=\"bar\""
+ static XMLElement fromQString(const TQString &str);
private:
/// The name of the tag.
- QString m_name;
+ TQString m_name;
/// Attribute : value mappings.
AttributeToValueMap m_attrmapper;
};