• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

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 #include <QChar>
00029 
00030 namespace WTF {
00031     namespace Unicode {
00032         enum Direction {
00033             LeftToRight = QChar::DirL,
00034             RightToLeft = QChar::DirR,
00035             EuropeanNumber = QChar::DirEN,
00036             EuropeanNumberSeparator = QChar::DirES,
00037             EuropeanNumberTerminator = QChar::DirET,
00038             ArabicNumber = QChar::DirAN,
00039             CommonNumberSeparator = QChar::DirCS,
00040             BlockSeparator = QChar::DirB,
00041             SegmentSeparator = QChar::DirS,
00042             WhiteSpaceNeutral = QChar::DirWS,
00043             OtherNeutral = QChar::DirON,
00044             LeftToRightEmbedding = QChar::DirLRE,
00045             LeftToRightOverride = QChar::DirLRO,
00046             RightToLeftArabic = QChar::DirAL,
00047             RightToLeftEmbedding = QChar::DirRLE,
00048             RightToLeftOverride = QChar::DirRLO,
00049             PopDirectionalFormat = QChar::DirPDF,
00050             NonSpacingMark = QChar::DirNSM,
00051             BoundaryNeutral = QChar::DirBN
00052         };
00053         inline Direction direction(unsigned c) { return (Direction)QChar::direction(c); }
00054     }
00055 }
00056 
00057 namespace WebCore {
00058 
00059 // Used to keep track of explicit embeddings.
00060 class BidiContext {
00061 public:
00062     BidiContext(unsigned char level, WTF::Unicode::Direction direction, bool override = false, BidiContext* parent = 0)
00063         : m_level(level)
00064         , m_direction(direction)
00065         , m_override(override)
00066         , m_parent(parent)
00067         , m_refCount(0)
00068     {
00069         ASSERT(direction == WTF::Unicode::LeftToRight || direction == WTF::Unicode::RightToLeft);
00070     }
00071 
00072     void ref() const { m_refCount++; }
00073     void deref() const
00074     {
00075         m_refCount--;
00076         if (m_refCount <= 0)
00077             delete this;
00078     }
00079 
00080     BidiContext* parent() const { return m_parent.get(); }
00081     unsigned char level() const { return m_level; }
00082     WTF::Unicode::Direction dir() const { return static_cast<WTF::Unicode::Direction>(m_direction); }
00083     bool override() const { return m_override; }
00084 
00085 private:
00086     unsigned char m_level;
00087     unsigned m_direction : 5; // Direction
00088     bool m_override : 1;
00089     RefPtr<BidiContext> m_parent;
00090     mutable int m_refCount;
00091 };
00092 
00093 bool operator==(const BidiContext&, const BidiContext&);
00094 
00095 } // namespace WebCore
00096 
00097 #endif // BidiContext_h

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal