Public Types | Public Member Functions | Friends

atscppapi::HeaderField Class Reference

A HeaderField is a class that contains the header field name and all of the values. More...

#include <Headers.h>

Collaboration diagram for atscppapi::HeaderField:
Collaboration graph
[legend]

Public Types

typedef unsigned int size_type
typedef header_field_value_iterator iterator

Public Member Functions

 ~HeaderField ()
size_type size () const
 Get the size of the HeaderField, this is the number of values associated with the header field.
iterator begin ()
 Returns an iterator to the start of the values.
iterator end ()
 Returns an iterator to the end of this header field's values.
HeaderFieldName name () const
 Get the name of this HeaderField.
std::string values (const char *join=",")
 Join all the values of this HeaderField into a single string seperated by the join string.
std::string values (const std::string &join)
 Join all the values of this HeaderField into a single string seperated by the join string.
std::string values (const char join)
 Join all the values of this HeaderField into a single string seperated by the join string.
bool empty ()
 Check if this HeaderField is empty (no values).
bool clear ()
 Remove all values from this HeaderField.
bool erase (iterator it)
 Remove a single value from this HeaderField which is pointed to by the given iterator.
bool append (const std::string &value)
 Append a value or a seperated list of values to this HeaderField.
bool append (const char *value, int length=-1)
 Append a value or a seperated list of values to this HeaderField.
bool setName (const std::string &str)
 Change the name of this HeaderField to the given key.
bool operator== (const char *field_name) const
 Compares the name of the header field only (not the values).
bool operator== (const std::string &field_name) const
 Compares the name of the header field only (not the values).
bool operator!= (const char *field_name) const
 Compares the name of the header field only (not the values).
bool operator!= (const std::string &field_name) const
 Compares the name of the header field only (not the values).
bool operator= (const std::string &field_value)
 Set the VALUES of the header field to the given value string.
bool operator= (const char *field_value)
 Set the VALUES of the header field to the given value string.
std::string operator[] (const int index)
 Get the index value from this HeaderField.
std::string str ()
 Get a string representing all the header field's values.

Friends

class Headers
class header_field_iterator
std::ostream & operator<< (std::ostream &os, HeaderField &obj)
 Get a string representing all the header field's values.

Detailed Description

A HeaderField is a class that contains the header field name and all of the values.

Note:
You may have several HeaderFields with the same name for a given set of Headers.

Definition at line 232 of file Headers.h.


Member Typedef Documentation

Definition at line 239 of file Headers.h.

typedef unsigned int atscppapi::HeaderField::size_type

Definition at line 238 of file Headers.h.


Constructor & Destructor Documentation

atscppapi::HeaderField::~HeaderField (  ) 

Member Function Documentation

bool atscppapi::HeaderField::append ( const std::string &  value  ) 

Append a value or a seperated list of values to this HeaderField.

Parameters:
a string containing the value(s).
Returns:
true if the values was appended.
bool atscppapi::HeaderField::append ( const char *  value,
int  length = -1 
)

Append a value or a seperated list of values to this HeaderField.

Parameters:
a string containing the value.
the length of the value that is being appended.
Returns:
true if the values was appended.
iterator atscppapi::HeaderField::begin (  ) 

Returns an iterator to the start of the values.

Returns:
an iterator point to the start of this header field's values
bool atscppapi::HeaderField::clear (  ) 

Remove all values from this HeaderField.

Returns:
true if the clear succeeds.
bool atscppapi::HeaderField::empty (  ) 

Check if this HeaderField is empty (no values).

Returns:
a boolean value representing whether or not the header field has values.
iterator atscppapi::HeaderField::end (  ) 

Returns an iterator to the end of this header field's values.

Returns:
an iterator that points beyond the last element of the header field's values.
bool atscppapi::HeaderField::erase ( iterator  it  ) 

Remove a single value from this HeaderField which is pointed to by the given iterator.

Parameters:
an iterator which points to a single HeaderField value.
Returns:
true if the header value was successfully erased.
HeaderFieldName atscppapi::HeaderField::name (  )  const

Get the name of this HeaderField.

Returns:
a HeaderFieldName object.
See also:
HeaderFieldName which is a thin wrapper around a string to allow for case insensitive comparisons.
bool atscppapi::HeaderField::operator!= ( const char *  field_name  )  const

Compares the name of the header field only (not the values).

Note:
This is a case insensitive comparison.
Returns:
true if the name is NOT equal (case insensitive comparison).
bool atscppapi::HeaderField::operator!= ( const std::string &  field_name  )  const

Compares the name of the header field only (not the values).

Note:
This is a case insensitive comparison.
Returns:
true if the name is NOT equal (case insensitive comparison).
bool atscppapi::HeaderField::operator= ( const char *  field_value  ) 

Set the VALUES of the header field to the given value string.

Parameters:
the values to set on the current header field
Returns:
true if the value is sucessfully changed.
bool atscppapi::HeaderField::operator= ( const std::string &  field_value  ) 

Set the VALUES of the header field to the given value string.

Parameters:
string - the values to set on the current header field
Returns:
true if the value is sucessfully changed.
bool atscppapi::HeaderField::operator== ( const std::string &  field_name  )  const

Compares the name of the header field only (not the values).

Note:
This is a case insensitive comparison.
Returns:
true if the name is equal (case insensitive comparison).
bool atscppapi::HeaderField::operator== ( const char *  field_name  )  const

Compares the name of the header field only (not the values).

Note:
This is a case insensitive comparison.
Returns:
true if the name is equal (case insensitive comparison).
std::string atscppapi::HeaderField::operator[] ( const int  index  ) 

Get the index value from this HeaderField.

Parameters:
the index to retrieve a copy of
Returns:
a copy of the string which is the index^th value in this HeaderField
Note:
as currently written this returns an immutable string, it will NOT allow you to change the value.
bool atscppapi::HeaderField::setName ( const std::string &  str  ) 

Change the name of this HeaderField to the given key.

Parameters:
string - the new name of the header field
Returns:
true if the header field name was successfully changed.
size_type atscppapi::HeaderField::size (  )  const

Get the size of the HeaderField, this is the number of values associated with the header field.

Returns:
the number of values in this HeaderField.
std::string atscppapi::HeaderField::str (  ) 

Get a string representing all the header field's values.

Returns:
a string representation of all the header fields
std::string atscppapi::HeaderField::values ( const char *  join = ","  ) 

Join all the values of this HeaderField into a single string seperated by the join string.

Parameters:
an optional join string (defaults to ",")
Returns:
a string which is all of the joined values of this HeaderField
std::string atscppapi::HeaderField::values ( const std::string &  join  ) 

Join all the values of this HeaderField into a single string seperated by the join string.

Parameters:
a join string
Returns:
a string which is all of the joined values of this HeaderField
std::string atscppapi::HeaderField::values ( const char  join  ) 

Join all the values of this HeaderField into a single string seperated by the join string.

Parameters:
a optional join character
Returns:
a string which is all of the joined values of this HeaderField

Friends And Related Function Documentation

friend class header_field_iterator [friend]

Definition at line 390 of file Headers.h.

friend class Headers [friend]

Definition at line 389 of file Headers.h.

std::ostream& operator<< ( std::ostream &  os,
HeaderField obj 
) [friend]

Get a string representing all the header field's values.

Returns:
a string representation of all the header fields

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