Ejemplo n.º 1
0
// CheckForHalt
bool COpcTextReader::CheckForHalt(COpcText& cToken, UINT uPosition)
{
    // check if max chars exceeded.
    if (cToken.GetMaxChars() > 0)
    {
        if (cToken.GetMaxChars() <= uPosition)
        {
            return false;
        }
    }

    // check for end of data - halts if EOF is not a delim.
    if (uPosition >= m_uEndOfData)
    {
        cToken.SetEof();
        return !cToken.GetEofDelim();
    }

    // check for one of halt characters.
    LPCWSTR szHaltChars = cToken.GetHaltChars();

    if (szHaltChars == NULL)
    {
        return false;
    }

    UINT uCount = wcslen(szHaltChars);

    for (UINT ii = 0; ii < uCount; ii++)
    {
        if (IsEqual(cToken, m_szBuf[uPosition], szHaltChars[ii]))
        {
            cToken.SetHaltChar(szHaltChars[ii]);
            return true;
        }
    }

    return false;
}