Return Type | Function name | Arguments |
---|---|---|
hzString& | hzString::Reverse | (void) |
Declared in file: hzString.h
Defined in file : hzString.cpp
Function Logic:
Function body:
hzString& hzString::Reverse (void) { _hzfunc("hzString::Reverse") ; _strItem* thisCtl ; _strItem* destCtl ; char* pTgt ; char* pSrc ; uint32_t destAddr ; uint32_t nLen ; uint32_t c_up ; uint32_t c_down ; if (!m_addr) return *this ; thisCtl = (_strItem*) _strXlate(m_addr) ; nLen = thisCtl->_getSize() ; destAddr = _strAlloc(nLen) ; destCtl = (_strItem*) _strXlate(destAddr) ; destCtl->_setSize(nLen) ; destCtl->m_copy = 1; c_down = nLen - 1; pSrc = thisCtl->_data() ; pTgt = destCtl->_data() ; for (c_up = 0; c_up < c_down ; c_up++, c_down--) { pTgt[c_up] = pSrc[c_down] ; } if (thisCtl->m_copy && thisCtl->m_copy < 50) { if (!_hzGlobal_MT) { thisCtl->m_copy-- ; if (!thisCtl->m_copy) _strFree(m_addr, thisCtl->_getSize()) ; } else { thisCtl->m_copy-- ; if (!thisCtl->m_copy) _strFree(m_addr, thisCtl->_getSize()) ; } } m_addr = destAddr ; return *this ; }