| Return Type | Function name | Arguments |
|---|---|---|
| hzString | hzString::SubString | (unsigned int,unsigned int,) |
Declared in file: hzString.h
Defined in file : hzString.cpp
Function Logic:
Function body:
hzString hzString::SubString (unsigned int nPosn, unsigned int nBytes)
{
_hzfunc("hzString::SubString") ;
_strItem* thisCtl ;
_strItem* destCtl ;
hzString Dest ;
uint32_t nRemainder ;
if (!m_addr)
return Dest ;
thisCtl = (_strItem*) _strXlate(m_addr) ;
nRemainder = Length() - nPosn ;
if (nRemainder <&eq; 0)
return Dest ;
if (nBytes == 0)
nBytes = nRemainder ;
if (nBytes > nRemainder)
nBytes = nRemainder ;
Dest.m_addr = _strAlloc(nBytes) ;
if (!Dest.m_addr)
hzexit(E_MEMORY, "Buffer of (%d) bytes", nBytes) ;
destCtl = (_strItem*) _strXlate(Dest.m_addr) ;
destCtl->_setSize(nBytes) ;
memcpy(destCtl->_data(), thisCtl->_data() + nPosn, nBytes) ;
destCtl->m_copy = 1;
return Dest ;
}