diff options
Diffstat (limited to 'klinkstatus/src/parser/htmlparser.cpp')
-rw-r--r-- | klinkstatus/src/parser/htmlparser.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/klinkstatus/src/parser/htmlparser.cpp b/klinkstatus/src/parser/htmlparser.cpp index 6bc93761..557d0d25 100644 --- a/klinkstatus/src/parser/htmlparser.cpp +++ b/klinkstatus/src/parser/htmlparser.cpp @@ -24,7 +24,7 @@ #include <kdebug.h> -HtmlParser::HtmlParser(QString const& documento) +HtmlParser::HtmlParser(TQString const& documento) : is_content_type_set_(false), document_(documento) { Q_ASSERT(!documento.isEmpty()); @@ -75,16 +75,16 @@ NodeTITLE const& HtmlParser::title() const return node_TITLE_; } -vector<QString> const& HtmlParser::parseNodesOfType(QString const& element) +vector<TQString> const& HtmlParser::parseNodesOfType(TQString const& element) { HtmlParser::parseNodesOfType(element, document_, aux_); return aux_; } -void HtmlParser::parseNodesOfType(QString const& tipo, QString const& document, vector<QString>& nodes) +void HtmlParser::parseNodesOfType(TQString const& tipo, TQString const& document, vector<TQString>& nodes) { - QString node; - QString doc(document); + TQString node; + TQString doc(document); int inicio = 0, fim = 0; nodes.clear(); @@ -100,7 +100,7 @@ void HtmlParser::parseNodesOfType(QString const& tipo, QString const& document, //if( (doc[inicio] != ' ' && doc[inicio] != '\n' && doc[inicio] != '\r') ) if(!::isSpace(doc[inicio])) { - doc.remove(0, QString("<" + tipo).length()); + doc.remove(0, TQString("<" + tipo).length()); continue; } @@ -118,7 +118,7 @@ void HtmlParser::parseNodesOfType(QString const& tipo, QString const& document, continue; } - int tag_begining_go_back = (tipo.length() + QString("<").length()); + int tag_begining_go_back = (tipo.length() + TQString("<").length()); node = doc.mid(inicio - tag_begining_go_back, fim - inicio + tag_begining_go_back); nodes.push_back(node); @@ -126,7 +126,7 @@ void HtmlParser::parseNodesOfType(QString const& tipo, QString const& document, } } -int HtmlParser::endOfTag(QString const& s, int index, QChar end_of_tag) +int HtmlParser::endOfTag(TQString const& s, int index, TQChar end_of_tag) { if( (uint)index >= s.length() ) return -1; @@ -167,9 +167,9 @@ vector<Node*> const& HtmlParser::nodes() const void HtmlParser::parseNodesOfTypeA() { - vector<QString> const& aux = parseNodesOfType("A"); + vector<TQString> const& aux = parseNodesOfType("A"); - for(vector<QString>::size_type i = 0; i != aux.size(); ++i) + for(vector<TQString>::size_type i = 0; i != aux.size(); ++i) { nodes_.push_back( new NodeA(aux[i]) ); } @@ -177,9 +177,9 @@ void HtmlParser::parseNodesOfTypeA() void HtmlParser::parseNodesOfTypeAREA() { - vector<QString> const& aux = parseNodesOfType("AREA"); + vector<TQString> const& aux = parseNodesOfType("AREA"); - for(vector<QString>::size_type i = 0; i != aux.size(); ++i) + for(vector<TQString>::size_type i = 0; i != aux.size(); ++i) { nodes_.push_back( new NodeAREA(aux[i]) ); } @@ -187,72 +187,72 @@ void HtmlParser::parseNodesOfTypeAREA() void HtmlParser::parseNodesOfTypeLINK() { - vector<QString> const& aux = parseNodesOfType("LINK"); + vector<TQString> const& aux = parseNodesOfType("LINK"); - for(vector<QString>::size_type i = 0; i != aux.size(); ++i) + for(vector<TQString>::size_type i = 0; i != aux.size(); ++i) nodes_.push_back( new NodeLINK(aux[i]) ); } void HtmlParser::parseNodesOfTypeMETA() { - vector<QString> const& aux = parseNodesOfType("META"); + vector<TQString> const& aux = parseNodesOfType("META"); - for(vector<QString>::size_type i = 0; i != aux.size(); ++i) + for(vector<TQString>::size_type i = 0; i != aux.size(); ++i) { NodeMETA* node = new NodeMETA(aux[i]); nodes_.push_back(node); - if(!is_content_type_set_ && node->atributoHTTP_EQUIV().lower() == QString("Content-Type").lower()) { + if(!is_content_type_set_ && node->atributoHTTP_EQUIV().lower() == TQString("Content-Type").lower()) { is_content_type_set_ = true; node_META_content_type_.setNode(aux[i]); } } } -QString HtmlParser::findCharsetInMetaElement(QString const& html) +TQString HtmlParser::findCharsetInMetaElement(TQString const& html) { - vector<QString> metaTags; + vector<TQString> metaTags; parseNodesOfType("META", html, metaTags); - for(vector<QString>::size_type i = 0; i != metaTags.size(); ++i) + for(vector<TQString>::size_type i = 0; i != metaTags.size(); ++i) { NodeMETA node(metaTags[i]); - if(node.atributoHTTP_EQUIV().lower() == QString("Content-Type").lower()) { + if(node.atributoHTTP_EQUIV().lower() == TQString("Content-Type").lower()) { return node.charset(); } } - return QString(); + return TQString(); } void HtmlParser::parseNodesOfTypeIMG() { - vector<QString> const& aux = parseNodesOfType("IMG"); + vector<TQString> const& aux = parseNodesOfType("IMG"); - for(vector<QString>::size_type i = 0; i != aux.size(); ++i) + for(vector<TQString>::size_type i = 0; i != aux.size(); ++i) nodes_.push_back( new NodeIMG(aux[i]) ); } void HtmlParser::parseNodesOfTypeFRAME() { - vector<QString> const& aux = parseNodesOfType("FRAME"); + vector<TQString> const& aux = parseNodesOfType("FRAME"); - for(vector<QString>::size_type i = 0; i != aux.size(); ++i) + for(vector<TQString>::size_type i = 0; i != aux.size(); ++i) nodes_.push_back( new NodeFRAME(aux[i]) ); } void HtmlParser::parseNodesOfTypeIFRAME() { - vector<QString> const& aux = parseNodesOfType("IFRAME"); + vector<TQString> const& aux = parseNodesOfType("IFRAME"); - for(vector<QString>::size_type i = 0; i != aux.size(); ++i) + for(vector<TQString>::size_type i = 0; i != aux.size(); ++i) nodes_.push_back( new NodeFRAME(aux[i]) ); } void HtmlParser::parseNodesOfTypeBASE() { - QString node; - QString doc = document_; + TQString node; + TQString doc = document_; int inicio = 0, fim = 0; inicio = findSeparableWord(doc, "<BASE"); @@ -269,8 +269,8 @@ void HtmlParser::parseNodesOfTypeBASE() void HtmlParser::parseNodesOfTypeTITLE() { - QString node; - QString doc = document_; + TQString node; + TQString doc = document_; int inicio = 0, fim = 0; inicio = findSeparableWord(doc, "<TITLE>"); @@ -289,8 +289,8 @@ void HtmlParser::parseNodesOfTypeTITLE() void HtmlParser::stripComments() { - QString begin_comment = "<!--"; - QString end_comment = "-->"; + TQString begin_comment = "<!--"; + TQString end_comment = "-->"; uint const begin_comment_length = begin_comment.length(); int inicio = -1; @@ -319,8 +319,8 @@ void HtmlParser::stripComments() void HtmlParser::stripScriptContent() { int inicio = -1; - QString const begin_script = "<script"; - QString const end_script = "</script>"; + TQString const begin_script = "<script"; + TQString const end_script = "</script>"; uint const begin_script_length = begin_script.length(); do @@ -425,7 +425,7 @@ int main() //ifstream stream("/var/www/html/qt-doc/functions.html"); ifstream stream("/var/www/html/index.html"); - QString content; + TQString content; while(stream) { char c; |