1------------------------------------------------------------------------------ 2-- -- 3-- Matreshka Project -- 4-- -- 5-- Localization, Internationalization, Globalization for Ada -- 6-- -- 7-- Runtime Library Component -- 8-- -- 9------------------------------------------------------------------------------ 10-- -- 11-- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> -- 12-- All rights reserved. -- 13-- -- 14-- Redistribution and use in source and binary forms, with or without -- 15-- modification, are permitted provided that the following conditions -- 16-- are met: -- 17-- -- 18-- * Redistributions of source code must retain the above copyright -- 19-- notice, this list of conditions and the following disclaimer. -- 20-- -- 21-- * Redistributions in binary form must reproduce the above copyright -- 22-- notice, this list of conditions and the following disclaimer in the -- 23-- documentation and/or other materials provided with the distribution. -- 24-- -- 25-- * Neither the name of the Vadim Godunko, IE nor the names of its -- 26-- contributors may be used to endorse or promote products derived from -- 27-- this software without specific prior written permission. -- 28-- -- 29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- 30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- 31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- 32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- 33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- 34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- 35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- 36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- 37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- 38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- 39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- 40-- -- 41------------------------------------------------------------------------------ 42-- $Revision: 1646 $ $Date: 2011-03-26 12:39:15 +0300 (Sat, 26 Mar 2011) $ 43------------------------------------------------------------------------------ 44with Matreshka.Internals.Calendars.Gregorian; 45 46package body Matreshka.Internals.Calendars.Formatting.ISO_8601 is 47 48 procedure Append 49 (Result : in out League.Strings.Universal_String; 50 Value : Natural; 51 Padding : Positive); 52 53 ------------ 54 -- Append -- 55 ------------ 56 57 procedure Append 58 (Result : in out League.Strings.Universal_String; 59 Value : Natural; 60 Padding : Positive) 61 is 62 Image : constant Wide_Wide_String := Integer'Wide_Wide_Image (Value); 63 64 begin 65 for J in 1 .. Padding - Image'Length + 1 loop 66 Result.Append ('0'); 67 end loop; 68 69 Result.Append (Image (Image'First + 1 .. Image'Last)); 70 end Append; 71 72 ---------------------------- 73 -- Append_Abbreviated_Era -- 74 ---------------------------- 75 76 overriding procedure Append_Abbreviated_Era 77 (Self : ISO_8601_Printer; 78 Output : in out League.Strings.Universal_String; 79 Date : Julian_Day_Number; 80 Padding : Era_Padding) is 81 begin 82 -- XXX Not yet implemented. 83 84 null; 85 end Append_Abbreviated_Era; 86 87 ------------------------------ 88 -- Append_Abbreviated_Month -- 89 ------------------------------ 90 91 overriding procedure Append_Abbreviated_Month 92 (Self : ISO_8601_Printer; 93 Output : in out League.Strings.Universal_String; 94 Date : Julian_Day_Number; 95 Is_Stand_Alone : Boolean) is 96 begin 97 -- XXX Not yet implemented. 98 99 null; 100 end Append_Abbreviated_Month; 101 102 -------------------------------- 103 -- Append_Abbreviated_Quarter -- 104 -------------------------------- 105 106 overriding procedure Append_Abbreviated_Quarter 107 (Self : ISO_8601_Printer; 108 Output : in out League.Strings.Universal_String; 109 Date : Julian_Day_Number; 110 Is_Stand_Alone : Boolean) is 111 begin 112 -- XXX Not yet implemented. 113 114 null; 115 end Append_Abbreviated_Quarter; 116 117 ------------------------------- 118 -- Append_Chinese_Leap_Month -- 119 ------------------------------- 120 121 overriding procedure Append_Chinese_Leap_Month 122 (Self : ISO_8601_Printer; 123 Output : in out League.Strings.Universal_String; 124 Date : Julian_Day_Number) is 125 begin 126 -- XXX Not yet implemented. 127 128 null; 129 end Append_Chinese_Leap_Month; 130 131 ------------------------- 132 -- Append_Day_Of_Month -- 133 ------------------------- 134 135 overriding procedure Append_Day_Of_Month 136 (Self : ISO_8601_Printer; 137 Output : in out League.Strings.Universal_String; 138 Date : Julian_Day_Number; 139 Padding : Positive) is 140 begin 141 Append 142 (Output, 143 Matreshka.Internals.Calendars.Gregorian.Day (Date), 144 Padding); 145 end Append_Day_Of_Month; 146 147 --------------------------------- 148 -- Append_Day_Of_Week_In_Month -- 149 --------------------------------- 150 151 overriding procedure Append_Day_Of_Week_In_Month 152 (Self : ISO_8601_Printer; 153 Output : in out League.Strings.Universal_String; 154 Date : Julian_Day_Number) is 155 begin 156 -- XXX Not yet implemented. 157 158 null; 159 end Append_Day_Of_Week_In_Month; 160 161 ------------------------ 162 -- Append_Day_Of_Year -- 163 ------------------------ 164 165 overriding procedure Append_Day_Of_Year 166 (Self : ISO_8601_Printer; 167 Output : in out League.Strings.Universal_String; 168 Date : Julian_Day_Number; 169 Padding : Positive) is 170 begin 171 -- XXX Not yet implemented. 172 173 null; 174 end Append_Day_Of_Year; 175 176 -------------------------- 177 -- Append_Extended_Year -- 178 -------------------------- 179 180 overriding procedure Append_Extended_Year 181 (Self : ISO_8601_Printer; 182 Output : in out League.Strings.Universal_String; 183 Date : Julian_Day_Number; 184 Padding : Positive) is 185 begin 186 -- XXX Not yet implemented. 187 188 null; 189 end Append_Extended_Year; 190 191 ----------------------------- 192 -- Append_Full_Day_Of_Week -- 193 ----------------------------- 194 195 overriding procedure Append_Full_Day_Of_Week 196 (Self : ISO_8601_Printer; 197 Output : in out League.Strings.Universal_String; 198 Date : Julian_Day_Number; 199 Is_Stand_Alone : Boolean) is 200 begin 201 -- XXX Not yet implemented. 202 203 null; 204 end Append_Full_Day_Of_Week; 205 206 ----------------------- 207 -- Append_Full_Month -- 208 ----------------------- 209 210 overriding procedure Append_Full_Month 211 (Self : ISO_8601_Printer; 212 Output : in out League.Strings.Universal_String; 213 Date : Julian_Day_Number; 214 Is_Stand_Alone : Boolean) is 215 begin 216 -- XXX Not yet implemented. 217 218 null; 219 end Append_Full_Month; 220 221 ------------------------- 222 -- Append_Full_Quarter -- 223 ------------------------- 224 225 overriding procedure Append_Full_Quarter 226 (Self : ISO_8601_Printer; 227 Output : in out League.Strings.Universal_String; 228 Date : Julian_Day_Number; 229 Is_Stand_Alone : Boolean) is 230 begin 231 -- XXX Not yet implemented. 232 233 null; 234 end Append_Full_Quarter; 235 236 ----------------------- 237 -- Append_Julian_Day -- 238 ----------------------- 239 240 overriding procedure Append_Julian_Day 241 (Self : ISO_8601_Printer; 242 Output : in out League.Strings.Universal_String; 243 Date : Julian_Day_Number; 244 Padding : Positive) is 245 begin 246 -- XXX Not yet implemented. 247 248 null; 249 end Append_Julian_Day; 250 251 --------------------- 252 -- Append_Long_Era -- 253 --------------------- 254 255 overriding procedure Append_Long_Era 256 (Self : ISO_8601_Printer; 257 Output : in out League.Strings.Universal_String; 258 Date : Julian_Day_Number) is 259 begin 260 -- XXX Not yet implemented. 261 262 null; 263 end Append_Long_Era; 264 265 ------------------------------- 266 -- Append_Narrow_Day_Of_Week -- 267 ------------------------------- 268 269 overriding procedure Append_Narrow_Day_Of_Week 270 (Self : ISO_8601_Printer; 271 Output : in out League.Strings.Universal_String; 272 Date : Julian_Day_Number; 273 Is_Stand_Alone : Boolean) is 274 begin 275 -- XXX Not yet implemented. 276 277 null; 278 end Append_Narrow_Day_Of_Week; 279 280 ----------------------- 281 -- Append_Narrow_Era -- 282 ----------------------- 283 284 overriding procedure Append_Narrow_Era 285 (Self : ISO_8601_Printer; 286 Output : in out League.Strings.Universal_String; 287 Date : Julian_Day_Number) is 288 begin 289 -- XXX Not yet implemented. 290 291 null; 292 end Append_Narrow_Era; 293 294 ------------------------- 295 -- Append_Narrow_Month -- 296 ------------------------- 297 298 overriding procedure Append_Narrow_Month 299 (Self : ISO_8601_Printer; 300 Output : in out League.Strings.Universal_String; 301 Date : Julian_Day_Number; 302 Is_Stand_Alone : Boolean) is 303 begin 304 -- XXX Not yet implemented. 305 306 null; 307 end Append_Narrow_Month; 308 309 ---------------------------------- 310 -- Append_Numerical_Day_Of_Week -- 311 ---------------------------------- 312 313 overriding procedure Append_Numerical_Day_Of_Week 314 (Self : ISO_8601_Printer; 315 Output : in out League.Strings.Universal_String; 316 Date : Julian_Day_Number; 317 Padding : Positive; 318 Is_Stand_Alone : Boolean) is 319 begin 320 -- XXX Not yet implemented. 321 322 null; 323 end Append_Numerical_Day_Of_Week; 324 325 ---------------------------- 326 -- Append_Numerical_Month -- 327 ---------------------------- 328 329 overriding procedure Append_Numerical_Month 330 (Self : ISO_8601_Printer; 331 Output : in out League.Strings.Universal_String; 332 Date : Julian_Day_Number; 333 Padding : Positive; 334 Is_Stand_Alone : Boolean) is 335 begin 336 Append 337 (Output, 338 Matreshka.Internals.Calendars.Gregorian.Month (Date), 339 Padding); 340 end Append_Numerical_Month; 341 342 ------------------------------ 343 -- Append_Numerical_Quarter -- 344 ------------------------------ 345 346 overriding procedure Append_Numerical_Quarter 347 (Self : ISO_8601_Printer; 348 Output : in out League.Strings.Universal_String; 349 Date : Julian_Day_Number; 350 Padding : Positive; 351 Is_Stand_Alone : Boolean) is 352 begin 353 -- XXX Not yet implemented. 354 355 null; 356 end Append_Numerical_Quarter; 357 358 ------------------------------ 359 -- Append_Short_Day_Of_Week -- 360 ------------------------------ 361 362 overriding procedure Append_Short_Day_Of_Week 363 (Self : ISO_8601_Printer; 364 Output : in out League.Strings.Universal_String; 365 Date : Julian_Day_Number; 366 Padding : Positive; 367 Is_Stand_Alone : Boolean) is 368 begin 369 -- XXX Not yet implemented. 370 371 null; 372 end Append_Short_Day_Of_Week; 373 374 -------------------------- 375 -- Append_Week_Of_Month -- 376 -------------------------- 377 378 overriding procedure Append_Week_Of_Month 379 (Self : ISO_8601_Printer; 380 Output : in out League.Strings.Universal_String; 381 Date : Julian_Day_Number) is 382 begin 383 -- XXX Not yet implemented. 384 385 null; 386 end Append_Week_Of_Month; 387 388 ------------------------- 389 -- Append_Week_Of_Year -- 390 ------------------------- 391 392 overriding procedure Append_Week_Of_Year 393 (Self : ISO_8601_Printer; 394 Output : in out League.Strings.Universal_String; 395 Date : Julian_Day_Number; 396 Padding : Positive) is 397 begin 398 -- XXX Not yet implemented. 399 400 null; 401 end Append_Week_Of_Year; 402 403 ----------------- 404 -- Append_Year -- 405 ----------------- 406 407 overriding procedure Append_Year 408 (Self : ISO_8601_Printer; 409 Output : in out League.Strings.Universal_String; 410 Date : Julian_Day_Number; 411 Padding : Positive) is 412 begin 413 Append 414 (Output, 415 Matreshka.Internals.Calendars.Gregorian.Year (Date), 416 Padding); 417 end Append_Year; 418 419 ---------------------- 420 -- Append_Year_Week -- 421 ---------------------- 422 423 overriding procedure Append_Year_Week 424 (Self : ISO_8601_Printer; 425 Output : in out League.Strings.Universal_String; 426 Date : Julian_Day_Number; 427 Padding : Positive) is 428 begin 429 -- XXX Not yet implemented. 430 431 null; 432 end Append_Year_Week; 433 434end Matreshka.Internals.Calendars.Formatting.ISO_8601; 435