PageRenderTime 23ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/src/lib/time/time_formatter.e

http://github.com/tybor/Liberty
Specman e | 89 lines | 45 code | 12 blank | 32 comment | 0 complexity | 91a5ab79aff8ac920c0643f5f49aaf9c MD5 | raw file
 1-- This file is part of a Liberty Eiffel library.
 2-- See the full copyright at the end.
 3--
 4deferred class TIME_FORMATTER
 5   --
 6   -- The polymorphic format class for TIME.
 7   --
 8
 9insert
10   TIME_HANDLER
11      redefine out_in_tagged_out_memory
12      end
13
14feature {ANY}
15   time: TIME
16         -- The corresponding information to display.
17
18   set_time (t: TIME)
19      do
20         time := t
21      ensure
22         time = t
23      end
24
25   short_mode: BOOLEAN
26         -- Is the formatting mode set to the short (abbreviated) mode ?
27
28   set_short_mode (value: BOOLEAN)
29      do
30         short_mode := value
31      ensure
32         short_mode = value
33      end
34
35   day_in (buffer: STRING)
36         -- According to the current `short_mode', append in the `buffer'
37         -- the name of the day.
38      deferred
39      end
40
41   month_in (buffer: STRING)
42         -- According to the current `short_mode', append in the `buffer'
43         -- the name of the month.
44      deferred
45      end
46
47   frozen to_string: STRING
48      do
49         to_string_buffer.clear_count
50         append_in(to_string_buffer)
51         Result := to_string_buffer.twin
52      end
53
54   append_in (buffer: STRING)
55      deferred
56      end
57
58   frozen out_in_tagged_out_memory
59      do
60         append_in(tagged_out_memory)
61      end
62
63feature {}
64   to_string_buffer: STRING
65      once
66         create Result.make(128)
67      end
68
69end -- class TIME_FORMATTER
70--
71-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
72--
73-- Permission is hereby granted, free of charge, to any person obtaining a copy
74-- of this software and associated documentation files (the "Software"), to deal
75-- in the Software without restriction, including without limitation the rights
76-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
77-- copies of the Software, and to permit persons to whom the Software is
78-- furnished to do so, subject to the following conditions:
79--
80-- The above copyright notice and this permission notice shall be included in
81-- all copies or substantial portions of the Software.
82--
83-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
85-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
86-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
87-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
88-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
89-- THE SOFTWARE.