Public Types | Public Member Functions | Private Member Functions | Private Attributes

dialog::ContainerRequest Class Reference
[Dialog Library]

object to help construct dialog request streams More...

#include <request.h>

List of all members.

Public Types

enum  eAxis {
  eAxis_Horizontal = 1,
  eAxis_Vertical = 2
}

Public Member Functions

 ContainerRequest (eAxis axis=eAxis_Vertical)
std::string get (void)
void addLabel (const char *label)
void addButton (const char *submit, const char *label)
void addTextbox (const char *name, const char *value, int max, bool encrypted=false)
void addContainer (ContainerRequest &cr)
void addCustom (const char *string)
 raw access to stream!

smart_ptr< DatahashgetDatahash (void)

Private Member Functions

void close (void)

Private Attributes

bool m_closed
std::ostringstream m_stream

Detailed Description

object to help construct dialog request streams

It is recommended that callers use this object instead of directly creating text streams! This way your code is relatively insulated if elements add new attributes, etc. The code is also easier to write and maintain.

Typical usage is to create a ContainerRequest, add a bunch of stuff, and then call get() to retrieve the string that represents the dialog stream.

Once you call get(), the ContainerRequest is considered closed. Any additional attempts to add data to the container is a programming failure and the program will hard stop.

If you want to recursively add subcontainers (nested elements within the dialog), create separate ContainerRequest objects for each child container and add them to the parent container with addContainer(). Note that adding a ContainerRequest to a parent has the side-effect of closing the child container.

Definition at line 69 of file dialog/request.h.


Member Enumeration Documentation

Enumerator:
eAxis_Horizontal 
eAxis_Vertical 

Definition at line 72 of file dialog/request.h.


Constructor & Destructor Documentation

dialog::ContainerRequest::ContainerRequest ( eAxis  axis = eAxis_Vertical  )  [inline]

Definition at line 78 of file dialog/request.h.


Member Function Documentation

std::string dialog::ContainerRequest::get ( void   )  [inline]

Definition at line 86 of file dialog/request.h.

smart_ptr< Datahash > dialog::ContainerRequest::getDatahash ( void   ) 

Definition at line 70 of file dialog.cpp.

void dialog::ContainerRequest::addLabel ( const char *  label  )  [inline]

Definition at line 93 of file dialog/request.h.

void dialog::ContainerRequest::addButton ( const char *  submit,
const char *  label 
) [inline]

Definition at line 102 of file dialog/request.h.

void dialog::ContainerRequest::addTextbox ( const char *  name,
const char *  value,
int  max,
bool  encrypted = false 
) [inline]

Definition at line 113 of file dialog/request.h.

void dialog::ContainerRequest::addContainer ( ContainerRequest cr  )  [inline]

Definition at line 130 of file dialog/request.h.

void dialog::ContainerRequest::addCustom ( const char *  string  )  [inline]

raw access to stream!

Definition at line 138 of file dialog/request.h.

void dialog::ContainerRequest::close ( void   )  [inline, private]

Definition at line 144 of file dialog/request.h.


Member Data Documentation

Definition at line 151 of file dialog/request.h.

std::ostringstream dialog::ContainerRequest::m_stream [private]

Definition at line 152 of file dialog/request.h.


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