module Geo.OSM.NWRCommon(
NWRCommon,
nwrCommon
) where
import Text.XML.HXT.Arrow
import Text.XML.HXT.Extras
import Control.Applicative
import Data.Char
import Geo.OSM.Tag
import Geo.OSM.Accessor.Id
import Geo.OSM.Accessor.Tags
import Geo.OSM.Accessor.Changeset
import Geo.OSM.Accessor.Visible
import Geo.OSM.Accessor.User
import Geo.OSM.Accessor.Uid
import Geo.OSM.Accessor.Timestamp
data NWRCommon = NWRCommon String [Tag] (Maybe String) Bool (Maybe String, Maybe String) (Maybe String)
deriving Eq
instance XmlPickler NWRCommon where
xpickle = xpWrap (\(a, b, c, d, e, f) -> NWRCommon a b c d e f, \(NWRCommon a b c d e f) -> (a, b, c, d, e, f))
(xp6Tuple (xpAttr "id" xpText)
(xpList xpickle)
(xpOption (xpAttr "changeset" xpText))
(xpDefault True (xpWrapMaybe (\s -> case toLower <$> s of "true" -> Just True
"false" -> Just False
_ -> Nothing, (toLower <$>) . show) (xpAttr "visible" xpText)))
(xpPair (xpOption (xpAttr "user" xpText)) (xpOption (xpAttr "uid" xpText)))
(xpOption (xpAttr "timestamp" xpText)))
instance Show NWRCommon where
show = showPickled []
instance Id NWRCommon where
id (NWRCommon x _ _ _ _ _) = x
instance Tags NWRCommon where
tags (NWRCommon _ x _ _ _ _) = x
instance Changeset NWRCommon where
changeset (NWRCommon _ _ x _ _ _) = x
instance Visible NWRCommon where
visible (NWRCommon _ _ _ x _ _) = x
instance User NWRCommon where
user (NWRCommon _ _ _ _ (x, _) _) = x
instance Uid NWRCommon where
uid (NWRCommon _ _ _ _ (_, x) _) = x
instance Timestamp NWRCommon where
timestamp (NWRCommon _ _ _ _ _ x) = x
nwrCommon :: String
-> [Tag]
-> Maybe String
-> Bool
-> (Maybe String, Maybe String)
-> Maybe String
-> NWRCommon
nwrCommon = NWRCommon