diff options
Diffstat (limited to 'klinkstatus/src/parser')
-rw-r--r-- | klinkstatus/src/parser/htmlparser.cpp | 74 | ||||
-rw-r--r-- | klinkstatus/src/parser/htmlparser.h | 20 | ||||
-rw-r--r-- | klinkstatus/src/parser/http.cpp | 12 | ||||
-rw-r--r-- | klinkstatus/src/parser/http.h | 28 | ||||
-rw-r--r-- | klinkstatus/src/parser/mstring.cpp | 34 | ||||
-rw-r--r-- | klinkstatus/src/parser/mstring.h | 64 | ||||
-rw-r--r-- | klinkstatus/src/parser/node.cpp | 14 | ||||
-rw-r--r-- | klinkstatus/src/parser/node.h | 96 | ||||
-rw-r--r-- | klinkstatus/src/parser/node_impl.h | 64 | ||||
-rw-r--r-- | klinkstatus/src/parser/url.cpp | 42 | ||||
-rw-r--r-- | klinkstatus/src/parser/url.h | 14 |
11 files changed, 231 insertions, 231 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; diff --git a/klinkstatus/src/parser/htmlparser.h b/klinkstatus/src/parser/htmlparser.h index cf487ebf..c9e5ef10 100644 --- a/klinkstatus/src/parser/htmlparser.h +++ b/klinkstatus/src/parser/htmlparser.h @@ -21,7 +21,7 @@ #ifndef HTML_PARSER_H #define HTML_PARSER_H -#include <qstring.h> +#include <tqstring.h> #include <vector> @@ -42,7 +42,7 @@ class HtmlParser public: HtmlParser(); - HtmlParser(QString const& documento); + HtmlParser(TQString const& documento); ~HtmlParser(); vector<Node*> const& nodes() const; @@ -58,18 +58,18 @@ public: * Convenience function for performance as it only parse in order * to get the charset. */ - static QString findCharsetInMetaElement(QString const& html); + static TQString findCharsetInMetaElement(TQString const& html); // test: void mostra() const; private: - vector<QString> const& parseNodesOfType(QString const& element); + vector<TQString> const& parseNodesOfType(TQString const& element); /** * Vector nodes passed for performance. */ - static void parseNodesOfType(QString const& element, QString const& doc, vector<QString>& nodes); + static void parseNodesOfType(TQString const& element, TQString const& doc, vector<TQString>& nodes); void parseNodesOfTypeA(); void parseNodesOfTypeAREA(); @@ -89,20 +89,20 @@ private: e.g. endOfTag("<img src=\"bad > luck\">") => 22 (not 15) */ - static int endOfTag(QString const& s, int index = 0, QChar end_of_tag = '>'); + static int endOfTag(TQString const& s, int index = 0, TQChar end_of_tag = '>'); private: - vector<QString> aux_; // for what the hell is this? looks ugly... maybe I was drunk, can't remember + vector<TQString> aux_; // for what the hell is this? looks ugly... maybe I was drunk, can't remember vector<Node*> nodes_; NodeBASE node_BASE_; NodeTITLE node_TITLE_; NodeMETA node_META_content_type_; bool is_content_type_set_; - QString document_; - QString script_; // Fica aqui guardado (JavaScript, etc) - QString comments_; + TQString document_; + TQString script_; // Fica aqui guardado (JavaScript, etc) + TQString comments_; }; diff --git a/klinkstatus/src/parser/http.cpp b/klinkstatus/src/parser/http.cpp index 1133c937..6e086739 100644 --- a/klinkstatus/src/parser/http.cpp +++ b/klinkstatus/src/parser/http.cpp @@ -29,7 +29,7 @@ void HttpResponseHeader::parseLocation() { - QString cabecalho(toString()); + TQString cabecalho(toString()); int location = findWord(cabecalho, "Location: "); Q_ASSERT(location != -1); @@ -55,25 +55,25 @@ void HttpResponseHeader::parseLocation() location_ = cabecalho.mid(location, fim_de_linha - location); } -QString HttpResponseHeader::charset() const +TQString HttpResponseHeader::charset() const { return HttpResponseHeader::charset(value("content-type")); } -QString HttpResponseHeader::charset(QString const& contentTypeHttpHeaderLine) +TQString HttpResponseHeader::charset(TQString const& contentTypeHttpHeaderLine) { - QString _charset; + TQString _charset; if(contentTypeHttpHeaderLine.isEmpty()) return _charset; int index = contentTypeHttpHeaderLine.find("charset="); if(index != -1) - index += QString("charset=").length(); + index += TQString("charset=").length(); else { index = contentTypeHttpHeaderLine.find("charset:"); if(index != -1) - index += QString("charset:").length(); + index += TQString("charset:").length(); } if(index != -1) { diff --git a/klinkstatus/src/parser/http.h b/klinkstatus/src/parser/http.h index 5878cfd1..b955d25d 100644 --- a/klinkstatus/src/parser/http.h +++ b/klinkstatus/src/parser/http.h @@ -21,8 +21,8 @@ #ifndef HTTP_H #define HTTP_H -#include <qhttp.h> -#include <qstring.h> +#include <tqhttp.h> +#include <tqstring.h> class HttpResponseHeader: public QHttpResponseHeader @@ -30,39 +30,39 @@ class HttpResponseHeader: public QHttpResponseHeader public: HttpResponseHeader(); - HttpResponseHeader(const QHttpResponseHeader & header); - HttpResponseHeader(QString const& str); + HttpResponseHeader(const TQHttpResponseHeader & header); + HttpResponseHeader(TQString const& str); virtual ~HttpResponseHeader(); void parseLocation(); - QString const& location() const; - QString charset() const; + TQString const& location() const; + TQString charset() const; /** * Parses the charset from this kind of server response: * Content-Type: text/html; charset=EUC-JP * Return an empty string in case it doesn't find nothing. */ - static QString charset(QString const& contentTypeHttpHeaderLine); + static TQString charset(TQString const& contentTypeHttpHeaderLine); private: - QString location_; + TQString location_; }; inline HttpResponseHeader::HttpResponseHeader() - : QHttpResponseHeader() + : TQHttpResponseHeader() { } -inline HttpResponseHeader::HttpResponseHeader(const QHttpResponseHeader & /*header*/) - : QHttpResponseHeader() +inline HttpResponseHeader::HttpResponseHeader(const TQHttpResponseHeader & /*header*/) + : TQHttpResponseHeader() { } -inline HttpResponseHeader::HttpResponseHeader(QString const& str) - : QHttpResponseHeader() +inline HttpResponseHeader::HttpResponseHeader(TQString const& str) + : TQHttpResponseHeader() { parse(str); } @@ -71,7 +71,7 @@ inline HttpResponseHeader::~HttpResponseHeader() { } -inline QString const& HttpResponseHeader::location() const +inline TQString const& HttpResponseHeader::location() const { return location_; } diff --git a/klinkstatus/src/parser/mstring.cpp b/klinkstatus/src/parser/mstring.cpp index 114d6dc6..aa2cdec7 100644 --- a/klinkstatus/src/parser/mstring.cpp +++ b/klinkstatus/src/parser/mstring.cpp @@ -26,7 +26,7 @@ using namespace std; -int findWord(QString const& s, QString const& palavra, uint a_partir_do_indice) +int findWord(TQString const& s, TQString const& palavra, uint a_partir_do_indice) { int indice = s.find(palavra, a_partir_do_indice, false); @@ -36,7 +36,7 @@ int findWord(QString const& s, QString const& palavra, uint a_partir_do_indice) return (indice + palavra.length()); } -int findChar(QString const& s, QChar letra, 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); if(index == -1) @@ -48,10 +48,10 @@ int findChar(QString const& s, QChar letra, uint a_partir_do_indice) /** The string palavra, must not have any spaces. */ -int findSeparableWord(QString const& s_, QString const& palavra, uint a_partir_do_indice) +int findSeparableWord(TQString const& s_, TQString const& palavra, uint a_partir_do_indice) { bool encontrou = true; - QString s(s_); + TQString s(s_); uint indice_palavra = 0; int indice = a_partir_do_indice; @@ -88,7 +88,7 @@ int findSeparableWord(QString const& s_, QString const& palavra, uint a_partir_d return -1; } -int nextNonSpaceChar(QString const& s, uint i) +int nextNonSpaceChar(TQString const& s, uint i) { ++i; // while( (s[i] == ' ' || s[i] == '\t' || s[i] == '\r' || s[i] == '\n') @@ -107,7 +107,7 @@ int nextNonSpaceChar(QString const& s, uint i) e.g. nextSpaceChar("o biltre") => 1 */ -int nextSpaceChar(QString const& s, uint i) +int nextSpaceChar(TQString const& s, uint i) { //while( (s[i] != ' ' && s[i] != '\r' && s[i] != '\n' && s[i] != '\t') && //i < s.size() ) @@ -121,7 +121,7 @@ int nextSpaceChar(QString const& s, uint i) return -1; } -int nextCharDifferentThan(QChar c, QString const& s, uint i) +int nextCharDifferentThan(TQChar c, TQString const& s, uint i) { while(i < s.length() && s[i] == c) ++i; @@ -132,10 +132,10 @@ int nextCharDifferentThan(QChar c, QString const& s, uint i) return -1; } -vector<QString> tokenize(QString s) +vector<TQString> tokenize(TQString s) { Q_ASSERT(!s.isEmpty()); - vector<QString> v; + vector<TQString> v; while(true) { @@ -154,22 +154,22 @@ vector<QString> tokenize(QString s) } else { - QString palavra = s.mid(inicio, fim - inicio); + TQString palavra = s.mid(inicio, fim - inicio); v.push_back(palavra); s.remove(0, fim); } } } -vector<QString> tokenizeWordsSeparatedByDots(QString s) +vector<TQString> tokenizeWordsSeparatedByDots(TQString s) { - vector<QString> v; + vector<TQString> v; while(true) { int inicio = 0; if(s[0] == '.') - inicio = nextCharDifferentThan(QChar('.'), s, 0); + inicio = nextCharDifferentThan(TQChar('.'), s, 0); if(inicio == -1) return v; @@ -181,16 +181,16 @@ vector<QString> tokenizeWordsSeparatedByDots(QString s) } else { - QString palavra = s.mid(inicio, fim - inicio); + TQString palavra = s.mid(inicio, fim - inicio); v.push_back(palavra); s.remove(0, fim); } } } -vector<QString> tokenizeWordsSeparatedBy(QString s, QChar criteria) +vector<TQString> tokenizeWordsSeparatedBy(TQString s, TQChar criteria) { - vector<QString> v; + vector<TQString> v; while(true) { @@ -208,7 +208,7 @@ vector<QString> tokenizeWordsSeparatedBy(QString s, QChar criteria) } else { - QString palavra = s.mid(inicio, fim - inicio); + TQString palavra = s.mid(inicio, fim - inicio); v.push_back(palavra); s.remove(0, fim); } diff --git a/klinkstatus/src/parser/mstring.h b/klinkstatus/src/parser/mstring.h index cd359c7d..198850db 100644 --- a/klinkstatus/src/parser/mstring.h +++ b/klinkstatus/src/parser/mstring.h @@ -21,7 +21,7 @@ #ifndef STRING_H #define STRING_H -#include <qstring.h> +#include <tqstring.h> #include <vector> #include <cctype> @@ -37,14 +37,14 @@ typedef unsigned int uint; e.g. findWord("Biltre larvado", "biltre") => 6 */ -int findWord(QString const& s, QString const& palavra, uint a_partir_do_indice = 0); +int findWord(TQString const& s, TQString const& palavra, uint a_partir_do_indice = 0); /** Similar to std::string::find but return the next index of the first char it finds. Case insensitive. */ -int findChar(QString const& s, QChar letra, uint a_partir_do_indice = 0); +int findChar(TQString const& s, TQChar letra, uint a_partir_do_indice = 0); /** Same as findWord but non space chars are eliminated. @@ -55,70 +55,70 @@ int findChar(QString const& s, QChar letra, uint a_partir_do_indice = 0); findWord("<\na href=""></a>", "<a") => -1 findSeparableWord("<\na href=""></a>", "<a") => 3 */ -int findSeparableWord(QString const& s, QString const& palavra, uint a_partir_do_indice = 0); +int findSeparableWord(TQString const& s, TQString const& palavra, uint a_partir_do_indice = 0); /** Space means Unicode characters with decimal values 9 (TAB), 10 (LF), 11 (VT), 12 (FF), 13 (CR), and 32 (Space). */ -bool isSpace(QChar c); +bool isSpace(TQChar c); /** Return -1 if unsuccessful. */ -int nextNonSpaceChar(QString const& s, uint i); -int nextNonSpaceCharReverse(QString const& s, uint i); -int nextSpaceChar(QString const& s, uint i); +int nextNonSpaceChar(TQString const& s, uint i); +int nextNonSpaceCharReverse(TQString const& s, uint i); +int nextSpaceChar(TQString const& s, uint i); -int nextCharDifferentThan(QChar c, QString const& s, uint i); +int nextCharDifferentThan(TQChar c, TQString const& s, uint i); /** Return a vector with the words */ -std::vector<QString> tokenize(QString s); -std::vector<QString> tokenizeWordsSeparatedByDots(QString s); -std::vector<QString> tokenizeWordsSeparatedBy(QString s, QChar criteria); +std::vector<TQString> tokenize(TQString s); +std::vector<TQString> tokenizeWordsSeparatedByDots(TQString s); +std::vector<TQString> tokenizeWordsSeparatedBy(TQString s, TQChar criteria); /** Returns a string that has whitespace removed from the start and the end, and which has each sequence of internal whitespace replaced with a single space. */ -QString simplifyWhiteSpace(QString const& s); +TQString simplifyWhiteSpace(TQString const& s); /** If char 'caractere' is the last in the string 's' it is removed */ -void removeLastCharIfExists(QString& s, QChar caractere); +void removeLastCharIfExists(TQString& s, TQChar caractere); -QString upperCase(QString const& s); -QString lowerCase(QString const& s); +TQString upperCase(TQString const& s); +TQString lowerCase(TQString const& s); /** Remove whitespaces from the end of the string */ -void stripWhiteSpaceFromTheEnd(QString& s); +void stripWhiteSpaceFromTheEnd(TQString& s); /** Returns a string that has whitespace removed from the start and the end. */ -void stripWhiteSpace(QString& s); +void stripWhiteSpace(TQString& s); /** Case insensitive comparisons */ -bool equal(QString const& s1, QString const& s2); -bool notEqual(QString const& s1, QString const& s2); +bool equal(TQString const& s1, TQString const& s2); +bool notEqual(TQString const& s1, TQString const& s2); -bool equal(QChar c1, QChar c2); -bool notEqual(QChar c1, QChar c2); +bool equal(TQChar c1, TQChar c2); +bool notEqual(TQChar c1, TQChar c2); //_________________________________________________________________________ -inline bool isSpace(QChar c) +inline bool isSpace(TQChar c) { return c.isSpace(); } -inline bool equal(QString const& s1, QString const& s2) +inline bool equal(TQString const& s1, TQString const& s2) { if(s1 == s2) return true; @@ -126,44 +126,44 @@ inline bool equal(QString const& s1, QString const& s2) return s1.lower() == s2.lower(); } -inline bool notEqual(QString const& s1, QString const& s2) +inline bool notEqual(TQString const& s1, TQString const& s2) { return !(equal(s1, s2)); } -inline bool equal(QChar c1, QChar c2) +inline bool equal(TQChar c1, TQChar c2) { return c1.lower() == c2.lower(); } -inline bool notEqual(QChar c1, QChar c2) +inline bool notEqual(TQChar c1, TQChar c2) { return !(equal(c1, c2)); } -inline QString upperCase(QString const& s) +inline TQString upperCase(TQString const& s) { return s.upper(); } -inline QString lowerCase(QString const& s) +inline TQString lowerCase(TQString const& s) { return s.lower(); } -inline QString simplifyWhiteSpace(QString const& s) +inline TQString simplifyWhiteSpace(TQString const& s) { return s.simplifyWhiteSpace(); } -inline void removeLastCharIfExists(QString& s, QChar caractere) +inline void removeLastCharIfExists(TQString& s, TQChar caractere) { int index = s.length() - 1; if(s[index] == caractere) s.remove(index); } -inline void stripWhiteSpace(QString& s) +inline void stripWhiteSpace(TQString& s) { s = s.stripWhiteSpace(); } diff --git a/klinkstatus/src/parser/node.cpp b/klinkstatus/src/parser/node.cpp index 068184ae..cb5fdec4 100644 --- a/klinkstatus/src/parser/node.cpp +++ b/klinkstatus/src/parser/node.cpp @@ -28,9 +28,9 @@ Node________________________________________________________________________ */ -QString Node::getAttribute(QString const& atributo) +TQString Node::getAttribute(TQString const& atributo) { - QString attribute_; + TQString attribute_; int fim = - 1; bool tem_aspas_ou_plicas = false; @@ -140,7 +140,7 @@ void NodeLink::parseLinkLabel() fim_tag = content_.find(">", fim_tag); if(fim_tag != -1) - proximo_caractere = QChar(content_[++fim_tag]); + proximo_caractere = TQChar(content_[++fim_tag]); } while(fim_tag != -1 && proximo_caractere == '<'/*If the label starts by <*/); @@ -198,10 +198,10 @@ void NodeMETA::parseAttributeURL() } } -QString NodeMETA::charset() const +TQString NodeMETA::charset() const { - QString charset; - QString content(atributoCONTENT()); + TQString charset; + TQString content(atributoCONTENT()); if(content.isEmpty()) return charset; @@ -209,7 +209,7 @@ QString NodeMETA::charset() const int index = content.find("charset="); if(index != -1) { - index += QString("charset=").length(); + index += TQString("charset=").length(); charset = content.mid(index, content.length() - index); charset = charset.stripWhiteSpace(); } diff --git a/klinkstatus/src/parser/node.h b/klinkstatus/src/parser/node.h index 1d0b1fc3..0452c219 100644 --- a/klinkstatus/src/parser/node.h +++ b/klinkstatus/src/parser/node.h @@ -23,7 +23,7 @@ #include "mstring.h" -#include <qstring.h> +#include <tqstring.h> #include <kdebug.h> #include <kcharsets.h> @@ -55,18 +55,18 @@ public: }; Node(); - Node(QString const& content); + Node(TQString const& content); virtual ~Node(); - QString getAttribute(QString const& atributo); - virtual QString const& url() const = 0; - virtual QString const& linkLabel() const = 0; // URL label - virtual void setNode(QString const& content); + TQString getAttribute(TQString const& atributo); + virtual TQString const& url() const = 0; + virtual TQString const& linkLabel() const = 0; // URL label + virtual void setNode(TQString const& content); virtual void parse() = 0; void setMalformed(bool flag = true); virtual void setLinkType(LinkType const& lt); - QString const& content() const; + TQString const& content() const; bool malformed() const; LinkType linkType() const; Element element() const; @@ -78,8 +78,8 @@ protected: Element element_; LinkType linktype_; - QString link_label_; - QString content_; + TQString link_label_; + TQString content_; bool is_redirection_; bool malformed_; }; @@ -89,16 +89,16 @@ class NodeLink: public Node { public: NodeLink(); - NodeLink(QString const& content); + NodeLink(TQString const& content); ~NodeLink() {} ; virtual void parse(); - virtual QString const& url() const; - virtual QString const& linkLabel() const; // URL label - virtual QString mailto() const; + virtual TQString const& url() const; + virtual TQString const& linkLabel() const; // URL label + virtual TQString mailto() const; virtual bool isLink() const; private: @@ -106,17 +106,17 @@ private: void parseLinkLabel(); private: - QString attribute_href_; + TQString attribute_href_; }; class NodeA: public NodeLink { public: - NodeA(QString const& content); + NodeA(TQString const& content); ~NodeA() {} ; - QString const& attributeNAME() const; + TQString const& attributeNAME() const; virtual void parse(); @@ -124,16 +124,16 @@ private: void parseAttributeNAME(); private: - QString attribute_name_; + TQString attribute_name_; }; class NodeAREA: public NodeLink { public: - NodeAREA(QString const& content); + NodeAREA(TQString const& content); ~NodeAREA() {}; - QString const& attributeTITLE() const; + TQString const& attributeTITLE() const; virtual void parse(); @@ -141,14 +141,14 @@ private: void parseAttributeTITLE(); private: - QString attribute_title_; + TQString attribute_title_; }; class NodeLINK: public NodeLink { public: - NodeLINK(QString const& content); + NodeLINK(TQString const& content); ~NodeLINK() {} ; @@ -158,18 +158,18 @@ class NodeMETA: public Node { public: NodeMETA(); - NodeMETA(QString const& content); + NodeMETA(TQString const& content); ~NodeMETA() {} ; - virtual QString const& url() const; - virtual const QString& linkLabel() const; + virtual TQString const& url() const; + virtual const TQString& linkLabel() const; virtual bool isLink() const; - QString const& atributoHTTP_EQUIV() const; - QString const& atributoNAME() const; - QString const& atributoCONTENT() const; - QString charset() const; + TQString const& atributoHTTP_EQUIV() const; + TQString const& atributoNAME() const; + TQString const& atributoCONTENT() const; + TQString charset() const; bool isRedirection() const; virtual void parse(); @@ -187,24 +187,24 @@ private: void parseAttributeCONTENT(); private: - QString attribute_http_equiv_; - QString attribute_url_; - QString attribute_name_; - QString attribute_content_; + TQString attribute_http_equiv_; + TQString attribute_url_; + TQString attribute_name_; + TQString attribute_content_; }; class NodeIMG: public Node { public: - NodeIMG(QString const& content); + NodeIMG(TQString const& content); ~NodeIMG() {} ; virtual void parse(); - virtual QString const& url() const; - virtual QString const& linkLabel() const; // Image label + virtual TQString const& url() const; + virtual TQString const& linkLabel() const; // Image label virtual bool isLink() const; private: @@ -213,36 +213,36 @@ private: void parseAttributeALT(); private: - QString attribute_src_; - QString attribute_title_; - QString attribute_alt_; + TQString attribute_src_; + TQString attribute_title_; + TQString attribute_alt_; }; class NodeFRAME: public Node { public: - NodeFRAME(QString const& content); + NodeFRAME(TQString const& content); ~NodeFRAME() {} ; virtual void parse(); - virtual QString const& url() const; - virtual QString const& linkLabel() const; + virtual TQString const& url() const; + virtual TQString const& linkLabel() const; virtual bool isLink() const; private: void parseAttributeSRC(); private: - QString attribute_src_; + TQString attribute_src_; }; class NodeBASE: public NodeLink { public: NodeBASE(); - NodeBASE(QString const& content); + NodeBASE(TQString const& content); ~NodeBASE() {} ; @@ -254,23 +254,23 @@ class NodeTITLE: public Node { public: NodeTITLE(); - NodeTITLE(QString const& content); + NodeTITLE(TQString const& content); ~NodeTITLE() {} ; - virtual QString const& url() const; - virtual QString const& linkLabel() const; + virtual TQString const& url() const; + virtual TQString const& linkLabel() const; virtual void parse(); virtual bool isLink() const; - QString const& attributeTITLE() const; + TQString const& attributeTITLE() const; private: void parseAttributeTITLE(); private: - QString attribute_title_; + TQString attribute_title_; }; diff --git a/klinkstatus/src/parser/node_impl.h b/klinkstatus/src/parser/node_impl.h index 51249075..97224bd5 100644 --- a/klinkstatus/src/parser/node_impl.h +++ b/klinkstatus/src/parser/node_impl.h @@ -27,17 +27,17 @@ inline Node::~Node() //kdDebug(23100) << "/"; } -inline Node::Node(QString const& content) +inline Node::Node(TQString const& content) : content_(content), is_redirection_(false), malformed_(false) {} -inline void Node::setNode(QString const& content) +inline void Node::setNode(TQString const& content) { content_ = content; parse(); } -inline QString const& Node::content() const +inline TQString const& Node::content() const { return content_; } @@ -78,7 +78,7 @@ inline NodeLink::NodeLink() : Node() {} -inline NodeLink::NodeLink(QString const& content) +inline NodeLink::NodeLink(TQString const& content) : Node(content) { parse(); @@ -89,21 +89,21 @@ inline void NodeLink::parse() parseAttributeHREF(); } -inline QString const& NodeLink::url() const +inline TQString const& NodeLink::url() const { return attribute_href_; } -inline QString const& NodeLink::linkLabel() const +inline TQString const& NodeLink::linkLabel() const { return link_label_; } -inline QString NodeLink::mailto() const +inline TQString NodeLink::mailto() const { Q_ASSERT(linktype_ == Node::mailto); - QString href = KCharsets::resolveEntities(attribute_href_); + TQString href = KCharsets::resolveEntities(attribute_href_); int inicio = findWord(href, "MAILTO:"); Q_ASSERT(inicio != -1); @@ -121,14 +121,14 @@ inline bool NodeLink::isLink() const // class NodeA_______________________________________________________ -inline NodeA::NodeA(QString const& content) +inline NodeA::NodeA(TQString const& content) : NodeLink(content) { element_ = A; parse(); } -inline QString const& NodeA::attributeNAME() const +inline TQString const& NodeA::attributeNAME() const { return attribute_name_; } @@ -146,14 +146,14 @@ inline void NodeA::parseAttributeNAME() // class NodeAREA_______________________________________________________ -inline NodeAREA::NodeAREA(QString const& content) +inline NodeAREA::NodeAREA(TQString const& content) : NodeLink(content) { element_ = AREA; parse(); } -inline QString const& NodeAREA::attributeTITLE() const +inline TQString const& NodeAREA::attributeTITLE() const { return attribute_title_; } @@ -171,7 +171,7 @@ inline void NodeAREA::parseAttributeTITLE() // class NodeLINK________________________________________ -inline NodeLINK::NodeLINK(QString const& content) +inline NodeLINK::NodeLINK(TQString const& content) : NodeLink(content) { element_ = LINK; @@ -185,19 +185,19 @@ inline NodeMETA::NodeMETA() element_ = META; } -inline NodeMETA::NodeMETA(QString const& content) +inline NodeMETA::NodeMETA(TQString const& content) : Node(content) { element_ = META; parse(); } -inline QString const& NodeMETA::url() const +inline TQString const& NodeMETA::url() const { return attribute_url_; } -inline const QString& NodeMETA::linkLabel() const +inline const TQString& NodeMETA::linkLabel() const { return link_label_; } @@ -214,17 +214,17 @@ inline bool NodeMETA::isLink() const return false; } -inline QString const& NodeMETA::atributoHTTP_EQUIV() const +inline TQString const& NodeMETA::atributoHTTP_EQUIV() const { return attribute_http_equiv_; } -inline QString const& NodeMETA::atributoNAME() const +inline TQString const& NodeMETA::atributoNAME() const { return attribute_name_; } -inline QString const& NodeMETA::atributoCONTENT() const +inline TQString const& NodeMETA::atributoCONTENT() const { return attribute_content_; } @@ -263,7 +263,7 @@ inline void NodeMETA::parseAttributeCONTENT() // class NodeIMG________________________________________ -inline NodeIMG::NodeIMG(QString const& content) +inline NodeIMG::NodeIMG(TQString const& content) : Node(content) { element_ = IMG; @@ -277,12 +277,12 @@ inline void NodeIMG::parse() parseAttributeALT(); } -inline QString const& NodeIMG::url() const +inline TQString const& NodeIMG::url() const { return attribute_src_; } -inline QString const& NodeIMG::linkLabel() const +inline TQString const& NodeIMG::linkLabel() const { if(!attribute_title_.isEmpty()) return attribute_title_; @@ -311,7 +311,7 @@ inline void NodeIMG::parseAttributeALT() // class NodeFRAME________________________________________ -inline NodeFRAME::NodeFRAME(QString const& content) +inline NodeFRAME::NodeFRAME(TQString const& content) : Node(content) { element_ = FRAME; @@ -323,12 +323,12 @@ inline void NodeFRAME::parse() parseAttributeSRC(); } -inline QString const& NodeFRAME::url() const +inline TQString const& NodeFRAME::url() const { return attribute_src_; } -inline QString const& NodeFRAME::linkLabel() const +inline TQString const& NodeFRAME::linkLabel() const { return link_label_; } @@ -349,7 +349,7 @@ inline NodeBASE::NodeBASE() element_ = BASE; } -inline NodeBASE::NodeBASE(QString const& content) +inline NodeBASE::NodeBASE(TQString const& content) : NodeLink(content) { element_ = BASE; @@ -369,21 +369,21 @@ inline NodeTITLE::NodeTITLE() parse(); } -inline NodeTITLE::NodeTITLE(QString const& content) +inline NodeTITLE::NodeTITLE(TQString const& content) : Node(content) { element_ = TITLE; parse(); } -inline QString const& NodeTITLE::url() const +inline TQString const& NodeTITLE::url() const { - return QString::null; + return TQString::null; } -inline QString const& NodeTITLE::linkLabel() const +inline TQString const& NodeTITLE::linkLabel() const { - return QString::null; + return TQString::null; } inline void NodeTITLE::parse() @@ -396,7 +396,7 @@ inline bool NodeTITLE::isLink() const return false; } -inline QString const& NodeTITLE::attributeTITLE() const +inline TQString const& NodeTITLE::attributeTITLE() const { return attribute_title_; } diff --git a/klinkstatus/src/parser/url.cpp b/klinkstatus/src/parser/url.cpp index f7f1f6f8..966bd509 100644 --- a/klinkstatus/src/parser/url.cpp +++ b/klinkstatus/src/parser/url.cpp @@ -27,9 +27,9 @@ #include <kcharsets.h> -Node::LinkType Url::resolveLinkType(QString const& url) +Node::LinkType Url::resolveLinkType(TQString const& url) { - QString aux(url); + TQString aux(url); aux = KURL::decode_string(aux); if(aux.isNull()) @@ -45,11 +45,11 @@ Node::LinkType Url::resolveLinkType(QString const& url) return Node::relative; } -KURL Url::normalizeUrl(QString const& string_url, LinkStatus const& link_parent, QString const& document_root) +KURL Url::normalizeUrl(TQString const& string_url, LinkStatus const& link_parent, TQString const& document_root) { - QString _string_url = string_url.stripWhiteSpace(); + TQString _string_url = string_url.stripWhiteSpace(); - QString s_url; + TQString s_url; KURL base_url; // resolve base url @@ -101,9 +101,9 @@ KURL Url::normalizeUrl(QString const& string_url, LinkStatus const& link_parent, } } -KURL Url::normalizeUrl(QString const& string_url) +KURL Url::normalizeUrl(TQString const& string_url) { - QString qs_url(KCharsets::resolveEntities(string_url.stripWhiteSpace())); + TQString qs_url(KCharsets::resolveEntities(string_url.stripWhiteSpace())); if(qs_url[0] == '/') { @@ -145,7 +145,7 @@ bool Url::existUrl(KURL const& url, vector<LinkStatus*> const& v) alunos.iscte.pt, iscte.pt => false. */ // FIXME - Rename this function to sameDomain -bool Url::equalHost(QString const& host1, QString const& host2, bool restrict) +bool Url::equalHost(TQString const& host1, TQString const& host2, bool restrict) { //Q_ASSERT(!host1.isEmpty()); //Q_ASSERT(!host2.isEmpty()); // this fails if href="javascript:......." @@ -155,13 +155,13 @@ bool Url::equalHost(QString const& host1, QString const& host2, bool restrict) if(host1 == host2) return true; - QString host1_(KNetwork::KResolver::normalizeDomain(host1)); - QString host2_(KNetwork::KResolver::normalizeDomain(host2)); + TQString host1_(KNetwork::KResolver::normalizeDomain(host1)); + TQString host2_(KNetwork::KResolver::normalizeDomain(host2)); removeLastCharIfExists(host1_, '/'); removeLastCharIfExists(host2_, '/'); - vector<QString> v1 = tokenizeWordsSeparatedByDots(host1_); - vector<QString> v2 = tokenizeWordsSeparatedByDots(host2_); + vector<TQString> v1 = tokenizeWordsSeparatedByDots(host1_); + vector<TQString> v2 = tokenizeWordsSeparatedByDots(host2_); uint const size1 = v1.size(); uint const size2 = v2.size(); @@ -172,8 +172,8 @@ bool Url::equalHost(QString const& host1, QString const& host2, bool restrict) return false; } - vector<QString>::size_type aux = 0; - vector<QString>::size_type aux2 = 0; + vector<TQString>::size_type aux = 0; + vector<TQString>::size_type aux2 = 0; if(v1[0] == "www") aux = 1; if(v2[0] == "www") @@ -198,9 +198,9 @@ bool Url::equalHost(QString const& host1, QString const& host2, bool restrict) } /* This should be done by parsing but I wan't to know when some new scheme comes along :) */ -bool Url::hasProtocol(QString const& url) +bool Url::hasProtocol(TQString const& url) { - QString s_url(url); + TQString s_url(url); s_url.stripWhiteSpace(); if(s_url[0] == '/') @@ -248,7 +248,7 @@ bool Url::hasProtocol(QString const& url) /** http://linkstatus.paradigma.co.pt/en/index.html&bix=bix -> /en/index.html&bix=bix */ -QString Url::convertToLocal(LinkStatus const* ls) +TQString Url::convertToLocal(LinkStatus const* ls) { KURL url = ls->absoluteUrl(); KURL base_url = ls->rootUrl(); @@ -309,21 +309,21 @@ bool Url::parentDir(KURL const& url1, KURL const& url2) if(!equalHost(url1.host(), url2.host())) return false; - vector<QString> tokens_1 = tokenizeWordsSeparatedBy(url1.directory(true, false), QChar('/')); - vector<QString> tokens_2 = tokenizeWordsSeparatedBy(url2.directory(true, false), QChar('/')); + vector<TQString> tokens_1 = tokenizeWordsSeparatedBy(url1.directory(true, false), TQChar('/')); + vector<TQString> tokens_2 = tokenizeWordsSeparatedBy(url2.directory(true, false), TQChar('/')); if(tokens_1.size() == 0) return false; //if(tokens_2.size() > tokens_1.size() or tokens_2.size() == 0) //return true; - vector<QString>::size_type size = 0; + vector<TQString>::size_type size = 0; if(tokens_1.size() < tokens_2.size()) size = tokens_1.size(); else size = tokens_2.size(); - for(vector<QString>::size_type i = 0; i != size; ++i) + for(vector<TQString>::size_type i = 0; i != size; ++i) { if(tokens_2[i] != tokens_1[i]) return true; diff --git a/klinkstatus/src/parser/url.h b/klinkstatus/src/parser/url.h index 6f22743d..8e13d812 100644 --- a/klinkstatus/src/parser/url.h +++ b/klinkstatus/src/parser/url.h @@ -25,7 +25,7 @@ #include "node.h" #include <kurl.h> -#include <qstring.h> +#include <tqstring.h> #include <vector> @@ -36,14 +36,14 @@ class LinkStatus; namespace Url { -Node::LinkType resolveLinkType(QString const& url); -KURL normalizeUrl(QString const& string_url, LinkStatus const& link_parent, QString const& document_root); -KURL normalizeUrl(QString const& string_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); bool validUrl(KURL const& url); bool existUrl(KURL const& url, vector<LinkStatus*> const& v); -bool equalHost(QString const& host1, QString const& host2, bool restrict = false); -bool hasProtocol(QString const& url); -QString convertToLocal(LinkStatus const* ls); +bool equalHost(TQString const& host1, TQString const& host2, bool restrict = false); +bool hasProtocol(TQString const& url); +TQString convertToLocal(LinkStatus const* ls); bool localDomain(KURL const& url1, KURL const& url2, bool restrict = true); bool parentDir(KURL const& url1, KURL const& url2); bool externalLink(KURL const& url1, KURL const& url2, bool restrict = true); |