pleyo.com

/src/trunk2/BAL/Interfaces/BidiContext.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
00003  * Copyright (C) 2003, 2004, 2006, 2007 Apple Inc.  All right reserved.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  *
00020  */
00021 
00022 #ifndef BidiContext_h
00023 #define BidiContext_h
00024 
00025 #include <wtf/Assertions.h>
00026 #include <wtf/RefPtr.h>
00027 #include <wtf/unicode/Unicode.h>
00028 
00029 namespace WebCore {
00030 
00031 // Used to keep track of explicit embeddings.
00032 class BidiContext {
00033 public:
00034     BidiContext(unsigned char level, WTF::Unicode::Direction direction, bool override = false, BidiContext* parent = 0)
00035         : m_level(level)
00036         , m_direction(direction)
00037         , m_override(override)
00038         , m_parent(parent)
00039         , m_refCount(0)
00040     {
00041         ASSERT(direction == WTF::Unicode::LeftToRight || direction == WTF::Unicode::RightToLeft);
00042     }
00043 
00044     void ref() const { m_refCount++; }
00045     void deref() const
00046     {
00047         m_refCount--;
00048         if (m_refCount <= 0)
00049             delete this;
00050     }
00051 
00052     BidiContext* parent() const { return m_parent.get(); }
00053     unsigned char level() const { return m_level; }
00054     WTF::Unicode::Direction dir() const { return static_cast<WTF::Unicode::Direction>(m_direction); }
00055     bool override() const { return m_override; }
00056 
00057 private:
00058     unsigned char m_level;
00059     unsigned m_direction : 5; // Direction
00060     bool m_override : 1;
00061     RefPtr<BidiContext> m_parent;
00062     mutable int m_refCount;
00063 };
00064 
00065 bool operator==(const BidiContext&, const BidiContext&);
00066 
00067 } // namespace WebCore
00068 
00069 #endif // BidiContext_h

Generated on Wed Nov 21 20:04:16 2007 for Origyn Web Browser by Doxygen 1.5.3

pleyo.com
pleyo.com