Main Page | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

Parameter Class Reference

Inheritance diagram for Parameter:

Node List of all members.

Detailed Description

Parameter represents a parameter in a header field body, such as the field body of a Content-Type header field. The syntax of such a parameter is described in RFC 2045. A parameter consists of a name/value pair. The following content-type header field illustrates the syntax:

    Content-type: text/plain; charset=iso-8859-1; format=flowed

In the above example, there are two parameters. The first parameter has the name "charset" and the value "iso-8859-1". The second parameter has the name "format" and value "flowed".

Parameter has member functions for getting or setting the parameter's name and value.


Public Member Functions

 Parameter ()
 Default constructor.
 Parameter (const Parameter &other)
 Copy constructor.
 Parameter (const String &str, Node *parent=0)
 Constructor that takes an initial string and parent node.
virtual ~Parameter ()
 Destructor.
const Parameteroperator= (const Parameter &other)
 Assignment operator.
virtual void parse ()
 Parses the string representation.
virtual void assemble ()
 Assembles the string representation.
virtual Nodeclone () const
 Creates a copy of this object.
const Stringname () const
 Gets the name.
void setName (const String &name)
 Sets the name.
const Stringvalue () const
 Gets the value.
void setValue (const String &value)
 Sets the value.

Static Public Member Functions

ParameternewParameter ()
 Creates a new instance.

Static Public Attributes

Parameter *(* sNewParameter )()
 Provides a class factory hook.


Constructor & Destructor Documentation

Parameter  ) 
 

This constructor sets the Parameter object's string representation to the empty string and sets its parent node to NULL.

Parameter const Parameter other  ) 
 

This constructor performs a deep copy of its argument. The parent node of the new Parameter object is set to NULL.

Parameters:
other Parameter instance to copy

Parameter const String str,
Node parent = 0
 

This constructor sets the Parameter object's string representation to str and sets its parent node to parent.

Normally, you call the virtual function parse() immediately after this constructor to create the broken-down representation.

Parameters:
str initial value for the string representation
parent parent node for this object

~Parameter  )  [virtual]
 

Destructor


Member Function Documentation

void assemble  )  [virtual]
 

This virtual function, inherited from Node, executes the assemble operation for Parameter objects. The assemble operation creates or updates the string representation from the broken-down representation. For Parameter objects, the assemble operation builds the string representation from the name and value.

You should call this member function after you set or modify the name or value, and before you retrieve the string representation.

This function clears the is-modified flag.

Implements Node.

Node * clone  )  const [virtual]
 

This virtual function, inherited from Node, creates a new Parameter object that has the same value as this Parameter object. The parent node of the new Parameter object is set to NULL.

Returns:
a copy of this object

Implements Node.

const String & name  )  const
 

Gets the name.

Returns:
parameter name

Parameter * newParameter  )  [static]
 

Creates a new Parameter object.

If the static data member sNewParameter is NULL, this member function creates a new Parameter object and returns it. Otherwise, newParameter() calls the user-supplied function that sNewParameter points to and returns the object created by that function.

Returns:
new Parameter instance
See also:
sNewParameter

const Parameter & operator= const Parameter other  ) 
 

Performs a deep copy of its argument. The parent node of this Parameter object is not changed.

Parameters:
other Parameter instance to copy

void parse  )  [virtual]
 

This virtual function, inherited from Node, executes the parse operation for Parameter objects. The parse operation updates the broken-down representation from the string representation. For Parameter objects, the parse operation parses the string representation to extract the name and value of the parameter.

You should call this member function after you set or modify the string representation, and before you retrieve the name or value.

This function clears the is-modified flag.

Implements Node.

void setName const String name  ) 
 

Sets the name.

Parameters:
name parameter name

void setValue const String value  ) 
 

Sets the value.

Parameters:
value parameter value

const String & value  )  const
 

Gets the value.

Returns:
parameter value


Member Data Documentation

Parameter *(* sNewParameter)()=0 [static]
 

If sNewParameter is not NULL, it must point to a user-supplied function that returns a new instance of a subclass of Parameter.

See also:
newParameter()

Copyright © 2001-2007 Hunny Software, Inc. All rights reserved.