diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 06:10:56 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 06:10:56 +0000 |
commit | 769e63d24adf5c844137484f06a972fcce732d6a (patch) | |
tree | 5185797dcb3ff4b1b3cb71d367123bf89eb2410f /src/kmplayerplaylist.cpp | |
parent | 0a8af92185eac74d48da1225e6053a0d66c078f5 (diff) | |
download | kmplayer-769e63d24adf5c844137484f06a972fcce732d6a.tar.gz kmplayer-769e63d24adf5c844137484f06a972fcce732d6a.zip |
TQt4 port kmplayer
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmplayer@1238840 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kmplayerplaylist.cpp')
-rw-r--r-- | src/kmplayerplaylist.cpp | 296 |
1 files changed, 148 insertions, 148 deletions
diff --git a/src/kmplayerplaylist.cpp b/src/kmplayerplaylist.cpp index e2db4f3..9e1db11 100644 --- a/src/kmplayerplaylist.cpp +++ b/src/kmplayerplaylist.cpp @@ -19,7 +19,7 @@ #include <config.h> #include <time.h> -#include <qtextstream.h> +#include <tqtextstream.h> #include <kdebug.h> #include <kurl.h> #ifdef HAVE_EXPAT @@ -45,7 +45,7 @@ using namespace KMPlayer; //----------------------------------------------------------------------------- namespace KMPlayer { - Node * fromXMLDocumentTag (NodePtr & d, const QString & tag) { + Node * fromXMLDocumentTag (NodePtr & d, const TQString & tag) { const char * const name = tag.latin1 (); if (!strcmp (name, "smil")) return new SMIL::Smil (d); @@ -60,7 +60,7 @@ namespace KMPlayer { else if (!strcasecmp (name, "playlist")) return new XSPF::Playlist (d); else if (!strcasecmp (name, "url")) - return new GenericURL (d, QString ()); + return new GenericURL (d, TQString ()); else if (!strcasecmp (name, "mrl") || !strcasecmp (name, "document")) return new GenericMrl (d); @@ -70,21 +70,21 @@ namespace KMPlayer { //----------------------------------------------------------------------------- struct XMLStringlet { - const QString str; - XMLStringlet (const QString & s) : str (s) {} + const TQString str; + XMLStringlet (const TQString & s) : str (s) {} }; } // namespace -QTextStream & operator << (QTextStream & out, const XMLStringlet & txt) { +TQTextStream & operator << (TQTextStream & out, const XMLStringlet & txt) { int len = int (txt.str.length ()); for (int i = 0; i < len; ++i) { - if (txt.str [i] == QChar ('<')) { + if (txt.str [i] == TQChar ('<')) { out << "<"; - } else if (txt.str [i] == QChar ('>')) { + } else if (txt.str [i] == TQChar ('>')) { out << ">"; - } else if (txt.str [i] == QChar ('"')) { + } else if (txt.str [i] == TQChar ('"')) { out << """; - } else if (txt.str [i] == QChar ('&')) { + } else if (txt.str [i] == TQChar ('&')) { out << "&"; } else out << txt.str [i]; @@ -296,7 +296,7 @@ void Node::clearChildren () { if (m_doc) document()->m_tree_version++; while (m_first_child != m_last_child) { - // avoid stack abuse with 10k children derefing each other + // avoid stack abuse with 10k tqchildren derefing each other m_last_child->m_parent = 0L; m_last_child = m_last_child->m_prev; m_last_child->m_next = 0L; @@ -308,7 +308,7 @@ void Node::clearChildren () { void Node::appendChild (NodePtr c) { document()->m_tree_version++; - ASSERT (!c->parentNode ()); + ASSERT (!c->tqparentNode ()); TreeNode<Node>::appendChild (c); } @@ -316,7 +316,7 @@ void Node::insertBefore (NodePtr c, NodePtr b) { if (!b) { appendChild (c); } else { - ASSERT (!c->parentNode ()); + ASSERT (!c->tqparentNode ()); document()->m_tree_version++; if (b->m_prev) { b->m_prev->m_next = c; @@ -358,11 +358,11 @@ KDE_NO_EXPORT void Node::replaceChild (NodePtr _new, NodePtr old) { old->m_parent = 0L; } -NodePtr Node::childFromTag (const QString &) { +NodePtr Node::childFromTag (const TQString &) { return NodePtr (); } -KDE_NO_EXPORT void Node::characterData (const QString & s) { +KDE_NO_EXPORT void Node::characterData (const TQString & s) { document()->m_tree_version++; if (!m_last_child || m_last_child->id != id_node_text) appendChild (new TextNode (m_doc, s)); @@ -375,7 +375,7 @@ void Node::normalize () { while (e) { NodePtr tmp = e->nextSibling (); if (!e->isElementNode () && e->id == id_node_text) { - QString val = e->nodeValue ().simplifyWhiteSpace (); + TQString val = e->nodeValue ().simplifyWhiteSpace (); if (val.isEmpty ()) removeChild (e); else @@ -386,7 +386,7 @@ void Node::normalize () { } } -static void getInnerText (const NodePtr p, QTextOStream & out) { +static void getInnerText (const NodePtr p, TQTextOStream & out) { for (NodePtr e = p->firstChild (); e; e = e->nextSibling ()) { if (e->id == id_node_text || e->id == id_node_cdata) out << e->nodeValue (); @@ -395,48 +395,48 @@ static void getInnerText (const NodePtr p, QTextOStream & out) { } } -QString Node::innerText () const { - QString buf; - QTextOStream out (&buf); +TQString Node::innerText () const { + TQString buf; + TQTextOStream out (&buf); getInnerText (m_self, out); return buf; } -static void getOuterXML (const NodePtr p, QTextOStream & out, int depth) { +static void getOuterXML (const NodePtr p, TQTextOStream & out, int depth) { if (!p->isElementNode ()) { // #text or #cdata if (p->id == id_node_cdata) - out << "<![CDATA[" << p->nodeValue () << "]]>" << QChar ('\n'); + out << "<![CDATA[" << p->nodeValue () << "]]>" << TQChar ('\n'); else - out << XMLStringlet (p->nodeValue ()) << QChar ('\n'); + out << XMLStringlet (p->nodeValue ()) << TQChar ('\n'); } else { Element * e = convertNode <Element> (p); - QString indent (QString ().fill (QChar (' '), depth)); - out << indent << QChar ('<') << XMLStringlet (e->nodeName ()); + TQString indent (TQString ().fill (TQChar (' '), depth)); + out << indent << TQChar ('<') << XMLStringlet (e->nodeName ()); for (AttributePtr a = e->attributes()->first(); a; a = a->nextSibling()) out << " " << XMLStringlet (a->name ().toString ()) << "=\"" << XMLStringlet (a->value ()) << "\""; if (e->hasChildNodes ()) { - out << QChar ('>') << QChar ('\n'); + out << TQChar ('>') << TQChar ('\n'); for (NodePtr c = e->firstChild (); c; c = c->nextSibling ()) getOuterXML (c, out, depth + 1); - out << indent << QString("</") << XMLStringlet (e->nodeName()) << - QChar ('>') << QChar ('\n'); + out << indent << TQString("</") << XMLStringlet (e->nodeName()) << + TQChar ('>') << TQChar ('\n'); } else - out << QString ("/>") << QChar ('\n'); + out << TQString ("/>") << TQChar ('\n'); } } -QString Node::innerXML () const { - QString buf; - QTextOStream out (&buf); +TQString Node::innerXML () const { + TQString buf; + TQTextOStream out (&buf); for (NodePtr e = firstChild (); e; e = e->nextSibling ()) getOuterXML (e, out, 0); return buf; } -QString Node::outerXML () const { - QString buf; - QTextOStream out (&buf); +TQString Node::outerXML () const { + TQString buf; + TQTextOStream out (&buf); getOuterXML (m_self, out, 0); return buf; } @@ -475,8 +475,8 @@ ConnectionPtr Node::connectTo (NodePtr node, unsigned int evt_id) { return ConnectionPtr (); } -QString Node::nodeValue () const { - return QString (); +TQString Node::nodeValue () const { + return TQString (); } SurfacePtr Node::getSurface (NodePtr) { @@ -493,21 +493,21 @@ RefNode::RefNode (NodePtr & d, NodePtr ref) void RefNode::setRefNode (const NodePtr ref) { ref_node = ref; if (ref_node) - tag_name = QString ("&%1").arg (ref_node->nodeName ()); + tag_name = TQString ("&%1").arg (ref_node->nodeName ()); } //----------------------------------------------------------------------------- namespace KMPlayer { struct KMPLAYER_NO_EXPORT ParamValue { - QString val; - QStringList * modifications; - ParamValue (const QString & v) : val (v), modifications (0L) {} + TQString val; + TQStringList * modifications; + ParamValue (const TQString & v) : val (v), modifications (0L) {} ~ParamValue () { delete modifications; } - QString value (); - void setValue (const QString & v) { val = v; } + TQString value (); + void setValue (const TQString & v) { val = v; } }; - typedef QMap <TrieString, ParamValue *> ParamMap; + typedef TQMap <TrieString, ParamValue *> ParamMap; class KMPLAYER_NO_EXPORT ElementPrivate { public: ~ElementPrivate (); @@ -516,7 +516,7 @@ namespace KMPlayer { }; } -KDE_NO_EXPORT QString ParamValue::value () { +KDE_NO_EXPORT TQString ParamValue::value () { return modifications && modifications->size () ? modifications->back () : val; } @@ -539,15 +539,15 @@ Element::~Element () { delete d; } -void Element::setParam (const TrieString ¶m, const QString &val, int *mid) { +void Element::setParam (const TrieString ¶m, const TQString &val, int *mid) { ParamValue * pv = d->params [param]; if (!pv) { - pv = new ParamValue (mid ? QString() : val); + pv = new ParamValue (mid ? TQString() : val); d->params.insert (param, pv); } if (mid) { if (!pv->modifications) - pv->modifications = new QStringList; + pv->modifications = new TQStringList; if (*mid >= 0 && *mid < int (pv->modifications->size ())) { (*pv->modifications) [*mid] = val; } else { @@ -559,23 +559,23 @@ void Element::setParam (const TrieString ¶m, const QString &val, int *mid) { parseParam (param, val); } -QString Element::param (const TrieString & name) { +TQString Element::param (const TrieString & name) { ParamValue * pv = d->params [name]; if (pv) return pv->value (); - return QString (); + return TQString (); } void Element::resetParam (const TrieString & param, int mid) { ParamValue * pv = d->params [param]; if (pv && pv->modifications) { if (int (pv->modifications->size ()) > mid && mid > -1) { - (*pv->modifications) [mid] = QString (); + (*pv->modifications) [mid] = TQString (); while (pv->modifications->size () > 0 && pv->modifications->back ().isNull ()) pv->modifications->pop_back (); } - QString val = pv->value (); + TQString val = pv->value (); if (pv->modifications->size () == 0) { delete pv->modifications; pv->modifications = 0L; @@ -590,7 +590,7 @@ void Element::resetParam (const TrieString & param, int mid) { kdError () << "resetting " << param.toString() << " that doesn't exists" << endl; } -void Element::setAttribute (const TrieString & name, const QString & value) { +void Element::setAttribute (const TrieString & name, const TQString & value) { for (AttributePtr a = m_attributes->first (); a; a = a->nextSibling ()) if (name == a->name ()) { a->setValue (value); @@ -599,11 +599,11 @@ void Element::setAttribute (const TrieString & name, const QString & value) { m_attributes->append (new Attribute (name, value)); } -QString Element::getAttribute (const TrieString & name) { +TQString Element::getAttribute (const TrieString & name) { for (AttributePtr a = m_attributes->first (); a; a = a->nextSibling ()) if (name == a->name ()) return a->value (); - return QString (); + return TQString (); } void Element::init () { @@ -629,14 +629,14 @@ void Element::setAttributes (AttributeListPtr attrs) { //----------------------------------------------------------------------------- -Attribute::Attribute (const TrieString & n, const QString & v) +Attribute::Attribute (const TrieString & n, const TQString & v) : m_name (n), m_value (v) {} void Attribute::setName (const TrieString & n) { m_name = n; } -void Attribute::setValue (const QString & v) { +void Attribute::setValue (const TQString & v) { m_value = v; } @@ -666,10 +666,10 @@ Node::PlayType Mrl::playType () { return cached_play_type; } -QString Mrl::absolutePath () { - QString path = src; +TQString Mrl::absolutePath () { + TQString path = src; if (!path.isEmpty()) { - for (NodePtr e = parentNode (); e; e = e->parentNode ()) { + for (NodePtr e = tqparentNode (); e; e = e->tqparentNode ()) { Mrl * mrl = e->mrl (); if (mrl && !mrl->src.isEmpty () && mrl->src != src) { path = KURL (mrl->absolutePath (), src).url (); @@ -680,7 +680,7 @@ QString Mrl::absolutePath () { return path; } -NodePtr Mrl::childFromTag (const QString & tag) { +NodePtr Mrl::childFromTag (const TQString & tag) { Node * elm = fromXMLDocumentTag (m_doc, tag); if (elm) return elm; @@ -737,7 +737,7 @@ void Mrl::begin () { } SurfacePtr Mrl::getSurface (NodePtr node) { - for (NodePtr p = parentNode (); p; p = p->parentNode ()) + for (NodePtr p = tqparentNode (); p; p = p->tqparentNode ()) if (p->mrl ()) return p->getSurface (node); return 0L; @@ -747,9 +747,9 @@ bool Mrl::handleEvent (EventPtr) { return false; } -void Mrl::parseParam (const TrieString & para, const QString & val) { +void Mrl::parseParam (const TrieString & para, const TQString & val) { if (para == StringPool::attr_src && !src.startsWith ("#")) { - QString abs = absolutePath (); + TQString abs = absolutePath (); if (abs != src) src = val; else @@ -782,7 +782,7 @@ Surface::~Surface() { } void Surface::remove () { - Surface *sp = parentNode ().ptr (); + Surface *sp = tqparentNode ().ptr (); if (sp) { sp->markDirty (); sp->removeChild (this); @@ -790,7 +790,7 @@ void Surface::remove () { } void Surface::markDirty () { - for (Surface *s = this; s; s = s->parentNode ().ptr ()) + for (Surface *s = this; s; s = s->tqparentNode ().ptr ()) s->dirty = true; } @@ -812,7 +812,7 @@ namespace KMPlayer { static NodePtr dummy_element; } -Document::Document (const QString & s, PlayListNotify * n) +Document::Document (const TQString & s, PlayListNotify * n) : Mrl (dummy_element, id_node_document), notify_listener (n), m_tree_version (0), @@ -827,7 +827,7 @@ Document::~Document () { kdDebug () << "~Document" << endl; } -static NodePtr getElementByIdImpl (NodePtr n, const QString & id, bool inter) { +static NodePtr getElementByIdImpl (NodePtr n, const TQString & id, bool inter) { NodePtr elm; if (!n->isElementNode ()) return elm; @@ -843,15 +843,15 @@ static NodePtr getElementByIdImpl (NodePtr n, const QString & id, bool inter) { return elm; } -NodePtr Document::getElementById (const QString & id) { +NodePtr Document::getElementById (const TQString & id) { return getElementByIdImpl (this, id, true); } -NodePtr Document::getElementById (NodePtr n, const QString & id, bool inter) { +NodePtr Document::getElementById (NodePtr n, const TQString & id, bool inter) { return getElementByIdImpl (n, id, inter); } -NodePtr Document::childFromTag (const QString & tag) { +NodePtr Document::childFromTag (const TQString & tag) { Node * elm = fromXMLDocumentTag (m_doc, tag); if (elm) return elm; @@ -1066,14 +1066,14 @@ NodeRefListPtr Document::listeners (unsigned int id) { //----------------------------------------------------------------------------- -KDE_NO_CDTOR_EXPORT TextNode::TextNode (NodePtr & d, const QString & s, short i) +KDE_NO_CDTOR_EXPORT TextNode::TextNode (NodePtr & d, const TQString & s, short i) : Node (d, i), text (s) {} -void TextNode::appendText (const QString & s) { +void TextNode::appendText (const TQString & s) { text += s; } -QString TextNode::nodeValue () const { +TQString TextNode::nodeValue () const { return text; } @@ -1083,16 +1083,16 @@ KDE_NO_EXPORT bool TextNode::expose () const { //----------------------------------------------------------------------------- -KDE_NO_CDTOR_EXPORT CData::CData (NodePtr & d, const QString & s) +KDE_NO_CDTOR_EXPORT CData::CData (NodePtr & d, const TQString & s) : TextNode (d, s, id_node_cdata) {} //----------------------------------------------------------------------------- -DarkNode::DarkNode (NodePtr & d, const QString & n, short id) +DarkNode::DarkNode (NodePtr & d, const TQString & n, short id) : Element (d, id), name (n) { } -NodePtr DarkNode::childFromTag (const QString & tag) { +NodePtr DarkNode::childFromTag (const TQString & tag) { return new DarkNode (m_doc, tag); } @@ -1102,7 +1102,7 @@ KDE_NO_EXPORT bool DarkNode::expose () const { //----------------------------------------------------------------------------- -GenericURL::GenericURL (NodePtr & d, const QString & s, const QString & name) +GenericURL::GenericURL (NodePtr & d, const TQString & s, const TQString & name) : Mrl (d, id_node_playlist_item) { src = s; if (!src.isEmpty ()) @@ -1117,7 +1117,7 @@ KDE_NO_EXPORT void GenericURL::closed () { //----------------------------------------------------------------------------- -GenericMrl::GenericMrl (NodePtr & d, const QString & s, const QString & name, const QString & tag) +GenericMrl::GenericMrl (NodePtr & d, const TQString & s, const TQString & name, const TQString & tag) : Mrl (d, id_node_playlist_item), node_name (tag) { src = s; if (!src.isEmpty ()) @@ -1155,16 +1155,16 @@ class KMPLAYER_NO_EXPORT DocumentBuilder { public: DocumentBuilder (NodePtr d, bool set_opener); ~DocumentBuilder () {} - bool startTag (const QString & tag, AttributeListPtr attr); - bool endTag (const QString & tag); - bool characterData (const QString & data); - bool cdataData (const QString & data); + bool startTag (const TQString & tag, AttributeListPtr attr); + bool endTag (const TQString & tag); + bool characterData (const TQString & data); + bool cdataData (const TQString & data); #ifdef HAVE_EXPAT void cdataStart (); void cdataEnd (); private: bool in_cdata; - QString cdata; + TQString cdata; #endif }; @@ -1178,7 +1178,7 @@ DocumentBuilder::DocumentBuilder (NodePtr d, bool set_opener) #endif {} -bool DocumentBuilder::startTag(const QString &tag, AttributeListPtr attr) { +bool DocumentBuilder::startTag(const TQString &tag, AttributeListPtr attr) { if (m_ignore_depth) { m_ignore_depth++; //kdDebug () << "Warning: ignored tag " << tag.latin1 () << " ignore depth = " << m_ignore_depth << endl; @@ -1207,7 +1207,7 @@ bool DocumentBuilder::startTag(const QString &tag, AttributeListPtr attr) { return true; } -bool DocumentBuilder::endTag (const QString & tag) { +bool DocumentBuilder::endTag (const TQString & tag) { if (m_ignore_depth) { // endtag to ignore m_ignore_depth--; kdDebug () << "Warning: ignored end tag " << " ignore depth = " << m_ignore_depth << endl; @@ -1218,10 +1218,10 @@ bool DocumentBuilder::endTag (const QString & tag) { (m_root_is_first || n != m_root)) { while (n != m_node) { kdWarning() << m_node->nodeName () << " not closed" << endl; - if (m_root == m_node->parentNode ()) + if (m_root == m_node->tqparentNode ()) break; m_node->closed (); - m_node = m_node->parentNode (); + m_node = m_node->tqparentNode (); } break; } @@ -1234,16 +1234,16 @@ bool DocumentBuilder::endTag (const QString & tag) { break; } else kdWarning () << "tag " << tag << " not " << n->nodeName () << endl; - n = n ->parentNode (); + n = n ->tqparentNode (); } //kdDebug () << "end tag " << tag << endl; m_node->closed (); - m_node = m_node->parentNode (); + m_node = m_node->tqparentNode (); } return true; } -bool DocumentBuilder::characterData (const QString & data) { +bool DocumentBuilder::characterData (const TQString & data) { if (!m_ignore_depth) { #ifdef HAVE_EXPAT if (in_cdata) @@ -1256,7 +1256,7 @@ bool DocumentBuilder::characterData (const QString & data) { return true; } -bool DocumentBuilder::cdataData (const QString & data) { +bool DocumentBuilder::cdataData (const TQString & data) { if (!m_ignore_depth) { NodePtr d = m_node->document (); m_node->appendChild (new CData (d, data)); @@ -1283,14 +1283,14 @@ static void startTag (void *data, const char * tag, const char **attr) { AttributeListPtr attributes = new AttributeList; if (attr && attr [0]) { for (int i = 0; attr[i]; i += 2) - attributes->append (new Attribute (QString::fromUtf8 (attr [i]), QString::fromUtf8 (attr [i+1]))); + attributes->append (new Attribute (TQString::fromUtf8 (attr [i]), TQString::fromUtf8 (attr [i+1]))); } - builder->startTag (QString::fromUtf8 (tag), attributes); + builder->startTag (TQString::fromUtf8 (tag), attributes); } static void endTag (void *data, const char * tag) { DocumentBuilder * builder = static_cast <DocumentBuilder *> (data); - builder->endTag (QString::fromUtf8 (tag)); + builder->endTag (TQString::fromUtf8 (tag)); } static void characterData (void *data, const char *s, int len) { @@ -1298,7 +1298,7 @@ static void characterData (void *data, const char *s, int len) { char * buf = new char [len + 1]; strncpy (buf, s, len); buf[len] = 0; - builder->characterData (QString::fromUtf8 (buf)); + builder->characterData (TQString::fromUtf8 (buf)); delete [] buf; } @@ -1315,7 +1315,7 @@ static void cdataEnd (void *data) { namespace KMPlayer { KMPLAYER_EXPORT -void readXML (NodePtr root, QTextStream & in, const QString & firstline, bool set_opener) { +void readXML (NodePtr root, TQTextStream & in, const TQString & firstline, bool set_opener) { bool ok = true; DocumentBuilder builder (root, set_opener); XML_Parser parser = XML_ParserCreate (0L); @@ -1324,14 +1324,14 @@ void readXML (NodePtr root, QTextStream & in, const QString & firstline, bool se XML_SetCharacterDataHandler (parser, characterData); XML_SetCdataSectionHandler (parser, cdataStart, cdataEnd); if (!firstline.isEmpty ()) { - QString str (firstline + QChar ('\n')); - QCString buf = str.utf8 (); + TQString str (firstline + TQChar ('\n')); + TQCString buf = str.utf8 (); ok = XML_Parse(parser, buf, strlen (buf), false) != XML_STATUS_ERROR; if (!ok) kdWarning () << XML_ErrorString(XML_GetErrorCode(parser)) << " at " << XML_GetCurrentLineNumber(parser) << " col " << XML_GetCurrentColumnNumber(parser) << endl; } if (ok && !in.atEnd ()) { - QCString buf = in.read ().utf8 (); + TQCString buf = in.read ().utf8 (); ok = XML_Parse(parser, buf, strlen (buf), true) != XML_STATUS_ERROR; if (!ok) kdWarning () << XML_ErrorString(XML_GetErrorCode(parser)) << " at " << XML_GetCurrentLineNumber(parser) << " col " << XML_GetCurrentColumnNumber(parser) << endl; @@ -1352,12 +1352,12 @@ class KMPLAYER_NO_EXPORT SimpleSAXParser { public: SimpleSAXParser (DocumentBuilder & b) : builder (b), position (0), m_attributes (new AttributeList), equal_seen (false), in_dbl_quote (false), in_sngl_quote (false), have_error (false), no_entitity_look_ahead (false), have_next_char (false) {} virtual ~SimpleSAXParser () {}; - bool parse (QTextStream & d); + bool parse (TQTextStream & d); private: - QTextStream * data; + TQTextStream * data; DocumentBuilder & builder; int position; - QChar next_char; + TQChar next_char; enum Token { tok_empty, tok_text, tok_white_space, tok_angle_open, tok_equal, tok_double_quote, tok_single_quote, tok_angle_close, tok_slash, tok_exclamation, tok_amp, tok_hash, tok_semi_colon, @@ -1368,23 +1368,23 @@ private: struct TokenInfo { TokenInfo () : token (tok_empty) {} Token token; - QString string; + TQString string; SharedPtr <TokenInfo> next; }; typedef SharedPtr <TokenInfo> TokenInfoPtr; struct StateInfo { StateInfo (State s, SharedPtr <StateInfo> n) : state (s), next (n) {} State state; - QString data; + TQString data; SharedPtr <StateInfo> next; }; SharedPtr <StateInfo> m_state; TokenInfoPtr next_token, token, prev_token; // for element reading - QString tagname; + TQString tagname; AttributeListPtr m_attributes; - QString attr_name, attr_value; - QString cdata; + TQString attr_name, attr_value; + TQString cdata; bool equal_seen; bool in_dbl_quote; bool in_sngl_quote; @@ -1407,17 +1407,17 @@ private: } // namespace KMPLAYER_EXPORT -void KMPlayer::readXML (NodePtr root, QTextStream & in, const QString & firstline, bool set_opener) { +void KMPlayer::readXML (NodePtr root, TQTextStream & in, const TQString & firstline, bool set_opener) { DocumentBuilder builder (root, set_opener); SimpleSAXParser parser (builder); if (!firstline.isEmpty ()) { - QString str (firstline + QChar ('\n')); - QTextStream fl_in (&str, IO_ReadOnly); + TQString str (firstline + TQChar ('\n')); + TQTextStream fl_in (&str, IO_ReadOnly); parser.parse (fl_in); } if (!in.atEnd ()) parser.parse (in); - for (NodePtr e = root; e; e = e->parentNode ()) + for (NodePtr e = root; e; e = e->tqparentNode ()) e->closed (); //doc->normalize (); //kdDebug () << root->outerXML (); @@ -1455,39 +1455,39 @@ bool SimpleSAXParser::nextToken () { push (); next_token->token = tok_white_space; } else if (!next_char.isLetterOrNumber ()) { - if (next_char == QChar ('#')) { + if (next_char == TQChar ('#')) { //if (next_token->token == tok_empty) { // check last item on stack & push (); next_token->token = tok_hash; //} - } else if (next_char == QChar ('/')) { + } else if (next_char == TQChar ('/')) { push (); next_token->token = tok_slash; - } else if (next_char == QChar ('!')) { + } else if (next_char == TQChar ('!')) { push (); next_token->token = tok_exclamation; - } else if (next_char == QChar ('?')) { + } else if (next_char == TQChar ('?')) { push (); next_token->token = tok_question_mark; - } else if (next_char == QChar ('<')) { + } else if (next_char == TQChar ('<')) { push (); next_token->token = tok_angle_open; - } else if (next_char == QChar ('>')) { + } else if (next_char == TQChar ('>')) { push (); next_token->token = tok_angle_close; - } else if (next_char == QChar (';')) { + } else if (next_char == TQChar (';')) { push (); next_token->token = tok_semi_colon; - } else if (next_char == QChar ('=')) { + } else if (next_char == TQChar ('=')) { push (); next_token->token = tok_equal; - } else if (next_char == QChar ('"')) { + } else if (next_char == TQChar ('"')) { push (); next_token->token = tok_double_quote; - } else if (next_char == QChar ('\'')) { + } else if (next_char == TQChar ('\'')) { push (); next_token->token = tok_single_quote; - } else if (next_char == QChar ('&')) { + } else if (next_char == TQChar ('&')) { push (); if (no_entitity_look_ahead) { have_next_char = true; @@ -1499,20 +1499,20 @@ bool SimpleSAXParser::nextToken () { TokenInfoPtr prev_tmp = prev_token; if (nextToken () && token->token == tok_text && nextToken () && token->token == tok_semi_colon) { - if (prev_token->string == QString ("amp")) - token->string = QChar ('&'); - else if (prev_token->string == QString ("lt")) - token->string = QChar ('<'); - else if (prev_token->string == QString ("gt")) - token->string = QChar ('>'); - else if (prev_token->string == QString ("quot")) - token->string = QChar ('"'); - else if (prev_token->string == QString ("apos")) - token->string = QChar ('\''); - else if (prev_token->string == QString ("copy")) - token->string = QChar (169); + if (prev_token->string == TQString ("amp")) + token->string = TQChar ('&'); + else if (prev_token->string == TQString ("lt")) + token->string = TQChar ('<'); + else if (prev_token->string == TQString ("gt")) + token->string = TQChar ('>'); + else if (prev_token->string == TQString ("quot")) + token->string = TQChar ('"'); + else if (prev_token->string == TQString ("apos")) + token->string = TQChar ('\''); + else if (prev_token->string == TQString ("copy")) + token->string = TQChar (169); else - token->string = QChar ('?');// TODO lookup more .. + token->string = TQChar ('?');// TODO lookup more .. token->token = tok_text; if (tmp) { // cut out the & xxx ; tokens tmp->next = token; @@ -1524,10 +1524,10 @@ bool SimpleSAXParser::nextToken () { nextToken () && token->token == tok_semi_colon) { //kdDebug () << "char entity found " << prev_token->string << prev_token->string.toInt (0L, 16) << endl; token->token = tok_text; - if (!prev_token->string.startsWith (QChar ('x'))) - token->string = QChar (prev_token->string.toInt ()); + if (!prev_token->string.startsWith (TQChar ('x'))) + token->string = TQChar (prev_token->string.toInt ()); else - token->string = QChar (prev_token->string.mid (1).toInt (0L, 16)); + token->string = TQChar (prev_token->string.mid (1).toInt (0L, 16)); if (tmp) { // cut out the '& # xxx ;' tokens tmp->next = token; token = tmp; @@ -1536,7 +1536,7 @@ bool SimpleSAXParser::nextToken () { token = tmp; // restore and insert the lost & token tmp = TokenInfoPtr (new TokenInfo); tmp->token = tok_amp; - tmp->string += QChar ('&'); + tmp->string += TQChar ('&'); tmp->next = token->next; if (token) token->next = tmp; @@ -1556,7 +1556,7 @@ bool SimpleSAXParser::nextToken () { if (append_char) next_token->string += next_char; if (next_token->token == tok_text && - next_char == QChar ('[' ) && next_token->string == "[CDATA[") { + next_char == TQChar ('[' ) && next_token->string == "[CDATA[") { next_token->token = tok_cdata_start; break; } @@ -1639,7 +1639,7 @@ bool SimpleSAXParser::readAttributes () { } m_state = m_state->next; if (m_state->state == InPITag) { - if (tagname == QString ("xml")) { + if (tagname == TQString ("xml")) { /*const AttributeMap::const_iterator e = attr.end (); for (AttributeMap::const_iterator i = attr.begin (); i != e; ++i) if (!strcasecmp (i.key ().latin1 (), "encoding")) @@ -1674,7 +1674,7 @@ bool SimpleSAXParser::readPI () { bool SimpleSAXParser::readDTD () { //TODO: <!ENTITY ..> if (!nextToken ()) return false; - if (token->token == tok_text && token->string.startsWith (QString ("--"))) { + if (token->token == tok_text && token->string.startsWith (TQString ("--"))) { m_state = new StateInfo (InComment, m_state->next); // note: pop DTD return readComment (); } @@ -1702,7 +1702,7 @@ bool SimpleSAXParser::readDTD () { bool SimpleSAXParser::readCDATA () { while (!data->atEnd ()) { *data >> next_char; - if (next_char == QChar ('>') && cdata.endsWith (QString ("]]"))) { + if (next_char == TQChar ('>') && cdata.endsWith (TQString ("]]"))) { cdata.truncate (cdata.length () - 2); m_state = m_state->next; if (m_state->state == InContent) @@ -1724,7 +1724,7 @@ bool SimpleSAXParser::readCDATA () { bool SimpleSAXParser::readComment () { while (nextToken ()) { if (token->token == tok_angle_close && prev_token) - if (prev_token->string.endsWith (QString ("--"))) { + if (prev_token->string.endsWith (TQString ("--"))) { m_state = m_state->next; return true; } @@ -1773,7 +1773,7 @@ bool SimpleSAXParser::readTag () { return readAttributes (); } -bool SimpleSAXParser::parse (QTextStream & d) { +bool SimpleSAXParser::parse (TQTextStream & d) { data = &d; if (!next_token) { next_token = TokenInfoPtr (new TokenInfo); @@ -1781,7 +1781,7 @@ bool SimpleSAXParser::parse (QTextStream & d) { } bool ok = true; bool in_character_data = false; - QString white_space; + TQString white_space; while (ok) { switch (m_state->state) { case InTag: @@ -1821,7 +1821,7 @@ bool SimpleSAXParser::parse (QTextStream & d) { } else { if (!white_space.isEmpty ()) { if (!in_character_data) { - int pos = white_space.findRev (QChar ('\n')); + int pos = white_space.tqfindRev (TQChar ('\n')); if (pos > -1) white_space = white_space.mid (pos + 1); } |