vcard 0.1 → 0.1.1
raw patch · 4 files changed
+58/−34 lines, 4 files
Files
- Text/VCard.hs +7/−17
- Text/VCard/Format/Directory.hs +6/−16
- Text/VCard/Selectors.hs +43/−0
- vcard.cabal +2/−1
Text/VCard.hs view
@@ -1,21 +1,11 @@--- Copyright (C) 2008 Mathieu Boespflug <mboes@tweag.net>------ This program is free software; you can redistribute it and/or--- modify it under the terms of the GNU Lesser General Public License--- as published by the Free Software Foundation; either version 2--- of the License, or (at your option) any later version.------ This program is distributed in the hope that it will be useful,--- but WITHOUT ANY WARRANTY; without even the implied warranty of--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the--- GNU General Public License for more details.+-- |+-- Copyright : (c) 2008 Mathieu Boespflug+-- License : LGPL+-- Maintainer : mboes@tweag.net+-- Stability : experimental+-- Portability : non-portable ----- You should have received a copy of the GNU General Public License--- along with this program; if not, write to the Free Software--- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA--- 02110-1301, USA.---- | This module reexports most of the modules in the vCard library in+-- This module reexports most of the modules in the vCard library in -- additionto the mime-directory library, with the exception of -- |Text.VCard.Query|, since that library should be imported qualified, as -- many of the names clash with standard |Prelude| names.
Text/VCard/Format/Directory.hs view
@@ -1,19 +1,9 @@--- Copyright (C) 2008 Mathieu Boespflug <mboes@tweag.net>------ This program is free software; you can redistribute it and/or--- modify it under the terms of the GNU Lesser General Public License--- as published by the Free Software Foundation; either version 2--- of the License, or (at your option) any later version.------ This program is distributed in the hope that it will be useful,--- but WITHOUT ANY WARRANTY; without even the implied warranty of--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the--- GNU General Public License for more details.------ You should have received a copy of the GNU General Public License--- along with this program; if not, write to the Free Software--- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA--- 02110-1301, USA.+-- |+-- Copyright : (c) 2008 Mathieu Boespflug+-- License : LGPL+-- Maintainer : mboes@tweag.net+-- Stability : experimental+-- Portability : non-portable module Text.VCard.Format.Directory ( module Text.VCard, readVCards, fromProperties, writeVCard ) where
+ Text/VCard/Selectors.hs view
@@ -0,0 +1,43 @@+-- |+-- Copyright : (c) 2008 Mathieu Boespflug+-- License : LGPL+-- Maintainer : mboes@tweag.net+-- Stability : experimental+-- Portability : non-portable+--+-- Field selectors for struct values, such as in N or ADR properties.+module Text.VCard.Selectors where++import qualified Text.VCard.Types as V+import qualified Codec.MIME.ContentType.Text.Directory as D+import qualified Data.ByteString.Lazy.Char8.Caseless as I+++seqi name prop n | D.IANAValue (V.Struct seq) <- D.prop_value prop,+ length seq > n =+ if D.prop_type prop == D.nakedType name+ then seq !! n else+ error $ "Expecting " ++ I.unpack name ++ " property."+ | otherwise = error "Wrong value."++n_familyName prop = seqi "N" prop 0+n_givenName prop = seqi "N" prop 1+n_additionalNames prop = seqi "N" prop 2+n_honorificPrefixes prop = seqi "N" prop 3+n_honorificSuffixes prop = seqi "N" prop 4++adr_pobox prop = seqi "ADR" prop 0+adr_extendedAdress prop = seqi "ADR" prop 1+adr_streetAdress prop = seqi "ADR" prop 2+adr_locality prop = seqi "ADR" prop 3+adr_region prop = seqi "ADR" prop 4+adr_postalCode prop = seqi "ADR" prop 5+adr_country prop = seqi "ADR" prop 6++geo_latitude prop = seqi "GEO" prop 0+geo_longitude prop = seqi "GEO" prop 1++org_organizationName prop = seqi "ORG" prop 0+org_organizationUnits prop+ | D.IANAValue (V.Struct (_:seq)) <- D.prop_value prop = seq+ | otherwise = error "Wrong value."
vcard.cabal view
@@ -1,5 +1,5 @@ name: vcard-version: 0.1+version: 0.1.1 author: Mathieu Boespflug maintainer: Mathieu Boespflug <mboes@tweag.net> homepage: http://code.haskell.org/~mboes/vcard.git@@ -21,3 +21,4 @@ mime-directory >= 0.1 exposed-modules: Text.VCard Text.VCard.Format.Directory+ Text.VCard.Selectors