ACE_INet 8.0.1
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Attributes | Private Types | Private Attributes | List of all members
ACE::INet::HeaderBase Class Reference

#include <HeaderBase.h>

Inheritance diagram for ACE::INet::HeaderBase:
Inheritance graph
[legend]
Collaboration diagram for ACE::INet::HeaderBase:
Collaboration graph
[legend]

Public Member Functions

 HeaderBase ()
 Constructor.
 
virtual ~HeaderBase ()
 Destructor.
 
virtual void set_content_length (int length)
 
virtual int get_content_length () const
 
virtual void set_content_type (const ACE_CString &mime_type)
 
virtual ACE_CString get_content_type () const
 
void clear ()
 
virtual void write (std::ostream &str) const
 Writes the headers to the given stream.
 
virtual bool read (std::istream &str)
 
void set (const ACE_CString &name, const ACE_CString &value)
 Sets header name to value. Overwrites existing vaues.
 
void add (const ACE_CString &name, const ACE_CString &value)
 Adds header name with value. Allows duplicates.
 
void remove (const ACE_CString &name)
 Removes header name (first found).
 
bool get (const ACE_CString &name, ACE_CString &value) const
 Retrieves value for header name into value (first found).
 
bool has (const ACE_CString &name) const
 Returns true if a header name exists (1 or more), false otherwise.
 
void get_values (const ACE_CString &name, ACE_Array< ACE_CString > &values) const
 Retrieves values for all headers name into values.
 

Static Public Attributes

static const int UNKNOWN_CONTENT_LENGTH = -1
 
static const ACE_CString UNKNOWN_CONTENT_TYPE
 
static const ACE_CString CONTENT_LENGTH = "Content-Length"
 
static const ACE_CString CONTENT_TYPE = "Content-Type"
 
static const ACE_CString EMPTY
 

Protected Member Functions

int read_field (std::istream &str, ACE_CString &var, size_t maxlen, char delim)
 
int read_ws_field (std::istream &str, ACE_CString &var, size_t maxlen)
 

Static Protected Attributes

static const int eof_ = std::char_traits<char>::eof()
 

Private Types

enum  Limits { MAX_NAME_LENGTH = 256 , MAX_VALUE_LENGTH = 4096 }
 Limits for reading a header. More...
 

Private Attributes

TNVMap header_values_
 

Member Enumeration Documentation

◆ Limits

Limits for reading a header.

Enumerator
MAX_NAME_LENGTH 
MAX_VALUE_LENGTH 

Constructor & Destructor Documentation

◆ HeaderBase()

ACE::INet::HeaderBase::HeaderBase ( )

Constructor.

◆ ~HeaderBase()

ACE::INet::HeaderBase::~HeaderBase ( )
virtual

Destructor.

Member Function Documentation

◆ add()

void ACE::INet::HeaderBase::add ( const ACE_CString & name,
const ACE_CString & value )
inline

Adds header name with value. Allows duplicates.

◆ clear()

void ACE::INet::HeaderBase::clear ( )
inline

◆ get()

bool ACE::INet::HeaderBase::get ( const ACE_CString & name,
ACE_CString & value ) const
inline

Retrieves value for header name into value (first found).

◆ get_content_length()

int ACE::INet::HeaderBase::get_content_length ( ) const
inlinevirtual

Returns the content length for this message. Returns UNKNOWN_CONTENT_LENGTH if no Content-Length header is present.

◆ get_content_type()

ACE_CString ACE::INet::HeaderBase::get_content_type ( ) const
inlinevirtual

Returns the content type for this message. Returns UNKNOWN_CONTENT_TYPE if no Content-Type header is present.

◆ get_values()

void ACE::INet::HeaderBase::get_values ( const ACE_CString & name,
ACE_Array< ACE_CString > & values ) const

Retrieves values for all headers name into values.

◆ has()

bool ACE::INet::HeaderBase::has ( const ACE_CString & name) const
inline

Returns true if a header name exists (1 or more), false otherwise.

◆ read()

bool ACE::INet::HeaderBase::read ( std::istream & str)
virtual

Reads the headers from the given stream.

Reimplemented in ACE::HTTP::Request, and ACE::HTTP::Response.

◆ read_field()

int ACE::INet::HeaderBase::read_field ( std::istream & str,
ACE_CString & var,
size_t maxlen,
char delim )
inlineprotected

◆ read_ws_field()

int ACE::INet::HeaderBase::read_ws_field ( std::istream & str,
ACE_CString & var,
size_t maxlen )
inlineprotected

◆ remove()

void ACE::INet::HeaderBase::remove ( const ACE_CString & name)
inline

Removes header name (first found).

◆ set()

void ACE::INet::HeaderBase::set ( const ACE_CString & name,
const ACE_CString & value )

Sets header name to value. Overwrites existing vaues.

◆ set_content_length()

void ACE::INet::HeaderBase::set_content_length ( int length)
virtual

Sets the Content-Length header. Removes the Content-Length header if length is UNKNOWN_CONTENT_LENGTH.

◆ set_content_type()

void ACE::INet::HeaderBase::set_content_type ( const ACE_CString & mime_type)
inlinevirtual

Sets the content type for this message. Removes the Content-Type header if UNKNOWN_CONTENT_TYPE is specified.

◆ write()

void ACE::INet::HeaderBase::write ( std::ostream & str) const
virtual

Writes the headers to the given stream.

Reimplemented in ACE::HTTP::Request, and ACE::HTTP::Response.

Member Data Documentation

◆ CONTENT_LENGTH

const ACE_CString ACE::INet::HeaderBase::CONTENT_LENGTH = "Content-Length"
static

◆ CONTENT_TYPE

const ACE_CString ACE::INet::HeaderBase::CONTENT_TYPE = "Content-Type"
static

◆ EMPTY

const ACE_CString ACE::INet::HeaderBase::EMPTY
static

◆ eof_

const int ACE::INet::HeaderBase::eof_ = std::char_traits<char>::eof()
staticprotected

◆ header_values_

TNVMap ACE::INet::HeaderBase::header_values_
private

◆ UNKNOWN_CONTENT_LENGTH

const int ACE::INet::HeaderBase::UNKNOWN_CONTENT_LENGTH = -1
static

◆ UNKNOWN_CONTENT_TYPE

const ACE_CString ACE::INet::HeaderBase::UNKNOWN_CONTENT_TYPE
static

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