Sets a chain value to the supplied chain and places it in the hzHttpEvent's map of chain values. Note that if there is a string 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_mapChains 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::SetVarChain | (hzString&,hzChain&,) |
Declared in file: hzHttpServer.h
Defined in file : hzHttpServer.cpp
Function Logic:
Function body:
hzEcode hzHttpEvent::SetVarChain (hzString& name)hzChain& Z,
{
// Sets a chain value to the supplied chain and places it in the hzHttpEvent's map of chain values. Note that if there is a string 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_mapChains 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::SetVar(chain)") ;
if (!name)
return hzerr(E_ARGUMENT, "Blank variable names are not allowed") ;
if (m_mapChains.Exists(name))
{
m_mapChains[name].Clear() ;
m_mapChains[name] = Z ;
}
else
{
if (m_mapStrings.Exists(name))
return hzerr(E_DUPLICATE, "Cannot assign value to an existing string") ;
if (m_mapChains.Insert(name, Z) != E_OK)
return hzerr(E_MEMORY, "Could not insert variable %s", *name) ;
}
return E_OK ;
}