Comment: | s_expressions-templates-dates: new package for date template rendering |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f65011d51aa546345089bd0418999346 |
User & Date: | nat on 2014-10-03 21:04:48 |
Other Links: | manifest | tags |
2014-10-04
| ||
20:34 | s_expressions-templates-tests-dates: test suite for date S-exrepssion templates check-in: 51d9aa70ca user: nat tags: trunk | |
2014-10-03
| ||
21:04 | s_expressions-templates-dates: new package for date template rendering check-in: f65011d51a user: nat tags: trunk | |
2014-10-02
| ||
21:26 | s_expressions-templates-tests-integers: add tests for image ranges check-in: dc623ed4d6 user: nat tags: trunk | |
Added generated/natools-static_maps-s_expressions-templates-dates-cmds.adb version [5d1f83d258].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | with Interfaces; use Interfaces; package body Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds is P : constant array (0 .. 5) of Natural := (1, 2, 5, 11, 12, 15); T1 : constant array (0 .. 5) of Unsigned_8 := (5, 22, 23, 31, 6, 10); T2 : constant array (0 .. 5) of Unsigned_8 := (42, 40, 11, 44, 54, 41); G : constant array (0 .. 57) of Unsigned_8 := (0, 0, 0, 0, 9, 0, 22, 3, 0, 0, 1, 11, 4, 0, 0, 0, 17, 0, 5, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 2, 0, 15, 0, 0, 5, 18, 0, 0, 0, 0, 6, 10, 10, 20, 23, 0, 3, 3, 27, 16, 0, 20, 21, 9, 0, 22); function Hash (S : String) return Natural is F : constant Natural := S'First - 1; L : constant Natural := S'Length; F1, F2 : Natural := 0; J : Natural; begin for K in P'Range loop exit when L < P (K); J := Character'Pos (S (P (K) + F)); F1 := (F1 + Natural (T1 (K)) * J) mod 58; F2 := (F2 + Natural (T2 (K)) * J) mod 58; end loop; return (Natural (G (F1)) + Natural (G (F2))) mod 28; end Hash; end Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds; |
Added generated/natools-static_maps-s_expressions-templates-dates-cmds.ads version [c928fa7a2b].
> > > > | 1 2 3 4 | package Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds is pragma Pure; function Hash (S : String) return Natural; end Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds; |
Added generated/natools-static_maps-s_expressions-templates-dates-t.adb version [5d9278d223].
> > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | -- Generated at 2014-10-03 21:03:09 +0000 by Natools.Static_Hash_Maps -- from src/natools-s_expressions-templates-dates-maps.sx with Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds; function Natools.Static_Maps.S_Expressions.Templates.Dates.T return Boolean is begin for I in Map_1_Keys'Range loop if Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds.Hash (Map_1_Keys (I).all) /= I then return False; end if; end loop; return True; end Natools.Static_Maps.S_Expressions.Templates.Dates.T; |
Added generated/natools-static_maps-s_expressions-templates-dates-t.ads version [5c1cef6658].
> > > > > > | 1 2 3 4 5 6 | -- Generated at 2014-10-03 21:03:09 +0000 by Natools.Static_Hash_Maps -- from src/natools-s_expressions-templates-dates-maps.sx function Natools.Static_Maps.S_Expressions.Templates.Dates.T return Boolean; pragma Pure (Natools.Static_Maps.S_Expressions.Templates.Dates.T); |
Added generated/natools-static_maps-s_expressions-templates-dates.adb version [3f158be03d].
> > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | -- Generated at 2014-10-03 21:03:09 +0000 by Natools.Static_Hash_Maps -- from src/natools-s_expressions-templates-dates-maps.sx with Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds; package body Natools.Static_Maps.S_Expressions.Templates.Dates is function Main (Key : String) return Main_Command is N : constant Natural := Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds.Hash (Key); begin if Map_1_Keys (N).all = Key then return Map_1_Elements (N); else return Error; end if; end Main; end Natools.Static_Maps.S_Expressions.Templates.Dates; |
Added generated/natools-static_maps-s_expressions-templates-dates.ads version [2e200e79ce].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | -- Generated at 2014-10-03 21:03:09 +0000 by Natools.Static_Hash_Maps -- from src/natools-s_expressions-templates-dates-maps.sx package Natools.Static_Maps.S_Expressions.Templates.Dates is pragma Pure; type Main_Command is (Error, Year, Month, Day, Hour, Minute, Second, Padded_Month, Padded_Day, Padded_Hour, Padded_Minute, Padded_Second, Day_Of_Week, Big_Endian_Date, Little_Endian_Date, Big_Endian_Time, Little_Endian_Time, RFC_3339); function Main (Key : String) return Main_Command; private Map_1_Key_0 : aliased constant String := "YYYYMMDD"; Map_1_Key_1 : aliased constant String := "big-endian-date"; Map_1_Key_2 : aliased constant String := "HHMMSS"; Map_1_Key_3 : aliased constant String := "time"; Map_1_Key_4 : aliased constant String := "big-endian-time"; Map_1_Key_5 : aliased constant String := "day"; Map_1_Key_6 : aliased constant String := "dow"; Map_1_Key_7 : aliased constant String := "day-of-week"; Map_1_Key_8 : aliased constant String := "hour"; Map_1_Key_9 : aliased constant String := "DDMMYYYY"; Map_1_Key_10 : aliased constant String := "little-endian-date"; Map_1_Key_11 : aliased constant String := "SSMMHH"; Map_1_Key_12 : aliased constant String := "little-endian-time"; Map_1_Key_13 : aliased constant String := "minute"; Map_1_Key_14 : aliased constant String := "month"; Map_1_Key_15 : aliased constant String := "0day"; Map_1_Key_16 : aliased constant String := "padded-day"; Map_1_Key_17 : aliased constant String := "0hour"; Map_1_Key_18 : aliased constant String := "padded-hour"; Map_1_Key_19 : aliased constant String := "0minute"; Map_1_Key_20 : aliased constant String := "padded-minute"; Map_1_Key_21 : aliased constant String := "0month"; Map_1_Key_22 : aliased constant String := "padded-month"; Map_1_Key_23 : aliased constant String := "0second"; Map_1_Key_24 : aliased constant String := "padded-second"; Map_1_Key_25 : aliased constant String := "rfc-3339"; Map_1_Key_26 : aliased constant String := "second"; Map_1_Key_27 : aliased constant String := "year"; Map_1_Keys : constant array (0 .. 27) of access constant String := (Map_1_Key_0'Access, Map_1_Key_1'Access, Map_1_Key_2'Access, Map_1_Key_3'Access, Map_1_Key_4'Access, Map_1_Key_5'Access, Map_1_Key_6'Access, Map_1_Key_7'Access, Map_1_Key_8'Access, Map_1_Key_9'Access, Map_1_Key_10'Access, Map_1_Key_11'Access, Map_1_Key_12'Access, Map_1_Key_13'Access, Map_1_Key_14'Access, Map_1_Key_15'Access, Map_1_Key_16'Access, Map_1_Key_17'Access, Map_1_Key_18'Access, Map_1_Key_19'Access, Map_1_Key_20'Access, Map_1_Key_21'Access, Map_1_Key_22'Access, Map_1_Key_23'Access, Map_1_Key_24'Access, Map_1_Key_25'Access, Map_1_Key_26'Access, Map_1_Key_27'Access); Map_1_Elements : constant array (0 .. 27) of Main_Command := (Big_Endian_Date, Big_Endian_Date, Big_Endian_Time, Big_Endian_Time, Big_Endian_Time, Day, Day_Of_Week, Day_Of_Week, Hour, Little_Endian_Date, Little_Endian_Date, Little_Endian_Time, Little_Endian_Time, Minute, Month, Padded_Day, Padded_Day, Padded_Hour, Padded_Hour, Padded_Minute, Padded_Minute, Padded_Month, Padded_Month, Padded_Second, Padded_Second, RFC_3339, Second, Year); end Natools.Static_Maps.S_Expressions.Templates.Dates; |
Added src/natools-s_expressions-templates-dates-maps.sx version [7ffcc36068].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | (Natools.Static_Maps.S_Expressions.Templates.Dates pure (test-function T) (extra-decl "\ type Main_Command is (Error, Year, Month, Day, Hour, Minute, Second, Padded_Month, Padded_Day, Padded_Hour, Padded_Minute, Padded_Second, Day_Of_Week, Big_Endian_Date, Little_Endian_Date, Big_Endian_Time, Little_Endian_Time, RFC_3339);") (Main_Command (hash-package Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds) (function Main) (not-found Error) (nodes (Big_Endian_Date YYYYMMDD big-endian-date) (Big_Endian_Time HHMMSS time big-endian-time) (Day day) (Day_Of_Week dow day-of-week) (Hour hour) (Little_Endian_Date DDMMYYYY little-endian-date) (Little_Endian_Time SSMMHH little-endian-time) (Minute minute) (Month month) (Padded_Day 0day padded-day) (Padded_Hour 0hour padded-hour) (Padded_Minute 0minute padded-minute) (Padded_Month 0month padded-month) (Padded_Second 0second padded-second) (RFC_3339 rfc-3339) (Second second) (Year year)))) |
Added src/natools-s_expressions-templates-dates.adb version [ef7fabb3a6].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | ------------------------------------------------------------------------------ -- Copyright (c) 2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Interpreter_Loop; with Natools.S_Expressions.Templates.Generic_Discrete_Render; with Natools.S_Expressions.Templates.Integers; with Natools.Static_Maps.S_Expressions.Templates.Dates; with Natools.Time_IO.RFC_3339; package body Natools.S_Expressions.Templates.Dates is package Commands renames Natools.Static_Maps.S_Expressions.Templates.Dates; procedure Render_Day_Of_Week is new Natools.S_Expressions.Templates.Generic_Discrete_Render (Ada.Calendar.Formatting.Day_Name, Ada.Calendar.Formatting.Day_Name'Image, Ada.Calendar.Formatting."="); procedure Append (Output : in out Ada.Streams.Root_Stream_Type'Class; Value : in Split_Time; Data : in Atom); procedure Execute (Output : in out Ada.Streams.Root_Stream_Type'Class; Value : in Split_Time; Name : in Atom; Arguments : in out Lockable.Descriptor'Class); function Two_Digit_Image (Value : Integer) return Atom is ((1 => Character'Pos ('0') + Octet (Value / 10), 2 => Character'Pos ('0') + Octet (Value mod 10))) with Pre => Value in 0 .. 99; function Four_Digit_Image (Value : Integer) return Atom is ((1 => Character'Pos ('0') + Octet (Value / 1000), 2 => Character'Pos ('0') + Octet ((Value / 100) mod 10), 3 => Character'Pos ('0') + Octet ((Value / 10) mod 10), 4 => Character'Pos ('0') + Octet (Value mod 10))) with Pre => Value in 0 .. 9999; procedure Render_Triplet (Output : in out Ada.Streams.Root_Stream_Type'Class; Part_1, Part_2, Part_3 : in Atom; Template : in out Lockable.Descriptor'Class); ------------------------------ -- Local Helper Subprograms -- ------------------------------ procedure Render_Triplet (Output : in out Ada.Streams.Root_Stream_Type'Class; Part_1, Part_2, Part_3 : in Atom; Template : in out Lockable.Descriptor'Class) is begin Output.Write (Part_1); if Template.Current_Event = Events.Add_Atom then declare Separator : constant Atom := Template.Current_Atom; Event : Events.Event; begin Template.Next (Event); Output.Write (Separator); Output.Write (Part_2); if Event = Events.Add_Atom then Output.Write (Template.Current_Atom); else Output.Write (Separator); end if; end; else Output.Write (Part_2); end if; Output.Write (Part_3); end Render_Triplet; ---------------------------- -- Interpreter Components -- ---------------------------- procedure Append (Output : in out Ada.Streams.Root_Stream_Type'Class; Value : in Split_Time; Data : in Atom) is pragma Unreferenced (Value); begin Output.Write (Data); end Append; procedure Execute (Output : in out Ada.Streams.Root_Stream_Type'Class; Value : in Split_Time; Name : in Atom; Arguments : in out Lockable.Descriptor'Class) is Format : Integers.Format; begin case Commands.Main (To_String (Name)) is when Commands.Error => null; when Commands.Big_Endian_Date => Render_Triplet (Output, Four_Digit_Image (Value.Year), Two_Digit_Image (Value.Month), Two_Digit_Image (Value.Day), Arguments); when Commands.Big_Endian_Time => Render_Triplet (Output, Two_Digit_Image (Value.Hour), Two_Digit_Image (Value.Minute), Two_Digit_Image (Value.Second), Arguments); when Commands.Day => Format.Set_Image (0, Null_Atom); Integers.Render (Output, Format, Arguments, Value.Day); when Commands.Day_Of_Week => Render_Day_Of_Week (Output, Arguments, Value.Day_Of_Week); when Commands.Hour => Format.Set_Image (-1, Null_Atom); Integers.Render (Output, Format, Arguments, Value.Hour); when Commands.Little_Endian_Date => Render_Triplet (Output, Two_Digit_Image (Value.Day), Two_Digit_Image (Value.Month), Four_Digit_Image (Value.Year), Arguments); when Commands.Little_Endian_Time => Render_Triplet (Output, Two_Digit_Image (Value.Second), Two_Digit_Image (Value.Minute), Two_Digit_Image (Value.Hour), Arguments); when Commands.Minute => Format.Set_Image (-1, Null_Atom); Integers.Render (Output, Format, Arguments, Value.Minute); when Commands.Month => Format.Set_Image (0, Null_Atom); Integers.Render (Output, Format, Arguments, Value.Month); when Commands.Padded_Day => Format.Set_Image (0, Null_Atom); Format.Set_Minimum_Width (2); Format.Set_Left_Padding ((1 => Character'Pos ('0'))); Format.Set_Align (Integers.Right_Aligned); Integers.Render (Output, Format, Arguments, Value.Day); when Commands.Padded_Hour => Format.Set_Image (-1, Null_Atom); Format.Set_Minimum_Width (2); Format.Set_Left_Padding ((1 => Character'Pos ('0'))); Format.Set_Align (Integers.Right_Aligned); Integers.Render (Output, Format, Arguments, Value.Hour); when Commands.Padded_Minute => Format.Set_Image (-1, Null_Atom); Format.Set_Minimum_Width (2); Format.Set_Left_Padding ((1 => Character'Pos ('0'))); Format.Set_Align (Integers.Right_Aligned); Integers.Render (Output, Format, Arguments, Value.Minute); when Commands.Padded_Month => Format.Set_Image (0, Null_Atom); Format.Set_Minimum_Width (2); Format.Set_Left_Padding ((1 => Character'Pos ('0'))); Format.Set_Align (Integers.Right_Aligned); Integers.Render (Output, Format, Arguments, Value.Month); when Commands.Padded_Second => Format.Set_Image (-1, Null_Atom); Format.Set_Minimum_Width (2); Format.Set_Left_Padding ((1 => Character'Pos ('0'))); Format.Set_Align (Integers.Right_Aligned); Integers.Render (Output, Format, Arguments, Value.Second); when Commands.RFC_3339 => Output.Write (To_Atom (Time_IO.RFC_3339.Image (Value.Source, Value.Time_Zone))); when Commands.Second => Format.Set_Image (-1, Null_Atom); Integers.Render (Output, Format, Arguments, Value.Second); when Commands.Year => Integers.Render (Output, Arguments, Value.Year); end case; end Execute; procedure Interpreter is new Interpreter_Loop (Ada.Streams.Root_Stream_Type'Class, Split_Time, Execute, Append); ---------------------- -- Public Interface -- ---------------------- function Split (Value : Ada.Calendar.Time; Time_Zone : Ada.Calendar.Time_Zones.Time_Offset) return Split_Time is Year : Ada.Calendar.Year_Number; Month : Ada.Calendar.Month_Number; Day : Ada.Calendar.Day_Number; Hour : Ada.Calendar.Formatting.Hour_Number; Minute : Ada.Calendar.Formatting.Minute_Number; Second : Ada.Calendar.Formatting.Second_Number; Sub_Second : Ada.Calendar.Formatting.Second_Duration; begin Ada.Calendar.Formatting.Split (Value, Year, Month, Day, Hour, Minute, Second, Sub_Second, Time_Zone); return Split_Time' (Source => Value, Time_Zone => Time_Zone, Year => Year, Month => Month, Day => Day, Day_Of_Week => Ada.Calendar.Formatting.Day_Of_Week (Value), Hour => Hour, Minute => Minute, Second => Second, Sub_Second => Sub_Second); end Split; procedure Render (Output : in out Ada.Streams.Root_Stream_Type'Class; Template : in out Lockable.Descriptor'Class; Value : in Ada.Calendar.Time) is begin Render (Output, Template, Value, Ada.Calendar.Time_Zones.UTC_Time_Offset (Value)); end Render; procedure Render (Output : in out Ada.Streams.Root_Stream_Type'Class; Template : in out Lockable.Descriptor'Class; Value : in Ada.Calendar.Time; Time_Zone : Ada.Calendar.Time_Zones.Time_Offset) is begin Render (Output, Template, Split (Value, Time_Zone)); end Render; procedure Render (Output : in out Ada.Streams.Root_Stream_Type'Class; Template : in out Lockable.Descriptor'Class; Value : in Split_Time) is begin Interpreter (Template, Output, Value); end Render; end Natools.S_Expressions.Templates.Dates; |
Added src/natools-s_expressions-templates-dates.ads version [1ceea9c7dd].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | ------------------------------------------------------------------------------ -- Copyright (c) 2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.S_Expressions.Templates.Dates provides a template interpreter -- -- for dates and times. -- ------------------------------------------------------------------------------ with Ada.Calendar.Formatting; with Ada.Calendar.Time_Zones; with Ada.Streams; with Natools.S_Expressions.Lockable; package Natools.S_Expressions.Templates.Dates is type Split_Time is record Source : Ada.Calendar.Time; Time_Zone : Ada.Calendar.Time_Zones.Time_Offset; Year : Ada.Calendar.Year_Number; Month : Ada.Calendar.Month_Number; Day : Ada.Calendar.Day_Number; Day_Of_Week : Ada.Calendar.Formatting.Day_Name; Hour : Ada.Calendar.Formatting.Hour_Number; Minute : Ada.Calendar.Formatting.Minute_Number; Second : Ada.Calendar.Formatting.Second_Number; Sub_Second : Ada.Calendar.Formatting.Second_Duration; end record; function Split (Value : Ada.Calendar.Time; Time_Zone : Ada.Calendar.Time_Zones.Time_Offset) return Split_Time; -- Pre process split time component from Value in Time_Zone procedure Render (Output : in out Ada.Streams.Root_Stream_Type'Class; Template : in out Lockable.Descriptor'Class; Value : in Split_Time); -- Render the given time procedure Render (Output : in out Ada.Streams.Root_Stream_Type'Class; Template : in out Lockable.Descriptor'Class; Value : in Ada.Calendar.Time); -- Render the given time considered in local time zone procedure Render (Output : in out Ada.Streams.Root_Stream_Type'Class; Template : in out Lockable.Descriptor'Class; Value : in Ada.Calendar.Time; Time_Zone : Ada.Calendar.Time_Zones.Time_Offset); -- Render the given time end Natools.S_Expressions.Templates.Dates; |