• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3  * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  */
21 
22 #include "config.h"
23 #include "BindingURI.h"
24 
25 #if ENABLE(XBL)
26 
27 namespace WebCore {
28 
BindingURI(StringImpl * uri)29 BindingURI::BindingURI(StringImpl* uri)
30     : m_next(0)
31 {
32     m_uri = uri;
33     if (uri)
34         uri->ref();
35 }
36 
~BindingURI()37 BindingURI::~BindingURI()
38 {
39     if (m_uri)
40         m_uri->deref();
41     delete m_next;
42 }
43 
copy()44 BindingURI* BindingURI::copy()
45 {
46     BindingURI* newBinding = new BindingURI(m_uri);
47     if (next()) {
48         BindingURI* nextCopy = next()->copy();
49         newBinding->setNext(nextCopy);
50     }
51 
52     return newBinding;
53 }
54 
operator ==(const BindingURI & o) const55 bool BindingURI::operator==(const BindingURI& o) const
56 {
57     if ((m_next && !o.m_next) || (!m_next && o.m_next) ||
58         (m_next && o.m_next && *m_next != *o.m_next))
59         return false;
60 
61     if (m_uri == o.m_uri)
62         return true;
63     if (!m_uri || !o.m_uri)
64         return false;
65 
66     return String(m_uri) == String(o.m_uri);
67 }
68 
69 } // namespace WebCore
70 
71 #endif // ENABLE(XBL)
72