PageRenderTime 24ms CodeModel.GetById 21ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/lib/time/formatter/time_in_german.e

http://github.com/tybor/Liberty
Specman e | 191 lines | 159 code | 6 blank | 26 comment | 9 complexity | ef9a78f6f5b16d41f941b60557d77660 MD5 | raw file
  1-- This file is part of a Liberty Eiffel library.
  2-- See the full copyright at the end.
  3--
  4class TIME_IN_GERMAN
  5   --
  6   -- The German format class for class TIME.
  7   --
  8
  9inherit
 10   TIME_FORMATTER
 11
 12create {ANY}
 13   default_create, set_time
 14
 15feature {ANY}
 16   day_in (buffer: STRING)
 17      local
 18         s: STRING
 19      do
 20         if short_mode then
 21            inspect
 22               time.week_day
 23            when 0 then
 24               s := once "So"
 25            when 1 then
 26               s := once "Mo"
 27            when 2 then
 28               s := once "Di"
 29            when 3 then
 30               s := once "Mi"
 31            when 4 then
 32               s := once "Do"
 33            when 5 then
 34               s := once "Fr"
 35            when 6 then
 36               s := once "Sa"
 37            end
 38         else
 39            inspect
 40               time.week_day
 41            when 0 then
 42               s := once "Sonntag"
 43            when 1 then
 44               s := once "Montag"
 45            when 2 then
 46               s := once "Dienstag"
 47            when 3 then
 48               s := once "Mittwoch"
 49            when 4 then
 50               s := once "Donnerstag"
 51            when 5 then
 52               s := once "Freitag"
 53            when 6 then
 54               s := once "Samstag"
 55            end
 56         end
 57         buffer.append(s)
 58      end
 59
 60   month_in (buffer: STRING)
 61      local
 62         s: STRING
 63      do
 64         if short_mode then
 65            inspect
 66               time.month
 67            when 1 then
 68               s := once "Jan"
 69            when 2 then
 70               s := once "Feb"
 71            when 3 then
 72               s := once "M�r"
 73            when 4 then
 74               s := once "Apr"
 75            when 5 then
 76               s := once "Mai"
 77            when 6 then
 78               s := once "Jun"
 79            when 7 then
 80               s := once "Jul"
 81            when 8 then
 82               s := once "Aug"
 83            when 9 then
 84               s := once "Sep"
 85            when 10 then
 86               s := once "Okt"
 87            when 11 then
 88               s := once "Nov"
 89            when 12 then
 90               s := once "Dez"
 91            end
 92         else
 93            inspect
 94               time.month
 95            when 1 then
 96               s := once "Januar"
 97            when 2 then
 98               s := once "Februar"
 99            when 3 then
100               s := once "M�rz"
101            when 4 then
102               s := once "April"
103            when 5 then
104               s := once "Mai"
105            when 6 then
106               s := once "Juni"
107            when 7 then
108               s := once "Juli"
109            when 8 then
110               s := once "August"
111            when 9 then
112               s := once "September"
113            when 10 then
114               s := once "Oktober"
115            when 11 then
116               s := once "November"
117            when 12 then
118               s := once "Dezember"
119            end
120         end
121         buffer.append(s)
122      end
123
124   append_in (buffer: STRING)
125      local
126         tmp: STRING
127      do
128         day_in(buffer)
129         buffer.extend(',')
130         buffer.extend(' ')
131         tmp := time.day.to_string
132         if 2 > tmp.count then
133            tmp.insert_character('0', 1)
134         end
135         buffer.append_string(tmp)
136         buffer.append_character('.')
137         buffer.append_character(' ')
138         month_in(buffer)
139         buffer.append_character(' ')
140         if short_mode then
141            tmp := (time.year #\\ 100).to_string
142            if 2 > tmp.count then
143               tmp.insert_character('0', 1)
144            end
145            buffer.append_string(tmp)
146         else
147            time.year.append_in(buffer)
148         end
149         buffer.extend(' ')
150         tmp := time.hour.to_string
151         if 2 > tmp.count then
152            tmp.insert_character('0', 1)
153         end
154         buffer.append_string(tmp)
155         buffer.append_character(':')
156         tmp := time.minute.to_string
157         if 2 > tmp.count then
158            tmp.insert_character('0', 1)
159         end
160         buffer.append_string(tmp)
161         if not short_mode then
162            buffer.append_character(':')
163            tmp := time.second.to_string
164            if 2 > tmp.count then
165               tmp.insert_character('0', 1)
166            end
167            buffer.append_string(tmp)
168         end
169      end
170
171end -- class TIME_IN_GERMAN
172--
173-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
174--
175-- Permission is hereby granted, free of charge, to any person obtaining a copy
176-- of this software and associated documentation files (the "Software"), to deal
177-- in the Software without restriction, including without limitation the rights
178-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
179-- copies of the Software, and to permit persons to whom the Software is
180-- furnished to do so, subject to the following conditions:
181--
182-- The above copyright notice and this permission notice shall be included in
183-- all copies or substantial portions of the Software.
184--
185-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
186-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
187-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
188-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
189-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
190-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
191-- THE SOFTWARE.