当前位置: 首页>>代码示例>>C++>>正文


C++ DataDesc::GetSize方法代码示例

本文整理汇总了C++中DataDesc::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ DataDesc::GetSize方法的具体用法?C++ DataDesc::GetSize怎么用?C++ DataDesc::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataDesc的用法示例。


在下文中一共展示了DataDesc::GetSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetFirstCharAt

UInt32 String::GetFirstCharAt(UPInt index, const char** offset) const
{
    DataDesc*   pdata = GetData();
    SPInt       i = (SPInt) index;
    const char* buf = pdata->Data;
    const char* end = buf + pdata->GetSize();
    UInt32      c;

    do 
    {
        c = UTF8Util::DecodeNextChar_Advance0(&buf);
        i--;

        if (buf >= end)
        {
            // We've hit the end of the string; don't go further.
            OVR_ASSERT(i == 0);
            return c;
        }
    } while (i >= 0);

    *offset = buf;

    return c;
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:ofxOculusRift,代码行数:25,代码来源:OVR_String.cpp

示例2: String

String   String::Substring(UPInt start, UPInt end) const
{
    UPInt length = GetLength();
    if ((start >= length) || (start >= end))
        return String();   

    DataDesc* pdata = GetData();
    
    // If size matches, we know the exact index range.
    if (pdata->LengthIsSize())
        return String(pdata->Data + start, end - start);
    
    // Get position of starting character.
    SPInt byteStart = UTF8Util::GetByteIndex(start, pdata->Data, pdata->GetSize());
    SPInt byteSize  = UTF8Util::GetByteIndex(end - start, pdata->Data + byteStart, pdata->GetSize()-byteStart);
    return String(pdata->Data + byteStart, (UPInt)byteSize);
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:ofxOculusRift,代码行数:17,代码来源:OVR_String.cpp

示例3: GetCharAt

UInt32 String::GetCharAt(UPInt index) const 
{  
    SPInt       i = (SPInt) index;
    DataDesc*   pdata = GetData();
    const char* buf = pdata->Data;
    UInt32      c;
    
    if (pdata->LengthIsSize())
    {
        OVR_ASSERT(index < pdata->GetSize());
        buf += i;
        return UTF8Util::DecodeNextChar_Advance0(&buf);
    }

    c = UTF8Util::GetCharAt(index, buf, pdata->GetSize());
    return c;
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:ofxOculusRift,代码行数:17,代码来源:OVR_String.cpp

示例4: GetData

void    String::operator += (const String& src)
{
    DataDesc   *pourData = GetData(),
               *psrcData = src.GetData();
    UPInt       ourSize  = pourData->GetSize(),
                srcSize  = psrcData->GetSize();
    UPInt       lflag    = pourData->GetLengthFlag() & psrcData->GetLengthFlag();

    SetData(AllocDataCopy2(ourSize + srcSize, lflag,
                           pourData->Data, ourSize, psrcData->Data, srcSize));
    pourData->Release();
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:ofxOculusRift,代码行数:12,代码来源:OVR_String.cpp

示例5: AppendString

void String::AppendString(const char* putf8str, SPInt utf8StrSz)
{
    if (!putf8str || !utf8StrSz)
        return;
    if (utf8StrSz == -1)
        utf8StrSz = (SPInt)OVR_strlen(putf8str);

    DataDesc*   pdata = GetData();
    UPInt       oldSize = pdata->GetSize();

    SetData(AllocDataCopy2(oldSize + (UPInt)utf8StrSz, 0,
                           pdata->Data, oldSize, putf8str, (UPInt)utf8StrSz));
    pdata->Release();
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:ofxOculusRift,代码行数:14,代码来源:OVR_String.cpp

示例6: AppendChar

void String::AppendChar(UInt32 ch)
{
    DataDesc*   pdata = GetData();
    UPInt       size = pdata->GetSize();
    char        buff[8];
    SPInt       encodeSize = 0;

    // Converts ch into UTF8 string and fills it into buff.   
    UTF8Util::EncodeChar(buff, &encodeSize, ch);
    OVR_ASSERT(encodeSize >= 0);

    SetData(AllocDataCopy2(size + (UPInt)encodeSize, 0,
                           pdata->Data, size, buff, (UPInt)encodeSize));
    pdata->Release();
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:ofxOculusRift,代码行数:15,代码来源:OVR_String.cpp

示例7: GetLength

UPInt String::GetLength() const 
{
    // Optimize length accesses for non-UTF8 character strings. 
    DataDesc* pdata = GetData();
    UPInt     length, size = pdata->GetSize();
    
    if (pdata->LengthIsSize())
        return size;    
    
    length = (UPInt)UTF8Util::GetLength(pdata->Data, (UPInt)size);
    
    if (length == size)
        pdata->Size |= String_LengthIsSize;
    
    return length;
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:ofxOculusRift,代码行数:16,代码来源:OVR_String.cpp


注:本文中的DataDesc::GetSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。