package piqi
Protocol Buffers, JSON and XML serialization system for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
v0.7.8.tar.gz
sha256=22ee106ad3024b651d080c6c906dac1ad9cd22ece9972742081d09711c764a19
md5=e9bd34d56f33c3fe6cfa133341f96bdf
doc/src/piqirun.ext/piqirun_ext.ml.html
Source file piqirun_ext.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
(* Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015 Anton Lavrik Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (* Runtime support for JSON-XML-Protobuf-Piq serialization * * This module is used by OCaml modules generated by * "piqic-ocaml --multi-format" Piqi compiler *) type input_format = [ `piq | `json | `xml | `pb | `pib ] type output_format = [ input_format | `json_pretty | `xml_pretty ] type piqi_type = Piqi_common.T.piqtype type options = Piqi_convert.options let _ = Piqi_convert.init () let add_piqi (piqi_bin: string) = let buf = Piqi_piqirun.init_from_string piqi_bin in let piqi = Piqi.piqi_of_pb buf in Piqi_db.add_piqi piqi; () let seen = ref [] let init_piqi piqi = if not (List.memq piqi !seen) then ( seen:= piqi :: !seen; add_piqi piqi ) let find_piqi_type (typename :string) :piqi_type = Piqi_convert.find_type typename (* preallocate default convert options *) let default_options = Piqi_convert.make_options () let default_options_no_pp = { default_options with Piqi_convert.pretty_print = false } let make_options = Piqi_convert.make_options let convert ?opts (piqi_type :piqi_type) (input_format :input_format) (output_format :output_format) (data :string) :string = if output_format = (input_format :> output_format) then data else ( let output_format, default_opts = match output_format with | `json_pretty -> `json, default_options | `xml_pretty -> `xml, default_options | (#input_format as x) -> x, default_options_no_pp in let opts = match opts with | None -> default_opts | Some x -> x in Piqi_convert.convert piqi_type input_format output_format data ~opts )
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>