Apply pretty print tool.
Apply on each class in test suite and library.
This commit is contained in:
@@ -26,7 +26,9 @@ feature -- Access
|
||||
create template_content.make_empty
|
||||
l_file.read_stream (l_file.count)
|
||||
l_last_string := l_file.last_string
|
||||
check l_last_string /= Void end -- implied by postcondition of `l_file.read_stream'
|
||||
check
|
||||
l_last_string /= Void
|
||||
end -- implied by postcondition of `l_file.read_stream'
|
||||
template_content.append (l_last_string.string)
|
||||
Result := template_content
|
||||
l_file.close
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
note
|
||||
description:
|
||||
|
||||
"JSON Iterator"
|
||||
|
||||
description: "JSON Iterator"
|
||||
pattern: "Iterator visitor"
|
||||
author: "Jocelyn Fiat"
|
||||
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
||||
license: "MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
||||
date: "2013/08/01"
|
||||
revision: "Revision 0.1"
|
||||
|
||||
@@ -13,6 +10,7 @@ deferred class
|
||||
JSON_ITERATOR
|
||||
|
||||
inherit
|
||||
|
||||
JSON_VISITOR
|
||||
|
||||
feature -- Visitor Pattern
|
||||
@@ -52,7 +50,7 @@ feature -- Visitor Pattern
|
||||
end
|
||||
end
|
||||
|
||||
visit_json_string (a_json_string: JSON_STRING)
|
||||
visit_json_string (a_json_string: JSON_STRING)
|
||||
-- Visit `a_json_string'.
|
||||
do
|
||||
end
|
||||
|
||||
@@ -6,11 +6,11 @@ class
|
||||
JSON_PRETTY_STRING_VISITOR
|
||||
|
||||
inherit
|
||||
|
||||
JSON_VISITOR
|
||||
|
||||
create
|
||||
make,
|
||||
make_custom
|
||||
make, make_custom
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
@@ -26,7 +26,6 @@ feature -- Initialization
|
||||
output := a_output
|
||||
create indentation.make_empty
|
||||
indentation_step := "%T"
|
||||
|
||||
object_count_inlining := a_object_count_inlining
|
||||
array_count_inlining := a_array_count_inlining
|
||||
end
|
||||
@@ -34,7 +33,7 @@ feature -- Initialization
|
||||
feature -- Access
|
||||
|
||||
output: STRING_32
|
||||
-- JSON representation
|
||||
-- JSON representation
|
||||
|
||||
indentation: like output
|
||||
|
||||
@@ -60,6 +59,7 @@ feature -- Access
|
||||
end
|
||||
|
||||
object_count_inlining: INTEGER
|
||||
|
||||
array_count_inlining: INTEGER
|
||||
|
||||
feature -- Visitor Pattern
|
||||
@@ -82,10 +82,7 @@ feature -- Visitor Pattern
|
||||
until
|
||||
l_json_array.off
|
||||
loop
|
||||
if
|
||||
line_number > l_line or
|
||||
l_multiple_lines
|
||||
then
|
||||
if line_number > l_line or l_multiple_lines then
|
||||
new_line
|
||||
end
|
||||
value := l_json_array.item
|
||||
@@ -96,10 +93,7 @@ feature -- Visitor Pattern
|
||||
end
|
||||
end
|
||||
exdent
|
||||
if
|
||||
line_number > l_line or
|
||||
l_json_array.count >= array_count_inlining
|
||||
then
|
||||
if line_number > l_line or l_json_array.count >= array_count_inlining then
|
||||
new_line
|
||||
end
|
||||
output.append ("]")
|
||||
@@ -140,10 +134,7 @@ feature -- Visitor Pattern
|
||||
until
|
||||
l_pairs.off
|
||||
loop
|
||||
if
|
||||
line_number > l_line or
|
||||
l_multiple_lines
|
||||
then
|
||||
if line_number > l_line or l_multiple_lines then
|
||||
new_line
|
||||
end
|
||||
l_pairs.key_for_iteration.accept (Current)
|
||||
@@ -155,16 +146,13 @@ feature -- Visitor Pattern
|
||||
end
|
||||
end
|
||||
exdent
|
||||
if
|
||||
line_number > l_line or
|
||||
l_pairs.count >= object_count_inlining
|
||||
then
|
||||
if line_number > l_line or l_pairs.count >= object_count_inlining then
|
||||
new_line
|
||||
end
|
||||
output.append ("}")
|
||||
end
|
||||
|
||||
visit_json_string (a_json_string: JSON_STRING)
|
||||
visit_json_string (a_json_string: JSON_STRING)
|
||||
-- Visit `a_json_string'.
|
||||
do
|
||||
output.append ("%"")
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
note
|
||||
description:
|
||||
|
||||
"JSON Visitor"
|
||||
|
||||
description: "JSON Visitor"
|
||||
pattern: "Visitor"
|
||||
author: "Javier Velilla"
|
||||
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
||||
license: "MIT (see http://www.opensource.org/licenses/mit-license.php)"
|
||||
date: "2008/08/24"
|
||||
revision: "Revision 0.1"
|
||||
|
||||
@@ -49,7 +46,7 @@ feature -- Visitor Pattern
|
||||
deferred
|
||||
end
|
||||
|
||||
visit_json_string (a_json_string: JSON_STRING)
|
||||
visit_json_string (a_json_string: JSON_STRING)
|
||||
-- Visit `a_json_string'.
|
||||
require
|
||||
a_json_string_not_void: a_json_string /= Void
|
||||
|
||||
@@ -8,9 +8,11 @@ class
|
||||
PRINT_JSON_VISITOR
|
||||
|
||||
inherit
|
||||
|
||||
JSON_VISITOR
|
||||
|
||||
create make
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
@@ -23,7 +25,7 @@ feature -- Initialization
|
||||
feature -- Access
|
||||
|
||||
to_json: STRING
|
||||
-- JSON representation
|
||||
-- JSON representation
|
||||
|
||||
feature -- Visitor Pattern
|
||||
|
||||
@@ -33,7 +35,7 @@ feature -- Visitor Pattern
|
||||
value: JSON_VALUE
|
||||
l_json_array: ARRAYED_LIST [JSON_VALUE]
|
||||
do
|
||||
l_json_array:=a_json_array.array_representation
|
||||
l_json_array := a_json_array.array_representation
|
||||
to_json.append ("[")
|
||||
from
|
||||
l_json_array.start
|
||||
@@ -44,7 +46,7 @@ feature -- Visitor Pattern
|
||||
value.accept (Current)
|
||||
l_json_array.forth
|
||||
if not l_json_array.after then
|
||||
to_json.append(",")
|
||||
to_json.append (",")
|
||||
end
|
||||
end
|
||||
to_json.append ("]")
|
||||
@@ -71,7 +73,7 @@ feature -- Visitor Pattern
|
||||
visit_json_object (a_json_object: JSON_OBJECT)
|
||||
-- Visit `a_json_object'.
|
||||
local
|
||||
l_pairs: HASH_TABLE[JSON_VALUE,JSON_STRING]
|
||||
l_pairs: HASH_TABLE [JSON_VALUE, JSON_STRING]
|
||||
do
|
||||
l_pairs := a_json_object.map_representation
|
||||
to_json.append ("{")
|
||||
@@ -91,7 +93,7 @@ feature -- Visitor Pattern
|
||||
to_json.append ("}")
|
||||
end
|
||||
|
||||
visit_json_string (a_json_string: JSON_STRING)
|
||||
visit_json_string (a_json_string: JSON_STRING)
|
||||
-- Visit `a_json_string'.
|
||||
do
|
||||
to_json.append ("%"")
|
||||
|
||||
Reference in New Issue
Block a user