protocol-buffers 1.6.0 → 1.7.9
raw patch · 4 files changed
+16/−6 lines, 4 files
Files
- Text/ProtocolBuffers/Basic.hs +8/−3
- Text/ProtocolBuffers/Header.hs +1/−0
- Text/ProtocolBuffers/Reflections.hs +5/−1
- protocol-buffers.cabal +2/−2
Text/ProtocolBuffers/Basic.hs view
@@ -9,7 +9,7 @@ , WireTag(..),FieldId(..),WireType(..),FieldType(..),EnumCode(..),WireSize -- * Some of the type classes implemented messages and fields , Mergeable(..),Default(..),Wire(..)- , isValidUTF8, toUtf8, utf8+ , isValidUTF8, toUtf8, utf8, uToString, uFromString ) where import Control.Monad.Error.Class(throwError)@@ -210,7 +210,7 @@ -- Returns Nothing if valid, and the position of the error if invalid isValidUTF8 :: ByteString -> Maybe Int-isValidUTF8 ws = go 0 (L.unpack ws) 0 where+isValidUTF8 bs = go 0 (L.unpack bs) 0 where go :: Int -> [Word8] -> Int -> Maybe Int go 0 [] _ = Nothing go 0 (x:xs) n | x <= 127 = go 0 xs $! succ n -- binary 01111111@@ -228,5 +228,10 @@ high [] n = Just n toUtf8 :: ByteString -> Either Int Utf8-toUtf8 b = maybe (Right (Utf8 b)) Left (isValidUTF8 b)+toUtf8 bs = maybe (Right (Utf8 bs)) Left (isValidUTF8 bs) +uToString :: Utf8 -> String+uToString (Utf8 bs) = U.toString bs++uFromString :: String -> Utf8+uFromString s = Utf8 (U.fromString s)
Text/ProtocolBuffers/Header.hs view
@@ -43,6 +43,7 @@ ( prependMessageSize,putSize,splitWireTag , wireSizeReq,wireSizeOpt,wireSizeRep , wirePutReq,wirePutOpt,wirePutRep+ , wirePutPacked,wireSizePacked , getMessageWith,getBareMessageWith,wireGetEnum,wireGetPackedEnum , wireSizeErr,wirePutErr,wireGetErr , unknown,unknownField
Text/ProtocolBuffers/Reflections.hs view
@@ -114,6 +114,10 @@ -- -- Note that Utf8 labeled byte sequences have been stripped to just -- 'ByteString' here as this is sufficient for code generation.+--+-- On 25 August 2010 20:12, George van den Driessche <georgevdd@google.com> sent Chris Kuklewicz a+-- patch to MakeReflections.parseDefEnum to ensure that HsDef'Enum holds the mangled form of the+-- name. data HsDefault = HsDef'Bool Bool | HsDef'ByteString ByteString | HsDef'RealFloat SomeRealFloat@@ -139,7 +143,7 @@ data EnumInfo = EnumInfo { enumName :: ProtoName , enumFilePath :: [FilePath]- , enumValues :: [(EnumCode,String)]+ , enumValues :: [(EnumCode,String)] -- ^ The String is the Haskell name to write into the generated source files } deriving (Show,Read,Eq,Ord,Data,Typeable)
protocol-buffers.cabal view
@@ -1,5 +1,5 @@ name: protocol-buffers-version: 1.6.0+version: 1.7.9 cabal-version: >= 1.6 build-type: Simple license: BSD3@@ -9,7 +9,7 @@ maintainer: Chris Kuklewicz <protobuf@personal.mightyreason.com> stability: Beta homepage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/protocol-buffers-package-url: http://darcs.haskell.org/packages/protocol-buffers2/+package-url: http://code.haskell.org/protocol-buffers/ synopsis: Parse Google Protocol Buffer specifications description: Parse proto files and generate Haskell code. category: Text