AcceptLanguageList Class Reference

#include <AcceptLanguageList.h>

List of all members.

Public Member Functions

 AcceptLanguageList ()
 AcceptLanguageList (const AcceptLanguageList &acceptLanguages)
 ~AcceptLanguageList ()
AcceptLanguageListoperator= (const AcceptLanguageList &acceptLanguages)
Uint32 size () const
LanguageTag getLanguageTag (Uint32 index) const
Real32 getQualityValue (Uint32 index) const
void insert (const LanguageTag &languageTag, Real32 qualityValue)
void remove (Uint32 index)
Uint32 find (const LanguageTag &languageTag) const
void clear ()
Boolean operator== (const AcceptLanguageList &acceptLanguages) const
Boolean operator!= (const AcceptLanguageList &acceptLanguages) const

Detailed Description

This class represents an list of languages that a reader can understand (as may be specified in an HTTP Accept-Language header value). It is managed as a prioritized list of LanguageTag objects and quality values.


Constructor & Destructor Documentation

AcceptLanguageList::AcceptLanguageList (  ) 

Constructs an empty AcceptLanguageList object.

AcceptLanguageList::AcceptLanguageList ( const AcceptLanguageList acceptLanguages  ) 

Copy constructor.

Parameters:
acceptLanguages The AcceptLanguageList object to copy.
AcceptLanguageList::~AcceptLanguageList (  ) 

Destructor.


Member Function Documentation

void AcceptLanguageList::clear (  ) 

Removes all the LanguageTags and quality values from the AcceptLanguageList object.

Uint32 AcceptLanguageList::find ( const LanguageTag languageTag  )  const

Finds the first occurrence of the specified LanguageTag in the AcceptLanguageList object and returns its index.

Parameters:
languageTag The LanguageTag to find.
Returns:
Integer index of the element, if found; otherwise PEG_NOT_FOUND.
LanguageTag AcceptLanguageList::getLanguageTag ( Uint32  index  )  const

Accesses an LanguageTag at a specified index.

Parameters:
index Integer index of the LanguageTag to access. Valid indices range from 0 to size()-1.
Returns:
The LanguageTag corresponding to the specified index.
Exceptions:
IndexOutOfBoundsException If the specified index is out of range.
Real32 AcceptLanguageList::getQualityValue ( Uint32  index  )  const

Accesses a quality value at a specified index (corresponding to a language tag).

Parameters:
index Integer index of the quality value to access. Valid indices range from 0 to size()-1.
Returns:
The quality value corresponding to the specified index.
Exceptions:
IndexOutOfBoundsException If the specified index is out of range.
void AcceptLanguageList::insert ( const LanguageTag languageTag,
Real32  qualityValue 
)

Inserts a LanguageTag and quality value into the AcceptLanguageList object. The element is inserted in order of descending quality value and after any other elements with the same quality value.

Parameters:
languageTag The LanguageTag to insert.
qualityValue The quality value to insert.
Boolean AcceptLanguageList::operator!= ( const AcceptLanguageList acceptLanguages  )  const

Tests AcceptLanguageList objects for inequality.

Parameters:
acceptLanguages An AcceptLanguageList object to be compared.
Returns:
False if the AcceptLanguageList objects contain the same LanguageTags and quality values in the same order, true otherwise.
AcceptLanguageList& AcceptLanguageList::operator= ( const AcceptLanguageList acceptLanguages  ) 

Assignment operator.

Parameters:
acceptLanguages The AcceptLanguageList object to copy.
Boolean AcceptLanguageList::operator== ( const AcceptLanguageList acceptLanguages  )  const

Tests AcceptLanguageList objects for equality.

Parameters:
acceptLanguages An AcceptLanguageList object to be compared.
Returns:
True if the AcceptLanguageList objects contain the same LanguageTags and quality values in the same order, false otherwise.
void AcceptLanguageList::remove ( Uint32  index  ) 

Removes the specified LanguageTag and quality value from the AcceptLanguageList object.

Parameters:
index Integer index of the element to remove.
Exceptions:
IndexOutOfBoundsException If the specified index is out of range.
Uint32 AcceptLanguageList::size (  )  const

Returns the number of LanguagesTags in the AcceptLanguageList object.

Returns:
Integer size of the AcceptLanguageList list.

The documentation for this class was generated from the following file: