linklocator.h
00001 00023 #ifndef LINKLOCATOR_H_INCLUDED 00024 #define LINKLOCATOR_H_INCLUDED 00025 00026 #include <qstring.h> 00027 00038 class LinkLocator 00039 { 00040 public: 00049 LinkLocator(const QString& text, int pos = 0); 00050 00061 void setMaxUrlLen(int length); 00062 00068 int maxUrlLen() const; 00069 00080 void setMaxAddressLen(int length); 00081 00088 int maxAddressLen() const; 00089 00098 QString getUrl(); 00099 00111 QString getEmailAddress(); 00112 00127 static QString convertToHtml(const QString& plainText, bool preserveBlanks = false, 00128 int maxUrlLen = 4096, int maxAddressLen = 255); 00129 00130 protected: 00134 QString mText; 00138 int mPos; 00139 00140 private: 00141 int mMaxUrlLen; 00142 int mMaxAddressLen; 00143 00144 bool atUrl() const; 00145 bool isEmptyUrl(const QString& url); 00146 bool isEmptyAddress(const QString& address); 00147 }; 00148 00149 #endif // LINKLOCATOR_H_INCLUDED 00150