rpparser.cpp

来自「symbian 下的helix player源代码」· C++ 代码 · 共 1,582 行 · 第 1/5 页

CPP
1,582
字号
                            {
                                pEffect->SetStart(ulTmp);
                            }
                        }
                        break;
                    case kAttrDuration:
                        {
                            UINT32 ulTmp = 0;
                            retVal       = ConvertTimeValue(pAttrValue, m_pRealPixFile->GetTimeFormat(), ulTmp);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetDuration(ulTmp);
                            }
                        }
                        break;
                    case kAttrTarget:
                        {
                            bNeedLastTarget = FALSE;
                            UINT32 ulTmp    = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetTarget(ulTmp);
                        }
                        break;
                    case kAttrSrcx:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetSrcX(ulTmp);
                        }
                        break;
                    case kAttrSrcy:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetSrcY(ulTmp);
                        }
                        break;
                    case kAttrSrcw:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetSrcWidth(ulTmp);
                        }
                        break;
                    case kAttrSrch:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetSrcHeight(ulTmp);
                        }
                        break;
                    case kAttrStartsrcx:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetStartSrcX(ulTmp);
                            bNeedLastRects = FALSE;
                            ulMinVer       = REDSTONE_VERSION;
                        }
                        break;
                    case kAttrStartsrcy:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetStartSrcY(ulTmp);
                            bNeedLastRects = FALSE;
                            ulMinVer       = REDSTONE_VERSION;
                        }
                        break;
                    case kAttrStartsrcw:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetStartSrcWidth(ulTmp);
                            bNeedLastRects = FALSE;
                            ulMinVer       = REDSTONE_VERSION;
                        }
                        break;
                    case kAttrStartsrch:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetStartSrcHeight(ulTmp);
                            bNeedLastRects = FALSE;
                            ulMinVer       = REDSTONE_VERSION;
                        }
                        break;
                    case kAttrDstx:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetDstX(ulTmp);
                        }
                        break;
                    case kAttrDsty:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetDstY(ulTmp);
                        }
                        break;
                    case kAttrDstw:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetDstWidth(ulTmp);
                        }
                        break;
                    case kAttrDsth:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetDstHeight(ulTmp);
                        }
                        break;
                    case kAttrStartdstx:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetStartDstX(ulTmp);
                            bNeedLastRects = FALSE;
                            ulMinVer       = REDSTONE_VERSION;
                        }
                        break;
                    case kAttrStartdsty:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetStartDstY(ulTmp);
                            bNeedLastRects = FALSE;
                            ulMinVer       = REDSTONE_VERSION;
                        }
                        break;
                    case kAttrStartdstw:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetStartDstWidth(ulTmp);
                            bNeedLastRects = FALSE;
                            ulMinVer       = REDSTONE_VERSION;
                        }
                        break;
                    case kAttrStartdsth:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetDstHeight(ulTmp);
                            bNeedLastRects = FALSE;
                            ulMinVer       = REDSTONE_VERSION;
                        }
                        break;
                    case kAttrUrl:
                        {
                            retVal = CheckStringContents(pAttrValue);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetURL((const char*) pAttrValue->GetBuffer());
                            }
                            else
                            {
                                if (m_ulStrictnessLevel == REALPIX_STRICTNESS_LOW ||
                                    m_ulStrictnessLevel == REALPIX_STRICTNESS_MEDIUM)
                                {
                                    bThrowError = FALSE;
                                }
                            }
                        }
                        break;
                    case kAttrMaxfps:
                        {
                            UINT32 ulTmp = strtoul((const char*) pAttrValue->GetBuffer(), NULL, 10);
                            pEffect->SetMaxFps(ulTmp);
                        }
                        break;
                    case kAttrAspect:
                        {
                            BOOL bTmp = FALSE;
                            retVal    = ConvertBoolValue(pAttrValue, bTmp);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetAspectFlag(bTmp);
                            }
                        }
                        break;
                    case kAttrCenter:
                        {
                            BOOL bTmp = FALSE;
                            retVal    = ConvertBoolValue(pAttrValue, bTmp);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetCenterFlag(bTmp);
                                ulMinVer = REDSTONE_VERSION;
                            }
                        }
                        break;
                    case kAttrBackgroundcolor:
                        ulMinVer = REDSTONE_VERSION;
                    case kAttrColor:
                        {
                            BYTE ucRed   = 0;
                            BYTE ucGreen = 0;
                            BYTE ucBlue  = 0;
                            retVal       = ConvertColorValue(pAttrValue, ucRed, ucGreen, ucBlue);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetColor(ucRed, ucGreen, ucBlue);
                            }
                        }
                        break;
                    case kAttrDirection:
                        {
                            BYTE ucTmp = 0;
                            retVal     = ConvertWipeDirectionValue(pAttrValue, ucTmp);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetWipeDirection(ucTmp);
                            }
                        }
                        break;
                    case kAttrType:
                        {
                            BYTE ucTmp = 0;
                            retVal     = ConvertWipeTypeValue(pAttrValue, ucTmp);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetWipeType(ucTmp);
                            }
                        }
                        break;
                    case kAttrPackage:
                        {
                            retVal = CheckStringContents(pAttrValue);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetExFxPackage((const char*) pAttrValue->GetBuffer());
                            }
                        }
                        break;
                    case kAttrName:
                        {
                            retVal = CheckStringContents(pAttrValue);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetExFxName((const char*) pAttrValue->GetBuffer());
                            }
                        }
                        break;
                    case kAttrData:
                        {
                            retVal = CheckStringContents(pAttrValue);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetExFxData((const char*) pAttrValue->GetBuffer());
                            }
                        }
                        break;
                    case kAttrFile:
                        {
                            retVal = CheckStringContents(pAttrValue);
                            if (SUCCEEDED(retVal))
                            {
                                pEffect->SetExFxFile((const char*) pAttrValue->GetBuffer());
                            }
                        }
                        break;
                }

                if (SUCCEEDED(retVal) ||
                    (FAILED(retVal) && !bThrowError))
                {
                    if (FAILED(retVal))
                    {
                        if (m_ulStrictnessLevel >= REALPIX_STRICTNESS_MEDIUM)
                        {
                            // We detected bad syntax but were told not to throw an error,
                            // so we will log a warning instead.
                            IHXBuffer* pErr = NULL;
                            SetError(IDS_ERR_PIX_BADATTRVALUE, ulLine, ulCol, pszAttrName, pszTagName, pErr);
                            ReportError(HXLOG_WARNING, HXR_OK, pErr);
                            HX_RELEASE(pErr);
                        }
                    }

                    retVal = CheckVersion(ulMinVer);
                    if (SUCCEEDED(retVal))
                    {
                        // Get the next attribute
                        HX_RELEASE(pAttrValue);
                        if (SUCCEEDED(retVal))
                        {
                            rv = pAttr->GetNextPropertyCString(pszAttrName, pAttrValue);
                        }
                    }
                    else
                    {
                        SetError(IDS_ERR_PIX_INCOMPATVERSION, ulLine, ulCol, (const char*) pAttrValue->GetBuffer(), NULL, rpError);
                    }
                }
                else
                {
                    SetError(IDS_ERR_PIX_BADATTRVALUE, ulLine, ulCol, pszAttrName, pszTagName, rpError);
                }
            }
            HX_RELEASE(pAttrValue);

            if (SUCCEEDED(retVal))
            {
                // Here we do the hack to make sure that viewchange effects get the proper target
                if (pEffect->GetEffectType() == PXEffect::kEffectTypeViewChange &&
                    pEffect->GetTarget()     == 0                               &&
                    m_pLastEffect                                               &&
                    bNeedLastTarget)
                {
                    if (m_pLastEffect->HasTarget())
                    {
                        pEffect->SetTarget(m_pLastEffect->GetTarget());
                    }
                }
                // Here we do the hack to make sure that viewchange effects get the proper start rects
                if (pEffect->GetEffectType() == PXEffect::kEffectTypeViewChange &&
                    m_pLastEffect                                               &&
                    bNeedLastRects)
                {
                    if (m_pLastEffect->HasTarget())
                    {
                        pEffect->SetStartSrcRect(m_pLastEffect->GetSrcRect());
                    }
                    pEffect->SetStartDstRect(m_pLastEffect->GetDstRect());
                }
                // Part of the hack requires we save the last effect
            

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?