File: rt_json.adb

package info (click to toggle)
polyorb 2.11~20140418-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 30,012 kB
  • ctags: 465
  • sloc: ada: 273,015; sh: 4,507; makefile: 4,265; python: 1,332; cpp: 1,213; java: 507; ansic: 274; xml: 30; perl: 23; exp: 6
file content (30 lines) | stat: -rw-r--r-- 864 bytes parent folder | download | duplicates (2)
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
with Normal_JSON;
with GNATCOLL.JSON;

package body RT_JSON is

   procedure Read (S : access Root_Stream_Type'Class; V : out JSON_Wrapper) is
      Str : constant String := String'Input (S);
      pragma Unmodified (V);
   begin
      Normal_JSON.JSON_Holder (V.H.all).Value := GNATCOLL.JSON.Read (Str, "");
   end Read;

   procedure Write (S : access Root_Stream_Type'Class; V : JSON_Wrapper) is
   begin
      String'Output (S, GNATCOLL.JSON.Write (Normal_JSON.Unwrap (V)));
   end Write;

   function Input (S : access Root_stream_Type'Class) return JSON_Wrapper is
   begin
      return V : JSON_Wrapper (H => new Normal_JSON.JSON_Holder) do
         JSON_Wrapper'Read (S, V);
      end return;
   end Input;

   procedure Output (S : access Root_Stream_Type'Class; V : JSON_Wrapper) is
   begin
      JSON_Wrapper'Write (S, V);
   end Output;

end RT_JSON;