Eiffel Visitor Factory Tool: Difference between revisions
Initial entry |
|||
| Line 14: | Line 14: | ||
For all other options please read the usage help using the '''-?''' | For all other options please read the usage help using the '''-?''' | ||
== Sample Output == | |||
As an example of what the tool generates, imagine the tool running in a directory containing two classes - <code>ERROR_A</code> and <code>ERROR_B</code>: | |||
<code>[eiffel, N] | |||
class ERROR_A | |||
-- | |||
end | |||
</code> | |||
<code>[eiffel, N] | |||
class ERROR_B | |||
-- | |||
end | |||
</code> | |||
Running the tool in with the default settings will produce an interface class: | |||
<code>[eiffel, N] | |||
deferred class | |||
GENERATED_VISITOR | |||
feature -- Processing | |||
process_error_a (a_value: ERROR_A) | |||
-- Process object `a_error_a'. | |||
require | |||
a_error_a_attached: error_a /= Void | |||
deferred | |||
end | |||
process_error_b (a_value: ERROR_B) | |||
-- Process object `a_error_b'. | |||
require | |||
a_error_b_attached: error_b /= Void | |||
deferred | |||
end | |||
end -- class {GENERATED_VISITOR} | |||
</code> | |||
And a stub class: | |||
<code>[eiffel, N] | |||
class | |||
GENERATED_VISITOR_IMPL | |||
inherit | |||
GENERATED_VISITOR | |||
redefine | |||
process_error_a, | |||
process_error_b | |||
end | |||
feature -- Processing | |||
process_error_a (a_value: ERROR_A) | |||
-- Process object `a_error_a'. | |||
do | |||
check not_impl: False end | |||
end | |||
process_error_b (a_value: ERROR_B) | |||
-- Process object `a_error_b'. | |||
do | |||
check not_impl: False end | |||
end | |||
end -- class {GENERATED_VISITOR_IMPL} | |||
</code> | |||
You can run the tool with the '''-n''' option to change the name of the generated class. Stub classes are always generated with a <code>_IMPL</code> extension. | |||
== Information == | == Information == | ||
Revision as of 23:08, 21 November 2006
Overview
The Eiffel Visitor Factory Tool is a simple command line application to generate Eiffel visitor patterns based on Eiffel classes found at specified folder locations. It can generate an interface (deferred) and/or stub (effective) Eiffel classes in no time.
Command-line Options
By default the tool will look in the current working directory for Eiffel source files (*.e). If you want to specify alternative locations use the -i switch to specify relative or absolute directory or file paths. If you need to exclude files use the -ex switch to specify what files to exclude.
To exclude a files in the current directory that start with status you would call:
vfact -ex "/status.*\.e$"
You can optionally search all specified directories recursively using the -r switch.
For all other options please read the usage help using the -?
Sample Output
As an example of what the tool generates, imagine the tool running in a directory containing two classes - ERROR_A and ERROR_B:
class ERROR_A -- end
class ERROR_B -- end
Running the tool in with the default settings will produce an interface class:
deferred class GENERATED_VISITOR feature -- Processing process_error_a (a_value: ERROR_A) -- Process object `a_error_a'. require a_error_a_attached: error_a /= Void deferred end process_error_b (a_value: ERROR_B) -- Process object `a_error_b'. require a_error_b_attached: error_b /= Void deferred end end -- class {GENERATED_VISITOR}
And a stub class:
class GENERATED_VISITOR_IMPL inherit GENERATED_VISITOR redefine process_error_a, process_error_b end feature -- Processing process_error_a (a_value: ERROR_A) -- Process object `a_error_a'. do check not_impl: False end end process_error_b (a_value: ERROR_B) -- Process object `a_error_b'. do check not_impl: False end end end -- class {GENERATED_VISITOR_IMPL}
You can run the tool with the -n option to change the name of the generated class. Stub classes are always generated with a _IMPL extension.
Information
This tool was developed and maintained by Paulb.
Location: https://origo.ethz.ch/eiffelsoftware/es/trunk/Src/tools/visitor_factory
Change Log
Initial Entry: --Paulb 23:54, 21 November 2006 (CET)