示例#1
0
OVRError::OVRError(ovrResult code, const char* pFormat, ...)
    : OVRError(code)
{
    va_list argList;
    va_start(argList, pFormat);
    StringBuffer strbuff;
    strbuff.AppendFormatV(pFormat, argList);
    SetDescription(strbuff.ToCStr());
    va_end(argList);
}
示例#2
0
OVRError MakeError(ovrResult errorCode, ovrSysErrorCode sysCode, const char* pSourceFile,
                    int sourceLine, bool logError, bool assertError, const char* pContext, const char* pDescriptionFormat, ...)
{
    OVRError ovrError(errorCode);

    ovrError.SetCurrentValues(); // Sets the current time, etc.

    ovrError.SetSysCode(sysCode);

    va_list argList;
    va_start(argList, pDescriptionFormat);
    StringBuffer strbuff;
    strbuff.AppendFormatV(pDescriptionFormat, argList);
    va_end(argList);
    ovrError.SetDescription(strbuff.ToCStr());

    ovrError.SetContext(pContext);

    ovrError.SetSource(pSourceFile, sourceLine);

    // Set the TLS last error.
    LastErrorTLS::GetInstance()->LastError() = ovrError;

    int silencerOptions = ovrlog::ErrorSilencer::GetSilenceOptions();
    if (silencerOptions & ovrlog::ErrorSilencer::CompletelySilenceLogs)
    {
        logError = false;
    }
    if (silencerOptions & ovrlog::ErrorSilencer::PreventErrorAsserts)
    {
        assertError = false;
    }

    // If logging the error:
    if (logError)
    {
        Logger.LogError(ovrError.GetDescription().ToCStr());
    }

    // If asserting the error:
    if (assertError)
    {
        // Assert in debug mode to alert unit tester/developer of the error as it occurs.
        OVR_FAIL_M(ovrError.GetDescription().ToCStr());
    }

    if (ErrorCallback)
    {
        const bool quiet = !logError && !assertError;
        ErrorCallback(ovrError, quiet);
    }

    return ovrError;
}
String::String(const StringBuffer& src)
{
    pData = AllocDataCopy1(src.GetSize(), 0, src.ToCStr(), src.GetSize());
}
StringBuffer::StringBuffer(const StringBuffer& src)
    : pData(NULL), Size(0), BufferSize(src.GetGrowSize()), GrowSize(OVR_SBUFF_DEFAULT_GROW_SIZE), LengthIsSize(false)
{
    AppendString(src.ToCStr(), src.GetSize());
    LengthIsSize = src.LengthIsSize;
}
void    String::operator = (const StringBuffer& src)
{ 
    DataDesc* polddata = GetData();    
    SetData(AllocDataCopy1(src.GetSize(), 0, src.ToCStr(), src.GetSize()));
    polddata->Release();
}
void      StringBuffer::operator = (const StringBuffer& src)
{
	Clear();
	AppendString(src.ToCStr(), src.GetSize());
}