diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
commit | e985f7e545f4739493965aad69bbecb136dc9346 (patch) | |
tree | 54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /klinkstatus/src/parser | |
parent | f7670c198945adc3b95ad69a959fe5f8ae55b493 (diff) | |
download | tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip |
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'klinkstatus/src/parser')
-rw-r--r-- | klinkstatus/src/parser/htmlparser.cpp | 16 | ||||
-rw-r--r-- | klinkstatus/src/parser/http.cpp | 8 | ||||
-rw-r--r-- | klinkstatus/src/parser/http.h | 2 | ||||
-rw-r--r-- | klinkstatus/src/parser/mstring.cpp | 8 | ||||
-rw-r--r-- | klinkstatus/src/parser/node.cpp | 18 | ||||
-rw-r--r-- | klinkstatus/src/parser/node.h | 8 | ||||
-rw-r--r-- | klinkstatus/src/parser/node_impl.h | 16 | ||||
-rw-r--r-- | klinkstatus/src/parser/url.cpp | 12 | ||||
-rw-r--r-- | klinkstatus/src/parser/url.h | 10 |
9 files changed, 49 insertions, 49 deletions
diff --git a/klinkstatus/src/parser/htmlparser.cpp b/klinkstatus/src/parser/htmlparser.cpp index 557d0d25..ebe8e362 100644 --- a/klinkstatus/src/parser/htmlparser.cpp +++ b/klinkstatus/src/parser/htmlparser.cpp @@ -131,11 +131,11 @@ int HtmlParser::endOfTag(TQString const& s, int index, TQChar end_of_tag) if( (uint)index >= s.length() ) return -1; - int _end_of_tag = s.find(end_of_tag, index); + int _end_of_tag = s.tqfind(end_of_tag, index); if(_end_of_tag == -1) return _end_of_tag; - int open_aspas = s.find('"', index); + int open_aspas = s.tqfind('"', index); if(open_aspas == -1) return _end_of_tag + 1; @@ -147,7 +147,7 @@ int HtmlParser::endOfTag(TQString const& s, int index, TQChar end_of_tag) else { - int close_aspas = s.find('"', open_aspas + 1); + int close_aspas = s.tqfind('"', open_aspas + 1); if(close_aspas != -1) return endOfTag(s, close_aspas + 1, end_of_tag); else @@ -202,7 +202,7 @@ void HtmlParser::parseNodesOfTypeMETA() NodeMETA* node = new NodeMETA(aux[i]); nodes_.push_back(node); - if(!is_content_type_set_ && node->atributoHTTP_EQUIV().lower() == TQString("Content-Type").lower()) { + if(!is_content_type_set_ && node->atributoHTTP_ETQUIV().lower() == TQString("Content-Type").lower()) { is_content_type_set_ = true; node_META_content_type_.setNode(aux[i]); } @@ -218,7 +218,7 @@ TQString HtmlParser::findCharsetInMetaElement(TQString const& html) { NodeMETA node(metaTags[i]); - if(node.atributoHTTP_EQUIV().lower() == TQString("Content-Type").lower()) { + if(node.atributoHTTP_ETQUIV().lower() == TQString("Content-Type").lower()) { return node.charset(); } } @@ -259,7 +259,7 @@ void HtmlParser::parseNodesOfTypeBASE() if(inicio == -1 || !doc[inicio].isSpace()) return; - fim = doc.find(">", inicio); + fim = doc.tqfind(">", inicio); if(fim == -1) return; @@ -375,7 +375,7 @@ void HtmlParser::mostra() const { if(nodes_[i]->element() == Node::META) { -#if defined Q_WS_WIN +#if defined TQ_WS_WIN NodeMETA* nm = (NodeMETA*)nodes_[i]; #else @@ -383,7 +383,7 @@ void HtmlParser::mostra() const #endif kdDebug(23100) << nm->url() << endl - << nm->atributoHTTP_EQUIV() << endl + << nm->atributoHTTP_ETQUIV() << endl << nm->atributoNAME() << endl << nm->atributoCONTENT() << endl; } diff --git a/klinkstatus/src/parser/http.cpp b/klinkstatus/src/parser/http.cpp index 6e086739..0a62a9a2 100644 --- a/klinkstatus/src/parser/http.cpp +++ b/klinkstatus/src/parser/http.cpp @@ -34,8 +34,8 @@ void HttpResponseHeader::parseLocation() int location = findWord(cabecalho, "Location: "); Q_ASSERT(location != -1); - int fim_de_linha_1 = cabecalho.find('\n', location); - int fim_de_linha_2 = cabecalho.find('\r', location); + int fim_de_linha_1 = cabecalho.tqfind('\n', location); + int fim_de_linha_2 = cabecalho.tqfind('\r', location); Q_ASSERT(fim_de_linha_1 != -1 || fim_de_linha_2 != -1); @@ -67,11 +67,11 @@ TQString HttpResponseHeader::charset(TQString const& contentTypeHttpHeaderLine) if(contentTypeHttpHeaderLine.isEmpty()) return _charset; - int index = contentTypeHttpHeaderLine.find("charset="); + int index = contentTypeHttpHeaderLine.tqfind("charset="); if(index != -1) index += TQString("charset=").length(); else { - index = contentTypeHttpHeaderLine.find("charset:"); + index = contentTypeHttpHeaderLine.tqfind("charset:"); if(index != -1) index += TQString("charset:").length(); } diff --git a/klinkstatus/src/parser/http.h b/klinkstatus/src/parser/http.h index b955d25d..2ad81012 100644 --- a/klinkstatus/src/parser/http.h +++ b/klinkstatus/src/parser/http.h @@ -25,7 +25,7 @@ #include <tqstring.h> -class HttpResponseHeader: public QHttpResponseHeader +class HttpResponseHeader: public TQHttpResponseHeader { public: diff --git a/klinkstatus/src/parser/mstring.cpp b/klinkstatus/src/parser/mstring.cpp index aa2cdec7..f84c5809 100644 --- a/klinkstatus/src/parser/mstring.cpp +++ b/klinkstatus/src/parser/mstring.cpp @@ -28,7 +28,7 @@ using namespace std; int findWord(TQString const& s, TQString const& palavra, uint a_partir_do_indice) { - int indice = s.find(palavra, a_partir_do_indice, false); + int indice = s.tqfind(palavra, a_partir_do_indice, false); if(indice == -1) return indice; @@ -38,7 +38,7 @@ int findWord(TQString const& s, TQString const& palavra, uint a_partir_do_indice int findChar(TQString const& s, TQChar letra, uint a_partir_do_indice) { - int index = s.find(letra, a_partir_do_indice, false); + int index = s.tqfind(letra, a_partir_do_indice, false); if(index == -1) return index; else @@ -173,7 +173,7 @@ vector<TQString> tokenizeWordsSeparatedByDots(TQString s) if(inicio == -1) return v; - int fim = s.find('.', inicio); + int fim = s.tqfind('.', inicio); if(fim == -1) { v.push_back(s.mid(inicio)); @@ -200,7 +200,7 @@ vector<TQString> tokenizeWordsSeparatedBy(TQString s, TQChar criteria) if(inicio == -1) return v; - int fim = s.find(criteria, inicio); + int fim = s.tqfind(criteria, inicio); if(fim == -1) { v.push_back(s.mid(inicio)); diff --git a/klinkstatus/src/parser/node.cpp b/klinkstatus/src/parser/node.cpp index cb5fdec4..ad5ce064 100644 --- a/klinkstatus/src/parser/node.cpp +++ b/klinkstatus/src/parser/node.cpp @@ -39,19 +39,19 @@ TQString Node::getAttribute(TQString const& atributo) { if(content_[inicio] == '"') { - fim = content_.find("\"", inicio + 1); + fim = content_.tqfind("\"", inicio + 1); tem_aspas_ou_plicas = true; } else if(content_[inicio] == '\'') { - fim = content_.find("'", inicio + 1); + fim = content_.tqfind("'", inicio + 1); tem_aspas_ou_plicas = true; } else { int fim_bloco = nextSpaceChar(content_, inicio + 1); - int fim_tag = content_.find(">", inicio + 1); - int fim_aspas = content_.find("\"", inicio + 1); + int fim_tag = content_.tqfind(">", inicio + 1); + int fim_aspas = content_.tqfind("\"", inicio + 1); if(fim_bloco == -1 && fim_tag == -1 && fim_aspas == -1) { @@ -137,7 +137,7 @@ void NodeLink::parseLinkLabel() do { - fim_tag = content_.find(">", fim_tag); + fim_tag = content_.tqfind(">", fim_tag); if(fim_tag != -1) proximo_caractere = TQChar(content_[++fim_tag]); @@ -147,7 +147,7 @@ void NodeLink::parseLinkLabel() if(fim_tag != -1) { - int fim_label = content_.find("<", fim_tag); + int fim_label = content_.tqfind("<", fim_tag); if(fim_label != -1) { @@ -166,7 +166,7 @@ void NodeLink::parseLinkLabel() void NodeMETA::parseAttributeURL() { if(attribute_http_equiv_.isEmpty()) - parseAttributeHTTP_EQUIV(); + parseAttributeHTTP_ETQUIV(); if(upperCase(attribute_http_equiv_) == "REFRESH") { @@ -183,7 +183,7 @@ void NodeMETA::parseAttributeURL() int aspas = -1; do { - aspas = attribute_url_.find("\""); + aspas = attribute_url_.tqfind("\""); if(aspas != -1) attribute_url_.remove(aspas, 1); } @@ -206,7 +206,7 @@ TQString NodeMETA::charset() const if(content.isEmpty()) return charset; - int index = content.find("charset="); + int index = content.tqfind("charset="); if(index != -1) { index += TQString("charset=").length(); diff --git a/klinkstatus/src/parser/node.h b/klinkstatus/src/parser/node.h index 0452c219..c3ecdcaa 100644 --- a/klinkstatus/src/parser/node.h +++ b/klinkstatus/src/parser/node.h @@ -166,7 +166,7 @@ public: virtual TQString const& url() const; virtual const TQString& linkLabel() const; virtual bool isLink() const; - TQString const& atributoHTTP_EQUIV() const; + TQString const& atributoHTTP_ETQUIV() const; TQString const& atributoNAME() const; TQString const& atributoCONTENT() const; TQString charset() const; @@ -176,13 +176,13 @@ public: private: /** - Procura se existem os atributos HTTP-EQUIV=Refresh e URL=... + Procura se existem os atributos HTTP-ETQUIV=Refresh e URL=... Se existir considera o content do atributo URL como um link. - ex: <META HTTP-EQUIV=Refresh CONTENT="10; URL=http://www.htmlhelp.com/"> + ex: <META HTTP-ETQUIV=Refresh CONTENT="10; URL=http://www.htmlhelp.com/"> */ void parseAttributeURL(); - void parseAttributeHTTP_EQUIV(); + void parseAttributeHTTP_ETQUIV(); void parseAttributeNAME(); void parseAttributeCONTENT(); diff --git a/klinkstatus/src/parser/node_impl.h b/klinkstatus/src/parser/node_impl.h index 97224bd5..f1ebed13 100644 --- a/klinkstatus/src/parser/node_impl.h +++ b/klinkstatus/src/parser/node_impl.h @@ -214,7 +214,7 @@ inline bool NodeMETA::isLink() const return false; } -inline TQString const& NodeMETA::atributoHTTP_EQUIV() const +inline TQString const& NodeMETA::atributoHTTP_ETQUIV() const { return attribute_http_equiv_; } @@ -237,16 +237,16 @@ inline bool NodeMETA::isRedirection() const inline void NodeMETA::parse() { - parseAttributeHTTP_EQUIV(); + parseAttributeHTTP_ETQUIV(); parseAttributeNAME(); parseAttributeCONTENT(); parseAttributeURL(); } -inline void NodeMETA::parseAttributeHTTP_EQUIV() +inline void NodeMETA::parseAttributeHTTP_ETQUIV() { - attribute_http_equiv_ = getAttribute("HTTP-EQUIV="); + attribute_http_equiv_ = getAttribute("HTTP-ETQUIV="); } inline void NodeMETA::parseAttributeNAME() @@ -378,12 +378,12 @@ inline NodeTITLE::NodeTITLE(TQString const& content) inline TQString const& NodeTITLE::url() const { - return TQString::null; + return TQString(); } inline TQString const& NodeTITLE::linkLabel() const { - return TQString::null; + return TQString(); } inline void NodeTITLE::parse() @@ -404,8 +404,8 @@ inline TQString const& NodeTITLE::attributeTITLE() const inline void NodeTITLE::parseAttributeTITLE() { attribute_title_ = content_; - attribute_title_.replace("<TITLE>", "", false); - attribute_title_.replace("</TITLE>", "", false); + attribute_title_.tqreplace("<TITLE>", "", false); + attribute_title_.tqreplace("</TITLE>", "", false); attribute_title_.stripWhiteSpace(); //kdDebug(23100) << "TITLE: " << attribute_title_ << endl; diff --git a/klinkstatus/src/parser/url.cpp b/klinkstatus/src/parser/url.cpp index 966bd509..164b54a6 100644 --- a/klinkstatus/src/parser/url.cpp +++ b/klinkstatus/src/parser/url.cpp @@ -39,13 +39,13 @@ Node::LinkType Url::resolveLinkType(TQString const& url) return Node::file_href; else if(findWord(KCharsets::resolveEntities(url), "MAILTO:") != -1) return Node::mailto; - else if( (int)url.find(":/") != -1) + else if( (int)url.tqfind(":/") != -1) return Node::href; else return Node::relative; } -KURL Url::normalizeUrl(TQString const& string_url, LinkStatus const& link_parent, TQString const& document_root) +KURL Url::normalizeUrl(TQString const& string_url, LinktqStatus const& link_parent, TQString const& document_root) { TQString _string_url = string_url.stripWhiteSpace(); @@ -124,7 +124,7 @@ KURL Url::normalizeUrl(TQString const& string_url) } } -bool Url::existUrl(KURL const& url, vector<LinkStatus*> const& v) +bool Url::existUrl(KURL const& url, vector<LinktqStatus*> const& v) { if(url.prettyURL().isEmpty()) return true; @@ -248,7 +248,7 @@ bool Url::hasProtocol(TQString const& url) /** http://linkstatus.paradigma.co.pt/en/index.html&bix=bix -> /en/index.html&bix=bix */ -TQString Url::convertToLocal(LinkStatus const* ls) +TQString Url::convertToLocal(LinktqStatus const* ls) { KURL url = ls->absoluteUrl(); KURL base_url = ls->rootUrl(); @@ -294,9 +294,9 @@ bool Url::localDomain(KURL const& url1, KURL const& url2, bool restrict) } /** - Returns true if url2 is a parent of url1. + Returns true if url2 is a tqparent of url1. */ -bool Url::parentDir(KURL const& url1, KURL const& url2) +bool Url::tqparentDir(KURL const& url1, KURL const& url2) { if(url1.protocol() != url2.protocol()) return false; diff --git a/klinkstatus/src/parser/url.h b/klinkstatus/src/parser/url.h index 8e13d812..0f704783 100644 --- a/klinkstatus/src/parser/url.h +++ b/klinkstatus/src/parser/url.h @@ -32,20 +32,20 @@ using namespace std; -class LinkStatus; +class LinktqStatus; namespace Url { Node::LinkType resolveLinkType(TQString const& url); -KURL normalizeUrl(TQString const& string_url, LinkStatus const& link_parent, TQString const& document_root); +KURL normalizeUrl(TQString const& string_url, LinktqStatus const& link_parent, TQString const& document_root); KURL normalizeUrl(TQString const& string_url); bool validUrl(KURL const& url); -bool existUrl(KURL const& url, vector<LinkStatus*> const& v); +bool existUrl(KURL const& url, vector<LinktqStatus*> const& v); bool equalHost(TQString const& host1, TQString const& host2, bool restrict = false); bool hasProtocol(TQString const& url); -TQString convertToLocal(LinkStatus const* ls); +TQString convertToLocal(LinktqStatus const* ls); bool localDomain(KURL const& url1, KURL const& url2, bool restrict = true); -bool parentDir(KURL const& url1, KURL const& url2); +bool tqparentDir(KURL const& url1, KURL const& url2); bool externalLink(KURL const& url1, KURL const& url2, bool restrict = true); } |