module Graphics.Vty.UnicodeWidthTable.Types
  ( UnicodeWidthTable(..)
  , WidthTableRange(..)
  )
where

import Data.Word (Word8, Word32)

-- | A range of code points in a width table.
data WidthTableRange =
    WidthTableRange { WidthTableRange -> Word32
rangeStart :: Word32
                    -- ^ The range's starting code point.
                    , WidthTableRange -> Word32
rangeSize :: Word32
                    -- ^ The number of code points in the contiguous
                    -- range, beginning with the starting code point
                    -- ('rangeStart').
                    , WidthTableRange -> Word8
rangeColumns :: Word8
                    -- ^ The terminal width, in columns, of all of the
                    -- characters corresponding to the code points in
                    -- this range.
                    }
    deriving (WidthTableRange -> WidthTableRange -> Bool
(WidthTableRange -> WidthTableRange -> Bool)
-> (WidthTableRange -> WidthTableRange -> Bool)
-> Eq WidthTableRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WidthTableRange -> WidthTableRange -> Bool
$c/= :: WidthTableRange -> WidthTableRange -> Bool
== :: WidthTableRange -> WidthTableRange -> Bool
$c== :: WidthTableRange -> WidthTableRange -> Bool
Eq, Int -> WidthTableRange -> ShowS
[WidthTableRange] -> ShowS
WidthTableRange -> String
(Int -> WidthTableRange -> ShowS)
-> (WidthTableRange -> String)
-> ([WidthTableRange] -> ShowS)
-> Show WidthTableRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WidthTableRange] -> ShowS
$cshowList :: [WidthTableRange] -> ShowS
show :: WidthTableRange -> String
$cshow :: WidthTableRange -> String
showsPrec :: Int -> WidthTableRange -> ShowS
$cshowsPrec :: Int -> WidthTableRange -> ShowS
Show)

-- | A run-length-encoded table of Unicode character widths.
data UnicodeWidthTable =
    UnicodeWidthTable { UnicodeWidthTable -> [WidthTableRange]
unicodeWidthTableRanges :: [WidthTableRange]
                      -- ^ The ranges in the table.
                      }
    deriving (Int -> UnicodeWidthTable -> ShowS
[UnicodeWidthTable] -> ShowS
UnicodeWidthTable -> String
(Int -> UnicodeWidthTable -> ShowS)
-> (UnicodeWidthTable -> String)
-> ([UnicodeWidthTable] -> ShowS)
-> Show UnicodeWidthTable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnicodeWidthTable] -> ShowS
$cshowList :: [UnicodeWidthTable] -> ShowS
show :: UnicodeWidthTable -> String
$cshow :: UnicodeWidthTable -> String
showsPrec :: Int -> UnicodeWidthTable -> ShowS
$cshowsPrec :: Int -> UnicodeWidthTable -> ShowS
Show)