Sets a string value to the supplied value and places it in the hzHttpEvent's map of string values. Note that if there is a chain value of the same name, this is not allowed. Note that the hzHttpEvent is very short lived. An instance is populated by a HTTP request, passed to the event handler ProcHTTP(), which processes it to formulate a response. Then one of its member functions is called to write out that response to the client socket. The only purpose in setting a value in the event's m_mapStrings member, is to influence the output by means of a percent-entity of the form [%e:var_name;] that is assumed to exist in the page template being served.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzHttpEvent::SetVarString | (hzString&,hzString&,) |
Declared in file: hzHttpServer.h
Defined in file : hzHttpServer.cpp
Function Logic:
Function body:
hzEcode hzHttpEvent::SetVarString (hzString& name)hzString& value,
{
// Sets a string value to the supplied value and places it in the hzHttpEvent's map of string values. Note that if there is a chain value
// of the same name, this is not allowed.
//
// Note that the hzHttpEvent is very short lived. An instance is populated by a HTTP request, passed to the event handler ProcHTTP(), which processes it to
// formulate a response. Then one of its member functions is called to write out that response to the client socket. The only purpose in setting a value in
// the event's m_mapStrings member, is to influence the output by means of a percent-entity of the form [%e:var_name;] that is assumed to exist in the page
// template being served.
//
// Arguments: 1) name The variable name.
// 2) value The variable value as a string
//
// Returns: E_ARGUMENT If the name is not supplied
// E_DUPLICATE If the name is already used
// E_OK If the variable was added
_hzfunc("hzHttpEvent::SetVariable[2]") ;
if (!name)
return hzerr(E_ARGUMENT, "Blank variable names are not allowed") ;
if (m_mapStrings.Exists(name))
m_mapStrings[name] = value ;
else
{
if (m_mapChains.Exists(name))
return hzerr(E_DUPLICATE, "Cannot assign value to an existing chain") ;
if (m_mapStrings.Insert(name, value) != E_OK)
return hzerr(E_MEMORY, "Could not insert variable %s", *name) ;
}
return E_OK ;
}