Parameter
- Class to define parameters of eg. a command.
This is a placeholder class and are not to be used directly. To use the Parameter-classes, it is natural to instantiate a Parameter::Group-class and start from there.
Class to define parameters of eg. a command. It defines the common, basic methods and attributes shared by the Parameter::Group- and Parameter::Variable-classes. It is only a placeholder class and is not meant to be instantiated.
An overview of concepts:
Object A Parameter-object that can be added to a group. It can be either a Parameter::Group or Parameter::Variable-class type.
Parameter An item returned as a single entity to the user of the Parameter-class. It can consist of one or more Parameter::Variable-instances. The Parameter::Group-class decides if a collection of variables and/or sub-groups are to be returned as one parameter. Basically anything organized under a sub-group of the main-parameter-group will be returned as one parameter for that sub-group.
Group A collection of sub-groups and/or variables. It has certain attributes that can be set on it, such as if it is to be escaped, quoted and/or have no space between its parameters.
Variable A named value that can be set in a group. It has certain attributes that can be set on it, such as if it is to be escaped, quoted, be private or not and so on. Please see the Parameter::Variable-class documentation for more info on the Parameter::Variable-type.
Sets up the parameter-classes and returns an instance of the class.
It accepts the following options:
name Sets the name of the parameter-object. Defaults to a random 32-character name if none specified. The name chosen must be unique.
quote Sets if the parameter-class type is to be quoted or not. Defaults to 0. 1 means true, 0 means false.
escape Sets if the parameter-class type is to be escaped or not. Defaults to 0. 1 means true, 0 means false.
private Sets if the parameter-class type is to be private or not. Defaults to 1. 1 means true, 0 means false.
This method returns an instantiated class upon success.
Clones the whole instance
Accepts no input
Returns the reference to the copied object.
Get the last error message, if any.
Accepts no input.
Returns the last error message that happened, if any.
Get or set if the instance is to be escaped or not.
In the case of set accepts one input: escape. 1 means true, 0 means false.
Upon either get or set, returns the current setting of the escape-attribute. Again, 1 means true, 0 means false.
Get or set the name of instance.
In the case of set accepts one input: name. Name can only be in the character set of a-z, A-Z and 0-9.
Upon either get or set, returns the current name.
Get or set if the instance is to be private or not.
In the case of set accepts one input: private. 1 means true, 0 means false.
Upon either get or set, returns the current setting of the private-attribute. Again, 1 means true, 0 means false.
Convert parameter-instance to a string.
Accepts no input.
This is a placeholder class and is to be overridden by inherting classes.
Returns a string or blank.
Returns the type of the Parameter-instance.
Accepts no input.
Returns the type of the Parameter-instance, either "Group" or "Variable". The type- setting is set in the constructor of the inherited class.
Get or set if the instance is to be quoted or not.
In the case of set accepts one input: quote. 1 means true, 0 means false.
Upon either get or set, returns the current setting of the quote-attribute. Again, 1 means true, 0 means false.