[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: patch: KURL
From:       Dirk Mueller <mueller () kde ! org>
Date:       2000-10-09 23:32:24
[Download RAW message or body]

On Mon, 09 Okt 2000, David Faure wrote:

> Oh, I didn't know we still had a m_strMalformed......
> KURL was made to use m_strProtocol in order to save one member variable
> (it's not possible to have an invalid url and a valid protocol/path/host etc.
> at the same time, so having separate member variables is definitely a waste
> of memory).

hmm. its probably not much memory wasted.. ok, I undo that change now. we
can use the wasted QString for caching later. and happily a QString as
exactly the size of void* :-)

cool, so we can keep the BC this way :)

> koshell_shell.cc:          name = rootDocument()->url().filename(); 
> Just one example (for which I'm guilty :-).

hmm, and you really use that although it prints out a kdDebug warning???

> And there are many apps that are NOT in CVS, and I'm sure the authors would be pretty
> pissed off if right before 2.0 they didn't compile anymore. We've been promising a freeze
> in kdelibs (at _least_ the API !!) for some time now.

Hmm, I doubt that they want to use a function that prints out a warning
each time you use it..

again revised patch..


Dirk

["patch2.kurl" (text/plain)]

Index: kurl.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kurl.cpp,v
retrieving revision 1.143
diff -u -2 -d -p -b -r1.143 kurl.cpp
--- kurl.cpp	2000/10/09 10:26:13	1.143
+++ kurl.cpp	2000/10/09 23:31:43
@@ -272,4 +272,9 @@ KURL::KURL()
 }
 
+KURL::~KURL()
+{
+}
+
+
 KURL::KURL( const QString &url, int encoding_hint )
 {
@@ -964,9 +969,4 @@ QString KURL::url( int _trailing ) const
 }
 
-QString KURL::prettyURL() const
-{
-  return prettyURL( 0 );
-}
-
 QString KURL::prettyURL( int _trailing ) const
 {
@@ -1070,10 +1070,4 @@ KURL KURL::join( const KURL::List & lst 
 }
 
-QString KURL::filename( bool _ignore_trailing_slash_in_path ) const
-{
-    kdDebug() << "KURL::filename() is obsolete, use KURL::fileName() instead" << endl;
-    return fileName(_ignore_trailing_slash_in_path);
-}
-
 QString KURL::fileName( bool _strip_trailing_slash ) const
 {
@@ -1166,9 +1160,4 @@ QString KURL::directory( bool _strip_tra
 
 
-bool KURL::cd( const QString& _dir, bool )
-{
-   return cd(_dir);
-}
-
 // implemented by David, faure@kde.org
 // Modified by Torben, weis@kde.org
@@ -1220,11 +1209,4 @@ bool KURL::cd( const QString& _dir )
 
   return true;
-}
-
-
-/** Provide for binary compatibility only. **/
-KURL KURL::upURL( bool ) const
-{
-  return upURL();
 }
 
Index: kurl.h
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kurl.h,v
retrieving revision 1.68
diff -u -2 -d -p -b -r1.68 kurl.h
--- kurl.h	2000/09/14 01:19:34	1.68
+++ kurl.h	2000/10/09 23:31:43
@@ -27,4 +27,6 @@ class QUrl;
 class QStringList;
 
+struct KURLPrivate;
+
 /**
  * Represent and parse a URL.
@@ -62,5 +64,11 @@ public:
    */
   KURL();
+
   /**
+   * destruktor
+   */
+  ~KURL();
+
+  /**
    * Usual constructor, to construct from a string.
    * @param url A URL, not a filename. If the URL does not have a protocol
@@ -275,8 +283,12 @@ public:
 
   /**
-   * @return @p true if the URL is malformed. This function does @em not test
+   * @return @p false if the URL is malformed. This function does @em not test
    *         whether sub URLs are well-formed, too.
    */
-  bool isMalformed() const  { return m_bIsMalformed; }
+  bool isValid() const  { return !m_bIsMalformed; }
+  /*
+   * @deprecated
+   */
+  bool isMalformed() const { return !isValid(); }
 
   /**
@@ -327,8 +339,4 @@ public:
    */
   QString fileName( bool _ignore_trailing_slash_in_path = true ) const;
-  /**
-   * For backward compatiblity only.
-   */
-  QString filename( bool _ignore_trailing_slash_in_path = true ) const;
 
   /**
@@ -360,7 +368,4 @@ public:
   bool cd( const QString& _dir );
 
-  /** Provide for binary compatibility only. **/
-  bool cd( const QString& _dir, bool zapRef );
-
   /**
    * @return The complete URL, with all escape sequences intact.
@@ -378,6 +383,5 @@ public:
    * Example: http://localhost:8080/test.cgi?test=hello world&name=fred
    */
-  QString prettyURL() const;
-  QString prettyURL( int _trailing ) const; // BCI
+  QString prettyURL( int _trailing = 0) const;
 
   /**
@@ -395,7 +399,4 @@ public:
   KURL upURL( ) const;
 
-  /** Provide for binary compatibility only. **/
-  KURL upURL( bool ) const;
-
   KURL& operator=( const KURL& _u );
   KURL& operator=( const QString& _url );
@@ -505,8 +506,8 @@ private:
   QString m_strRef_encoded;
   QString m_strQuery_encoded;
-  QString m_strMalformed;
-  bool m_bIsMalformed;
+  KURLPrivate* d;
+  bool m_bIsMalformed : 1;
+  int freeForUse      : 7;
   unsigned short int m_iPort;
-
   QString m_strPath_encoded;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic