Main Page   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members   Related Pages  

MFString Class Reference

Encapsulates a MFString. More...

Inheritance diagram for MFString:

FieldValue List of all members.

Public Methods

 MFString (size_t length=0, const std::string *values=0) throw (std::bad_alloc)
 Constructor.

 MFString (const MFString &mfstring) throw (std::bad_alloc)
 Copy constructor.

virtual ~MFString () throw ()
 Destructor.

MFString & operator= (const MFString &mfstring) throw (std::bad_alloc)
 Assignment operator.

const std::string & getElement (size_t index) const throw ()
 Get an element of the array.

void setElement (size_t index, const std::string &value) throw (std::bad_alloc)
 Set an element of the array.

size_t getLength () const throw ()
 Get the length.

void setLength (const size_t length) throw (std::bad_alloc)
 Set the length of the vector of std::strings.

void addElement (const std::string &value) throw (std::bad_alloc)
 Add an element to the end of the sequence.

void insertElement (size_t index, const std::string &value) throw (std::bad_alloc)
 Insert an element into the sequence.

void removeElement (size_t index) throw ()
 Remove an element from the sequence.

virtual std::auto_ptr< FieldValueclone () const throw (std::bad_alloc)
 Virtual copy constructor.

virtual FieldValueassign (const FieldValue &value) throw (std::bad_cast, std::bad_alloc)
 Virtual assignment.

virtual Type type () const throw ()
 Get the FieldValue::Type associated with this class.


Private Methods

virtual void print (std::ostream &) const
 Print to an output stream.


Private Attributes

std::vector< std::string > values

Detailed Description

Encapsulates a MFString.


Constructor & Destructor Documentation

MFString size_t    length = 0,
const std::string *    values = 0
throw (std::bad_alloc) [explicit]
 

Constructor.

Parameters:
length the length of the passed array
values an array of std::string
Exceptions:
std::bad_alloc if memory allocation fails.

MFString const MFString &    mfstring throw (std::bad_alloc)
 

Copy constructor.

Parameters:
mfstring the object to copy.
Exceptions:
std::bad_alloc if memory allocation fails.

~MFString   throw () [virtual]
 

Destructor.


Member Function Documentation

void addElement const std::string &    value throw (std::bad_alloc)
 

Add an element to the end of the sequence.

Parameters:
value the value to add.
Exceptions:
std::bad_alloc if memory allocation fails.

FieldValue & assign const FieldValue   value throw (std::bad_cast, std::bad_alloc) [virtual]
 

Virtual assignment.

Returns:
a reference to the object.
Exceptions:
std::bad_cast if value is not an MFString object.
std::bad_alloc if memory allocation fails.

Implements FieldValue.

std::auto_ptr< FieldValue > clone   const throw (std::bad_alloc) [virtual]
 

Virtual copy constructor.

Returns:
a pointer to a copy of the object.
Exceptions:
std::bad_alloc if memory allocation fails.

Implements FieldValue.

const std::string & getElement size_t    index const throw ()
 

Get an element of the array.

Parameters:
index the index of the element to retrieve
Returns:
the array element

size_t getLength   const throw ()
 

Get the length.

Returns:
the number of values in the array

void insertElement size_t    index,
const std::string &    value
throw (std::bad_alloc)
 

Insert an element into the sequence.

Parameters:
index the index where the new value should be inserted.
value a string.
Exceptions:
std::bad_alloc if memory allocation fails.
Precondition:
index is a valid index.

MFString & operator= const MFString &    mfstring throw (std::bad_alloc)
 

Assignment operator.

Parameters:
mfstring the object to copy into this one

void print std::ostream &    out const [private, virtual]
 

Print to an output stream.

Parameters:
out an output stream.

Implements FieldValue.

void removeElement size_t    index throw ()
 

Remove an element from the sequence.

Parameters:
index the index of the value to remove.
Precondition:
index is a valid index.

void setElement size_t    index,
const std::string &    value
throw (std::bad_alloc)
 

Set an element of the array.

Parameters:
index the index of the element to set
value the new value
Exceptions:
std::bad_alloc if memory allocation fails.

void setLength const size_t    length throw (std::bad_alloc)
 

Set the length of the vector of std::strings.

If the new length is greater than the current length, the new positions are filled with empty std::strings.

Parameters:
length the new length
Exceptions:
std::bad_alloc if memory allocation fails.

FieldValue::Type type   const throw () [virtual]
 

Get the FieldValue::Type associated with this class.

Returns:
FieldValue::mfstring.

Implements FieldValue.