예제 #1
0
void LLBC_Dictionary::SerializeInl(LLBC_Stream &s, bool extended) const
{
    LLBC_STREAM_BEGIN_WRITE(s);

    LLBC_STREAM_WRITE(static_cast<uint64>(_bucketSize));

    LLBC_STREAM_WRITE(static_cast<uint64>(_size));

    ConstIter it = this->Begin(), endIt = this->End();
    for (; it != endIt; it++)
    {
        const LLBC_DictionaryElem *elem = it.Elem();

        const uint8 intKeyFlag = elem->IsIntKey() ? 1 : 0;
        LLBC_STREAM_WRITE(intKeyFlag);

        if (intKeyFlag)
        {
            LLBC_STREAM_WRITE(elem->GetIntKey());
        }
        else
        {
            !extended ? s.Write(
                *elem->GetStrKey()) : s.WriteEx(*elem->GetStrKey());
        }

        !extended ? s.Write(*it) : s.WriteEx(*it);
    }

    LLBC_STREAM_END_WRITE();
}
예제 #2
0
파일: Array.cpp 프로젝트: lailongwei/llbc
void LLBC_Array::SerializeInl(LLBC_Stream &s, bool extended) const
{
    LLBC_STREAM_BEGIN_WRITE(s);

    LLBC_STREAM_WRITE(static_cast<uint64>(_size));

    ConstIter it = Begin(), endIt = End();
    for (; it != endIt; it++)
    {
        if (!extended)
        {
            LLBC_STREAM_WRITE(*it);
        }
        else
        {
            LLBC_STREAM_WRITE_EX(*it);
        }
    }

    LLBC_STREAM_END_WRITE();
}