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

List:       kde-commits
Subject:    extragear/multimedia/kmplayer/src
From:       Koos Vriezen <koos.vriezen () gmail ! com>
Date:       2009-08-31 21:32:47
Message-ID: 1251754367.818968.17202.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1017917 by vriezen:

List aren't shared anymore so remove the Item base

 M  +1 -1      kmplayer_asx.cpp  
 M  +3 -3      kmplayer_atom.cpp  
 M  +2 -2      kmplayer_rp.cpp  
 M  +1 -1      kmplayer_smil.cpp  
 M  +1 -1      kmplayerapp.cpp  
 M  +17 -17    kmplayerplaylist.cpp  
 M  +9 -13     kmplayerplaylist.h  
 M  +1 -1      kmplayerprocess.cpp  
 M  +3 -3      playlistview.cpp  


--- trunk/extragear/multimedia/kmplayer/src/kmplayer_asx.cpp #1017916:1017917
@@ -25,7 +25,7 @@
 using namespace KMPlayer;
 
 static QString getAsxAttribute (Element * e, const QString & attr) {
-    for (Attribute *a = e->attributes ()->first (); a; a = a->nextSibling ())
+    for (Attribute *a = e->attributes ().first (); a; a = a->nextSibling ())
         if (attr == a->name ().toString ().lower ())
             return a->value ();
     return QString ();
--- trunk/extragear/multimedia/kmplayer/src/kmplayer_atom.cpp #1017916:1017917
@@ -89,7 +89,7 @@
 void ATOM::Link::closed () {
     QString href;
     QString rel;
-    for (Attribute *a = attributes ()->first (); a; a = a->nextSibling ()) {
+    for (Attribute *a = attributes ().first (); a; a = a->nextSibling ()) {
         if (a->name () == StringPool::attr_href)
             href = a->value ();
         else if (a->name () == StringPool::attr_title)
@@ -105,7 +105,7 @@
 }
 
 void ATOM::Content::closed () {
-    for (Attribute *a = attributes ()->first (); a; a = a->nextSibling ()) {
+    for (Attribute *a = attributes ().first (); a; a = a->nextSibling ()) {
         if (a->name () == StringPool::attr_src)
             src = a->value ();
         else if (a->name () == StringPool::attr_type) {
@@ -271,7 +271,7 @@
 void ATOM::MediaContent::closed () {
     unsigned fsize = 0;
     TrieString fs ("fileSize");
-    for (Attribute *a = attributes ()->first (); a; a = a->nextSibling ()) {
+    for (Attribute *a = attributes ().first (); a; a = a->nextSibling ()) {
         if (a->name () == StringPool::attr_url)
             src = a->value();
         else if (a->name () == StringPool::attr_type)
--- trunk/extragear/multimedia/kmplayer/src/kmplayer_rp.cpp #1017916:1017917
@@ -43,7 +43,7 @@
 KDE_NO_EXPORT void RP::Imfl::closed () {
     for (Node *n = firstChild (); n; n = n->nextSibling ())
         if (RP::id_node_head == n->id) {
-            Attribute *a = static_cast <Element *> (n)->attributes ()->first ();
+            Attribute *a = static_cast <Element *> (n)->attributes ().first ();
             for (; a; a = a->nextSibling ()) {
                 if (StringPool::attr_width == a->name ()) {
                     size.width = a->value ().toInt ();
@@ -281,7 +281,7 @@
     setState (state_activated);
     x = y = w = h = 0;
     srcx = srcy = srcw = srch = 0;
-    for (Attribute *a = attributes ()->first (); a; a = a->nextSibling ()) {
+    for (Attribute *a = attributes ().first (); a; a = a->nextSibling ()) {
         if (a->name () == StringPool::attr_target) {
             for (Node *n = parentNode()->firstChild(); n; n= n->nextSibling())
                 if (static_cast <Element *> (n)->
--- trunk/extragear/multimedia/kmplayer/src/kmplayer_smil.cpp #1017916:1017917
@@ -3125,7 +3125,7 @@
 KDE_NO_EXPORT void SMIL::MediaType::activate () {
     init (); // sets all attributes
     setState (state_activated);
-    for (Attribute *a = attributes ()->first (); a; a = a->nextSibling ()) {
+    for (Attribute *a = attributes ().first (); a; a = a->nextSibling ()) {
         QString v = a->value ();
         int p = v.indexOf ('{');
         if (p > -1) {
--- trunk/extragear/multimedia/kmplayer/src/kmplayerapp.cpp #1017916:1017917
@@ -1110,7 +1110,7 @@
                 QTextStream ts (&file);
                 ts.setEncoding (QTextStream::UnicodeUTF8);
                 ts << QString ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
-                if (doc->childNodes ()->length () == 1)
+                if (doc->childNodes ().length () == 1)
                     ts << doc->innerXML ();
                 else
                     ts << doc->outerXML ();
--- trunk/extragear/multimedia/kmplayer/src/kmplayerplaylist.cpp #1017916:1017917
@@ -466,7 +466,7 @@
         const Element *e = static_cast <const Element *> (p);
         QString indent (QString ().fill (QChar (' '), depth));
         out << indent << QChar ('<') << XMLStringlet (e->nodeName ());
-        for (Attribute *a = e->attributes()->first(); a; a = a->nextSibling())
+        for (Attribute *a = e->attributes().first(); a; a = a->nextSibling())
             out << " " << XMLStringlet (a->name ().toString ()) <<
                 "=\"" << XMLStringlet (a->value ()) << "\"";
         if (e->hasChildNodes ()) {
@@ -594,7 +594,7 @@
 }
 
 Element::Element (NodePtr & d, short id)
-    : Node (d, id), m_attributes (new AttributeList), d (new ElementPrivate) {}
+    : Node (d, id), d (new ElementPrivate) {}
 
 Element::~Element () {
     delete d;
@@ -652,20 +652,20 @@
 }
 
 void Element::setAttribute (const TrieString & name, const QString & value) {
-    for (Attribute *a = m_attributes->first (); a; a = a->nextSibling ())
+    for (Attribute *a = m_attributes.first (); a; a = a->nextSibling ())
         if (name == a->name ()) {
             if (value.isNull ())
-                m_attributes->remove (a);
+                m_attributes.remove (a);
             else
                 a->setValue (value);
             return;
         }
     if (!value.isNull ())
-        m_attributes->append (new Attribute (TrieString (), name, value));
+        m_attributes.append (new Attribute (TrieString (), name, value));
 }
 
 QString Element::getAttribute (const TrieString & name) {
-    for (Attribute *a = m_attributes->first (); a; a = a->nextSibling ())
+    for (Attribute *a = m_attributes.first (); a; a = a->nextSibling ())
         if (name == a->name ())
             return a->value ();
     return QString ();
@@ -673,7 +673,7 @@
 
 void Element::init () {
     d->clear();
-    for (Attribute *a = attributes ()->first (); a; a = a->nextSibling ()) {
+    for (Attribute *a = attributes ().first (); a; a = a->nextSibling ()) {
         QString v = a->value ();
         int p = v.indexOf ('{');
         if (p > -1) {
@@ -691,12 +691,12 @@
 }
 
 void Element::clear () {
-    m_attributes = new AttributeList; // remove attributes
+    m_attributes = AttributeList (); // remove attributes
     d->clear();
     Node::clear ();
 }
 
-void Element::setAttributes (AttributeListPtr attrs) {
+void Element::setAttributes (const AttributeList &attrs) {
     m_attributes = attrs;
 }
 
@@ -1431,7 +1431,7 @@
 public:
     DocumentBuilder (NodePtr d, bool set_opener);
     ~DocumentBuilder () {}
-    bool startTag (const QString & tag, AttributeListPtr attr);
+    bool startTag (const QString & tag, const AttributeList &attr);
     bool endTag (const QString & tag);
     bool characterData (const QString & data);
     bool cdataData (const QString & data);
@@ -1454,7 +1454,7 @@
 #endif
 {}
 
-bool DocumentBuilder::startTag(const QString &tag, AttributeListPtr attr) {
+bool DocumentBuilder::startTag(const QString &tag, const AttributeList &attr) {
     if (m_ignore_depth) {
         m_ignore_depth++;
         //kDebug () << "Warning: ignored tag " << tag.latin1 () << " ignore depth = \
" << m_ignore_depth; @@ -1556,10 +1556,10 @@
 
 static void startTag (void *data, const char * tag, const char **attr) {
     DocumentBuilder * builder = static_cast <DocumentBuilder *> (data);
-    AttributeListPtr attributes = new AttributeList;
+    AttributeList attributes;
     if (attr && attr [0]) {
         for (int i = 0; attr[i]; i += 2)
-            attributes->append (new Attribute (
+            attributes.append (new Attribute (
                         TrieString(),
                         QString::fromUtf8 (attr [i]),
                         QString::fromUtf8 (attr [i+1])));
@@ -1640,7 +1640,7 @@
         SharedPtr <TokenInfo> next;
     };
     typedef SharedPtr <TokenInfo> TokenInfoPtr;
-    SimpleSAXParser (DocumentBuilder & b) : builder (b), position (0), m_attributes \
(new AttributeList), equal_seen (false), in_dbl_quote (false), in_sngl_quote (false), \
have_error (false), no_entitity_look_ahead (false), have_next_char (false) {} +    \
SimpleSAXParser (DocumentBuilder & b) : builder (b), position (0), equal_seen \
(false), in_dbl_quote (false), in_sngl_quote (false), have_error (false), \
no_entitity_look_ahead (false), have_next_char (false) {}  virtual ~SimpleSAXParser \
() {};  bool parse (QTextStream & d);
 private:
@@ -1661,7 +1661,7 @@
     TokenInfoPtr next_token, token, prev_token;
     // for element reading
     QString tagname;
-    AttributeListPtr m_attributes;
+    AttributeList m_attributes;
     QString attr_namespace, attr_name, attr_value;
     QString cdata;
     bool equal_seen;
@@ -1728,7 +1728,7 @@
 
 void SimpleSAXParser::push_attribute () {
     //kDebug () << "attribute " << attr_name.latin1 () << "=" << attr_value.latin1 \
                ();
-    m_attributes->append(new Attribute (attr_namespace, attr_name, attr_value));
+    m_attributes.append(new Attribute (attr_namespace, attr_name, attr_value));
     attr_namespace.clear ();
     attr_name.truncate (0);
     attr_value.truncate (0);
@@ -2114,7 +2114,7 @@
                     if (token->token == tok_angle_open) {
                         attr_name.truncate (0);
                         attr_value.truncate (0);
-                        m_attributes = new AttributeList;
+                        m_attributes = AttributeList ();
                         equal_seen = in_sngl_quote = in_dbl_quote = false;
                         m_state = new StateInfo (InTag, m_state);
                         ok = readTag ();
--- trunk/extragear/multimedia/kmplayer/src/kmplayerplaylist.h #1017916:1017917
@@ -135,10 +135,10 @@
  }
 
 /*
- * A shareable double linked list of ListNodeBase<T> nodes
+ * A double linked list of ListNodeBase<T> nodes
  */
 template <class T>
-class KMPLAYER_EXPORT List : public Item <List <T> > {
+class KMPLAYER_EXPORT List {
 public:
     List () {}
     List (typename Item<T>::SharedType f, typename Item<T>::SharedType l)
@@ -299,12 +299,7 @@
 typedef Item<Attribute>::SharedType AttributePtr;
 typedef Item<Attribute>::WeakType AttributePtrW;
 typedef List<Node> NodeList;                 // eg. for Node's children
-typedef Item<NodeList>::SharedType NodeListPtr;
-typedef Item<NodeList>::WeakType NodeListPtrW;
-ITEM_AS_POINTER(KMPlayer::NodeList)
 typedef List<Attribute> AttributeList;       // eg. for Element's attributes
-typedef Item<AttributeList>::SharedType AttributeListPtr;
-ITEM_AS_POINTER(KMPlayer::AttributeList)
 typedef ListNode<NodePtrW> NodeRefItem;      // Node for ref Nodes
 ITEM_AS_POINTER(KMPlayer::NodeRefItem)
 typedef ListNode<NodePtr> NodeStoreItem;   // list stores Nodes
@@ -530,7 +525,7 @@
     void normalize ();
     KDE_NO_EXPORT bool isDocument () const { return m_doc == m_self; }
 
-    KDE_NO_EXPORT NodeListPtr childNodes () const;
+    NodeList childNodes () const;
     void setState (State nstate);
     /*
      * Open tag is found by parser, attributes are set
@@ -573,10 +568,11 @@
 class KMPLAYER_EXPORT Element : public Node {
 public:
     ~Element ();
-    void setAttributes (AttributeListPtr attrs);
+    void setAttributes (const AttributeList &attrs);
     void setAttribute (const TrieString & name, const QString & value);
     QString getAttribute (const TrieString & name);
-    KDE_NO_EXPORT AttributeList *attributes () const { return m_attributes.ptr (); }
+    KDE_NO_EXPORT AttributeList &attributes () { return m_attributes; }
+    KDE_NO_EXPORT AttributeList attributes () const { return m_attributes; }
     virtual void init ();
     virtual void reset ();
     virtual void clear ();
@@ -596,7 +592,7 @@
     virtual void parseParam (const TrieString &, const QString &) {}
 protected:
     Element (NodePtr & d, short id=0);
-    AttributeListPtr m_attributes;
+    AttributeList m_attributes;
 private:
     ElementPrivate * d;
 };
@@ -1074,8 +1070,8 @@
     c->m_parent = 0L;
 }
 
-inline KDE_NO_EXPORT NodeListPtr Node::childNodes () const {
-    return new NodeList (m_first_child, m_last_child);
+inline KDE_NO_EXPORT NodeList Node::childNodes () const {
+    return NodeList (m_first_child, m_last_child);
 }
 
 }  // KMPlayer namespace
--- trunk/extragear/multimedia/kmplayer/src/kmplayerprocess.cpp #1017916:1017917
@@ -2504,7 +2504,7 @@
                     remote_service, "/plugin", "org.kde.kmplayer.backend", "play");
             msg << m_url << mime << plugin;
             QMap <QString, QVariant> urlargs;
-            for (AttributePtr a = elm->attributes ()->first (); a; a = \
a->nextSibling ()) +            for (AttributePtr a = elm->attributes ().first (); a; \
a = a->nextSibling ())  urlargs.insert (a->name ().toString (), a->value ());
             msg << urlargs;
             msg.setDelayedReply (false);
--- trunk/extragear/multimedia/kmplayer/src/playlistview.cpp #1017916:1017917
@@ -117,7 +117,7 @@
 
 //-----------------------------------------------------------------------------
 
-KDE_NO_CDTOR_EXPORT PlayListView::PlayListView (QWidget * parent, View * view, \
KActionCollection * ac) +KDE_NO_CDTOR_EXPORT PlayListView::PlayListView (QWidget *, \
View * view, KActionCollection * ac)  : //K3ListView (parent),
    m_view (view),
    m_find_dialog (0L),
@@ -204,7 +204,7 @@
     for (Node *c = e->lastChild (); c; c = c->previousSibling ())
         populate (c, focus, root, item, curitem);
     if (e->isElementNode ()) {
-        Attribute *a = static_cast <Element *> (e)->attributes ()->first ();
+        Attribute *a = static_cast <Element *> (e)->attributes ().first ();
         if (a) {
             root->have_dark_nodes = true;
             if (root->show_all_nodes) {
@@ -661,7 +661,7 @@
                 m_current_find_attr = 0L;
                 found = true;
             } else if (elm && ri->show_all_nodes) {
-                for (Attribute *a = static_cast <Element *> (n)->attributes \
()->first (); a; a = a->nextSibling ()) { +                for (Attribute *a = \
static_cast <Element *> (n)->attributes ().first (); a; a = a->nextSibling ()) {  \
QString attr = a->name ().toString ();  if (((opt & KFind::RegularExpression) &&
                                 (attr.find (regexp, 0) || a->value ().find (regexp, \
0) > -1)) ||


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

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