The Magic Prototyper is a plugin that makes writing class definitions and corresponding declarations a snap.
The prototyper starts out empty, the prototyper button
indicates the empty state with the empty red triangle.
When the user selects function definitions, declarations, classes with member functions,
templates, etc. and clicks the prototyper, the prototyper clipboard gets loaded with prototypes
and the prototyper button changes to a full red triangle.
Pressing on the prototyper button displays the clipboard with prototypes, ready to be pasted into a source file. The user can examine generated prototypes in the clipboard before pasting them.
Clicking on the full prototyper button pastes the prototypes into the current selection.
Click or Press an empty prototyper button | Loads the prototyper with prototypes of selected C/C++ code |
Press a full prototyper button | Displays the prototypes in a popup window |
Click on a full prototyper button | Pastes the prototypes into the current selection |
Control-click on a full prototyper | Empties the prototyper |
Hold down Win key while loading the prototyper | Forces generating prototypes for everything (including static functions, pure virtual functions, etc.) |
Hold down Shift while loading the prototyper | Appends new prototypes to prototyper clipboard after the existing prototypes |
Using the prototyper on a non-static C function definition will result in generating corresponding function declarations with extern prefixes. Holding down the Win key includes prototypes for static functions. Using the prototyper on C function declarations generates an inverse prototype - an empty version of the function with empty curly braces ready to fill out with code.
Selecting C++ functions and clicking the prototyper will generate member function definitions, formated such, that they can be immediately pasted into a corresponding class.
Selecting a C++ class definition and clicking the prototyper button will generate corresponding empty functions. Functions containing inline code, pure virtuals and static functions are not included by default. Default parameter values are removed by the prototyper (note the default value of 5 for the parameter count is removed in the generated constructor definition in the prototyper clipboard.
By holding down the Win key you may choose to also include prototypes for pure virtual functions, static functions and functions that are inlined in the class definition. In the example above, the prototyper clipboard contains prototypes for PureVirtual and for Count, even though Count is inlined inside the class definition.
While loading the prototyper clipboard, if the only function contained by the selection is a pure virtual, static or inlined in the class, the prototyper will still load the clipboard for an empty definition for that function even without holding down the Win key.
When pasting empty function definitions into a header file, the prototyper assumes that
they are intended to be inlines and adds inline
appropriately. This behavior
can be turned off in the Prototyper setting panel in the Application settings dialog. If
you paste the same definitions in a .cpp file, inline
keywords will not be added.
By default the Prototyper defines the following keyboard shorctuts. Several others
are available by binding the respective primitive function with a SetKey keyboard
shortcut. For a full list of Prototyper keyboard shortcuts, execute Primitives | grep
Prototyper
in the Worksheet.
Control-Win-P | If empty, loads prototypes, if full pastes prototypes into selection |
Control-P | If empty, loads all prototypes, including pure virtual and already inlined, if full, pastes prototypes into selection |