webengine/osswebengine/WebCore/css/CSSNamespace.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2  * This file is part of the CSS implementation for KDE.
       
     3  *
       
     4  * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
       
     5  *               1999 Waldo Bastian (bastian@kde.org)
       
     6  * Copyright (C) 2004, 2006 Apple Computer, Inc.
       
     7  *
       
     8  * This library is free software; you can redistribute it and/or
       
     9  * modify it under the terms of the GNU Library General Public
       
    10  * License as published by the Free Software Foundation; either
       
    11  * version 2 of the License, or (at your option) any later version.
       
    12  *
       
    13  * This library is distributed in the hope that it will be useful,
       
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    16  * Library General Public License for more details.
       
    17  *
       
    18  * You should have received a copy of the GNU Library General Public License
       
    19  * along with this library; see the file COPYING.LIB.  If not, write to
       
    20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    21  * Boston, MA 02110-1301, USA.
       
    22  */
       
    23 
       
    24 #ifndef CSSNamespace_h
       
    25 #define CSSNamespace_h
       
    26 
       
    27 #include "AtomicString.h"
       
    28 
       
    29 namespace WebCore {
       
    30 
       
    31     struct CSSNamespace {
       
    32         AtomicString m_prefix;
       
    33         AtomicString m_uri;
       
    34         CSSNamespace* m_parent;
       
    35 
       
    36         CSSNamespace(const AtomicString& prefix, const AtomicString& uri, CSSNamespace* parent)
       
    37             : m_prefix(prefix)
       
    38             , m_uri(uri)
       
    39             , m_parent(parent)
       
    40         {
       
    41         }
       
    42         ~CSSNamespace() { delete m_parent; }
       
    43 
       
    44         const AtomicString& uri() { return m_uri; }
       
    45         const AtomicString& prefix() { return m_prefix; }
       
    46 
       
    47         CSSNamespace* namespaceForPrefix(const AtomicString& prefix)
       
    48         {
       
    49             if (prefix == m_prefix)
       
    50                 return this;
       
    51             if (m_parent)
       
    52                 return m_parent->namespaceForPrefix(prefix);
       
    53             return 0;
       
    54         }
       
    55     };
       
    56 
       
    57 } // namespace WebCore
       
    58 
       
    59 #endif // CSSNamespace_h