{-# LANGUAGE BangPatterns, DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} module Text.DescriptorProtos.FieldDescriptorProto (FieldDescriptorProto(..)) where import Prelude ((+), (/)) import qualified Prelude as Prelude' import qualified Data.Typeable as Prelude' import qualified Data.Data as Prelude' import qualified Text.ProtocolBuffers.Header as P' import qualified Text.DescriptorProtos.FieldDescriptorProto.Label as DescriptorProtos.FieldDescriptorProto (Label) import qualified Text.DescriptorProtos.FieldDescriptorProto.Type as DescriptorProtos.FieldDescriptorProto (Type) import qualified Text.DescriptorProtos.FieldOptions as DescriptorProtos (FieldOptions) data FieldDescriptorProto = FieldDescriptorProto{name :: !(P'.Maybe P'.Utf8), number :: !(P'.Maybe P'.Int32), label :: !(P'.Maybe DescriptorProtos.FieldDescriptorProto.Label), type' :: !(P'.Maybe DescriptorProtos.FieldDescriptorProto.Type), type_name :: !(P'.Maybe P'.Utf8), extendee :: !(P'.Maybe P'.Utf8), default_value :: !(P'.Maybe P'.Utf8), oneof_index :: !(P'.Maybe P'.Int32), json_name :: !(P'.Maybe P'.Utf8), options :: !(P'.Maybe DescriptorProtos.FieldOptions), unknown'field :: !(P'.UnknownField)} deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data) instance P'.UnknownMessage FieldDescriptorProto where getUnknownField = unknown'field putUnknownField u'f msg = msg{unknown'field = u'f} instance P'.Mergeable FieldDescriptorProto where mergeAppend (FieldDescriptorProto x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11) (FieldDescriptorProto y'1 y'2 y'3 y'4 y'5 y'6 y'7 y'8 y'9 y'10 y'11) = FieldDescriptorProto (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4) (P'.mergeAppend x'5 y'5) (P'.mergeAppend x'6 y'6) (P'.mergeAppend x'7 y'7) (P'.mergeAppend x'8 y'8) (P'.mergeAppend x'9 y'9) (P'.mergeAppend x'10 y'10) (P'.mergeAppend x'11 y'11) instance P'.Default FieldDescriptorProto where defaultValue = FieldDescriptorProto P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue instance P'.Wire FieldDescriptorProto where wireSize ft' self'@(FieldDescriptorProto x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11) = case ft' of 10 -> calc'Size 11 -> P'.prependMessageSize calc'Size _ -> P'.wireSizeErr ft' self' where calc'Size = (P'.wireSizeOpt 1 9 x'1 + P'.wireSizeOpt 1 5 x'2 + P'.wireSizeOpt 1 14 x'3 + P'.wireSizeOpt 1 14 x'4 + P'.wireSizeOpt 1 9 x'5 + P'.wireSizeOpt 1 9 x'6 + P'.wireSizeOpt 1 9 x'7 + P'.wireSizeOpt 1 5 x'8 + P'.wireSizeOpt 1 9 x'9 + P'.wireSizeOpt 1 11 x'10 + P'.wireSizeUnknownField x'11) wirePut ft' self'@(FieldDescriptorProto x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11) = case ft' of 10 -> put'Fields 11 -> do P'.putSize (P'.wireSize 10 self') put'Fields _ -> P'.wirePutErr ft' self' where put'Fields = do P'.wirePutOpt 10 9 x'1 P'.wirePutOpt 18 9 x'6 P'.wirePutOpt 24 5 x'2 P'.wirePutOpt 32 14 x'3 P'.wirePutOpt 40 14 x'4 P'.wirePutOpt 50 9 x'5 P'.wirePutOpt 58 9 x'7 P'.wirePutOpt 66 11 x'10 P'.wirePutOpt 72 5 x'8 P'.wirePutOpt 82 9 x'9 P'.wirePutUnknownField x'11 wireGet ft' = case ft' of 10 -> P'.getBareMessageWith (P'.catch'Unknown update'Self) 11 -> P'.getMessageWith (P'.catch'Unknown update'Self) _ -> P'.wireGetErr ft' where update'Self wire'Tag old'Self = case wire'Tag of 10 -> Prelude'.fmap (\ !new'Field -> old'Self{name = Prelude'.Just new'Field}) (P'.wireGet 9) 24 -> Prelude'.fmap (\ !new'Field -> old'Self{number = Prelude'.Just new'Field}) (P'.wireGet 5) 32 -> Prelude'.fmap (\ !new'Field -> old'Self{label = Prelude'.Just new'Field}) (P'.wireGet 14) 40 -> Prelude'.fmap (\ !new'Field -> old'Self{type' = Prelude'.Just new'Field}) (P'.wireGet 14) 50 -> Prelude'.fmap (\ !new'Field -> old'Self{type_name = Prelude'.Just new'Field}) (P'.wireGet 9) 18 -> Prelude'.fmap (\ !new'Field -> old'Self{extendee = Prelude'.Just new'Field}) (P'.wireGet 9) 58 -> Prelude'.fmap (\ !new'Field -> old'Self{default_value = Prelude'.Just new'Field}) (P'.wireGet 9) 72 -> Prelude'.fmap (\ !new'Field -> old'Self{oneof_index = Prelude'.Just new'Field}) (P'.wireGet 5) 82 -> Prelude'.fmap (\ !new'Field -> old'Self{json_name = Prelude'.Just new'Field}) (P'.wireGet 9) 66 -> Prelude'.fmap (\ !new'Field -> old'Self{options = P'.mergeAppend (options old'Self) (Prelude'.Just new'Field)}) (P'.wireGet 11) _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self instance P'.MessageAPI msg' (msg' -> FieldDescriptorProto) FieldDescriptorProto where getVal m' f' = f' m' instance P'.GPB FieldDescriptorProto instance P'.ReflectDescriptor FieldDescriptorProto where getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10, 18, 24, 32, 40, 50, 58, 66, 72, 82]) reflectDescriptorInfo _ = Prelude'.read "DescriptorInfo {descName = ProtoName {protobufName = FIName \".google.protobuf.FieldDescriptorProto\", haskellPrefix = [MName \"Text\"], parentModule = [MName \"DescriptorProtos\"], baseName = MName \"FieldDescriptorProto\"}, descFilePath = [\"Text\",\"DescriptorProtos\",\"FieldDescriptorProto.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".google.protobuf.FieldDescriptorProto.name\", haskellPrefix' = [MName \"Text\"], parentModule' = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName' = FName \"name\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".google.protobuf.FieldDescriptorProto.number\", haskellPrefix' = [MName \"Text\"], parentModule' = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName' = FName \"number\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".google.protobuf.FieldDescriptorProto.label\", haskellPrefix' = [MName \"Text\"], parentModule' = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName' = FName \"label\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".google.protobuf.FieldDescriptorProto.Label\", haskellPrefix = [MName \"Text\"], parentModule = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName = MName \"Label\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".google.protobuf.FieldDescriptorProto.type\", haskellPrefix' = [MName \"Text\"], parentModule' = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName' = FName \"type'\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".google.protobuf.FieldDescriptorProto.Type\", haskellPrefix = [MName \"Text\"], parentModule = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName = MName \"Type\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".google.protobuf.FieldDescriptorProto.type_name\", haskellPrefix' = [MName \"Text\"], parentModule' = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName' = FName \"type_name\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".google.protobuf.FieldDescriptorProto.extendee\", haskellPrefix' = [MName \"Text\"], parentModule' = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName' = FName \"extendee\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".google.protobuf.FieldDescriptorProto.default_value\", haskellPrefix' = [MName \"Text\"], parentModule' = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName' = FName \"default_value\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".google.protobuf.FieldDescriptorProto.oneof_index\", haskellPrefix' = [MName \"Text\"], parentModule' = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName' = FName \"oneof_index\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 9}, wireTag = WireTag {getWireTag = 72}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".google.protobuf.FieldDescriptorProto.json_name\", haskellPrefix' = [MName \"Text\"], parentModule' = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName' = FName \"json_name\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 10}, wireTag = WireTag {getWireTag = 82}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".google.protobuf.FieldDescriptorProto.options\", haskellPrefix' = [MName \"Text\"], parentModule' = [MName \"DescriptorProtos\",MName \"FieldDescriptorProto\"], baseName' = FName \"options\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 66}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".google.protobuf.FieldOptions\", haskellPrefix = [MName \"Text\"], parentModule = [MName \"DescriptorProtos\"], baseName = MName \"FieldOptions\"}), hsRawDefault = Nothing, hsDefault = Nothing}], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = True, lazyFields = False, makeLenses = False}" instance P'.TextType FieldDescriptorProto where tellT = P'.tellSubMessage getT = P'.getSubMessage instance P'.TextMsg FieldDescriptorProto where textPut msg = do P'.tellT "name" (name msg) P'.tellT "number" (number msg) P'.tellT "label" (label msg) P'.tellT "type" (type' msg) P'.tellT "type_name" (type_name msg) P'.tellT "extendee" (extendee msg) P'.tellT "default_value" (default_value msg) P'.tellT "oneof_index" (oneof_index msg) P'.tellT "json_name" (json_name msg) P'.tellT "options" (options msg) textGet = do mods <- P'.sepEndBy (P'.choice [parse'name, parse'number, parse'label, parse'type', parse'type_name, parse'extendee, parse'default_value, parse'oneof_index, parse'json_name, parse'options]) P'.spaces Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods) where parse'name = P'.try (do v <- P'.getT "name" Prelude'.return (\ o -> o{name = v})) parse'number = P'.try (do v <- P'.getT "number" Prelude'.return (\ o -> o{number = v})) parse'label = P'.try (do v <- P'.getT "label" Prelude'.return (\ o -> o{label = v})) parse'type' = P'.try (do v <- P'.getT "type" Prelude'.return (\ o -> o{type' = v})) parse'type_name = P'.try (do v <- P'.getT "type_name" Prelude'.return (\ o -> o{type_name = v})) parse'extendee = P'.try (do v <- P'.getT "extendee" Prelude'.return (\ o -> o{extendee = v})) parse'default_value = P'.try (do v <- P'.getT "default_value" Prelude'.return (\ o -> o{default_value = v})) parse'oneof_index = P'.try (do v <- P'.getT "oneof_index" Prelude'.return (\ o -> o{oneof_index = v})) parse'json_name = P'.try (do v <- P'.getT "json_name" Prelude'.return (\ o -> o{json_name = v})) parse'options = P'.try (do v <- P'.getT "options" Prelude'.return (\ o -> o{options = v}))