bool MTContactHandler::SetContactName(int nContactID, QString contact_name_string)
{
    QMutexLocker locker(&m_Mutex);

    QString encoded_name("");

    if (!contact_name_string.isEmpty())
    {
//        qDebug() << QString("About to encode name: %1").arg(contact_name_string);

        //encode
        OTString     strName(contact_name_string.toStdString());
        OTASCIIArmor ascName(strName);
        encoded_name = QString(ascName.Get());
    }
    // ------------------------------------------
    QString str_update = QString("UPDATE `contact` SET `contact_display_name`='%1' WHERE `contact_id`='%2'").arg(encoded_name).arg(nContactID);

    return DBHandler::getInstance()->runQuery(str_update);
}
Esempio n. 2
0
bool CstrategyScans::bSetScanAxisValue(int iScan, const char* ccAxisName, double dValue)
{
    Cstring     strInputAxisName(ccAxisName);
    strInputAxisName.upcase();

    
    int             iAxis = -1;
    Cstring         strName("");
    
    for(iAxis=0; iAxis < (int)m_aoAxes.size(); iAxis++)
    {
        m_aoAxes[iAxis].vGetName(strName);

        strName.upcase();
        
        if( strName == strInputAxisName )
            break;  // axis name found!
    }
    
    return m_aoScans[iScan].bSetAxisValue(iAxis, dValue);   // if iAxis is ivalid, the return will be false
}
Esempio n. 3
0
    tstring Win32Certificate::getIssuerName()
    {
        DWORD bufferSize = CertNameToStr(
            X509_ASN_ENCODING,
            &mpCert->pCertInfo->Issuer,
            CERT_X500_NAME_STR,
            NULL,
            0);

        std::vector<TCHAR> buffer(bufferSize);

        bufferSize = CertNameToStr(
            X509_ASN_ENCODING,
            &mpCert->pCertInfo->Issuer,
            CERT_X500_NAME_STR,
            &buffer[0],
            bufferSize);

        tstring strName(&buffer[0]);
        return strName;
    }
Esempio n. 4
0
CMenu* CSkin::GetMenu(LPCTSTR pszName)
{
	CString strName( pszName );
	CMenu* pMenu = NULL;
	
	if ( m_pMenus.Lookup( strName, (void*&)pMenu ) ) return pMenu;

	for ( UINT nItem = 0 ; nItem < m_mnuDefault.GetMenuItemCount() ; nItem++ )
	{
		CString strItem;

		m_mnuDefault.GetMenuString( nItem, strItem, MF_BYPOSITION );

		if ( strItem.CompareNoCase( strName ) == 0 )
		{
			return m_mnuDefault.GetSubMenu( nItem );
		}
	}

	return NULL;
}
void XMLProtocolParser::handleGameInfo(tinyxml2::XMLElement *curChild)
{
    const tinyxml2::XMLAttribute *attr = curChild->FirstAttribute();
    while (attr != nullptr)
    {
        const char *valAttr = attr->Value();
        const char *valName = attr->Name();
        std::string strAttr(valAttr);
        std::string strName(valName);

        if (strName.compare("time") == 0)
        {
            this->gameData->refBox->lbl_time->setText(QString(valAttr));
        }
        else if (strName.compare("stage") == 0)
        {
            this->gameData->refBox->lbl_stage->setText(QString(valAttr));
        }
        attr = attr->Next();
    }
}
Esempio n. 6
0
// The contact ID (unlike all the other IDs) is an int instead of a string.
// Therefore we just convert it to a string and return it in a map in the same
// format as all the others.
// (FYI.)
//
bool MTContactHandler::GetContacts(mapIDName & theMap)
{
    QMutexLocker locker(&m_Mutex);

    QString str_select = QString("SELECT * FROM contact");

    bool bFoundAny = false;
    int  nRows     = DBHandler::getInstance()->querySize(str_select);

    for(int ii=0; ii < nRows; ii++)
    {
        int     contact_id   = DBHandler::getInstance()->queryInt   (str_select, 0, ii);
        QString contact_name = DBHandler::getInstance()->queryString(str_select, 1, ii);

        if (contact_id > 0)
        {
            bFoundAny = true;

            QString str_contact_id;
            str_contact_id = QString("%1").arg(contact_id);

            if (!contact_name.isEmpty())
            {
//                qDebug() << QString("About to decode name: %1").arg(contact_name);

                //Decode base64.
                OTASCIIArmor ascName;
                ascName.Set(contact_name.toStdString().c_str());
                OTString strName(ascName);
                contact_name = QString(strName.Get());
            }
            // --------------------------------------------------
            // At this point we have the contact ID (in string form) *and* the contact name.
            // So we can add them to our map...
            theMap.insert(str_contact_id, contact_name);
        }
    }
    // ---------------------------------------------------------------------
    return bFoundAny;
}
Esempio n. 7
0
void _stdcall OnNotifyStrikePrices( BSTR BProduct, BSTR BName, BSTR BCall, BSTR BPut, int nStrikePrice, int nYearMonth )
{
	if( m_nType == 5 )
	{
		CString strProduct(BProduct);
		CString strName(BName);
		CString strCall(BCall);
		CString strPut(BPut);

		CString strMsg;

		strMsg.Format(_T("%s %s  Call: %s  Put: %s  履約價:%d 年月:%d"),
			   strProduct,strName,strCall,strPut,nStrikePrice,nYearMonth);

		BSTR bstrMsg = strMsg.AllocSysString();

		SendMessage(FindWindow(NULL,_T("QuoteTester")),WM_DATA,m_nType,(int)bstrMsg);
		
		SysFreeString(bstrMsg);

	}
}
Esempio n. 8
0
void TreeItemData::Modify(wxListCtrl* pList, long item_id)
{
	Omega::string_t strName(pList->GetItemText(item_id).wc_str(),Omega::string_t::npos,true);
	
	Omega::any_t val = m_ptrKey->GetValue(strName);

	wxLongLong_t iv;
	if (val.GetType() != Omega::TypeInfo::typeString && val.Coerce(iv) != Omega::any_t::castUnrelated)
	{
		EditUIntDlg dialog(NULL,-1,wxT(""));

		dialog.m_nBase = 0;
		dialog.m_strName = wxString(strName.c_wstr());
		dialog.m_strValue = wxString::Format(wxT("%lld"),iv);

		if (dialog.ShowModal() == wxID_OK)
		{
			wxLongLong_t lVal;
			dialog.m_strValue.ToLongLong(&lVal,dialog.m_nBase==0 ? 16 : 10);
			m_ptrKey->SetValue(strName,lVal);

			pList->SetItem(item_id,2,wxString::Format(wxT("%lld"),lVal));
		}
	}
	else
	{
		EditStringDlg dialog(NULL,-1,wxT(""));

		dialog.m_strName = wxString(strName.c_wstr());
		dialog.m_strValue = wxString(m_ptrKey->GetValue(strName).cast<Omega::string_t>().c_wstr());

		if (dialog.ShowModal() == wxID_OK)
		{
			m_ptrKey->SetValue(strName,Omega::string_t(dialog.m_strValue.wc_str(),Omega::string_t::npos));

			pList->SetItem(item_id,2,dialog.m_strValue);
		}
	}
}
void XMLProtocolParser::handleSetup(tinyxml2::XMLElement *curChild)
{
    const tinyxml2::XMLAttribute *attr = curChild->FirstAttribute();
    while (attr != nullptr)
    {
        const char *valAttr = attr->Value();
        const char *valName = attr->Name();
        std::string strAttr(valAttr);
        std::string strName(valName);

        if (strName.compare("name") == 0)
        {
            fillSetup(valAttr);
        }
        else if (strName.compare("leader") == 0)
        {
            fillSetup(valAttr);
        }

        attr = attr->Next();
    }
}
Esempio n. 10
0
// -------------------------------------------------------------------
//	Creates a material from loaded data.
void ObjFileMtlImporter::createMaterial()
{	
	std::string strName( "" );
	m_DataIt = getName<DataArrayIt>( m_DataIt, m_DataItEnd, strName );
	if ( m_DataItEnd == m_DataIt )
		return;

	std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( strName );
	if ( m_pModel->m_MaterialMap.end() == it)
	{
		// New Material created
		m_pModel->m_pCurrentMaterial = new ObjFile::Material();	
		m_pModel->m_pCurrentMaterial->MaterialName.Set( strName );
		m_pModel->m_MaterialLib.push_back( strName );
		m_pModel->m_MaterialMap[ strName ] = m_pModel->m_pCurrentMaterial;
	}
	else
	{
		// Use older material
		m_pModel->m_pCurrentMaterial = (*it).second;
	}
}
Esempio n. 11
0
bool CProperties::LoadFromCommandString(LPCTSTR psz)
{
  bool rc=true;
  const TCHAR *cNext;
  for(LPCTSTR c=_tcschr(psz,_TCHAR('-'));c;c=_tcschr(cNext,_TCHAR('-'))){
    c++;
    const TCHAR *pEq=_tcschr(c,_TCHAR('='));
    if(NULL==pEq){
      TRACE(_T("Failed to find '=' after %s\n"),c);
      rc=false;
      break;
    }
    String strName(c,pEq-c);
    CProperties::CProperty *p=Lookup(strName);
    c=pEq+1;
    String str;
    if(_TCHAR('"')==*c){
      // Value is a quoted string
      for(cNext=c+1;_TCHAR('"')!=*cNext;cNext++){
        if(_TCHAR('\\')==*cNext){
          cNext++;
        }
        str+=*cNext;
      }
    } else {
      // Value is simply terminated by whitespace
      for(cNext=c;_TCHAR('\0')!=*cNext && !_istspace(*cNext);cNext++);
      str=String(c,cNext-c);
    }
    if(p){
      rc&=p->SetValue(str);
    } else {
      TRACE(_T("Properties: unrecognized attribute %s in command string\n"),(LPCTSTR)strName);
      rc=false;
    }
    c=cNext;
  }
  return rc;
}
Esempio n. 12
0
bool GetFileOwner(const wchar_t *Computer,const wchar_t *Name, string &strOwner)
{
	bool Result=false;
	/*
	if(!Owner)
	{
		SIDCacheFlush();
		return TRUE;
	}
	*/
	strOwner.Clear();
	SECURITY_INFORMATION si=OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION;;
	DWORD LengthNeeded=0;
	NTPath strName(Name);
	PSECURITY_DESCRIPTOR sd=reinterpret_cast<PSECURITY_DESCRIPTOR>(sddata);

	if (GetFileSecurity(strName,si,sd,sizeof(sddata),&LengthNeeded) && LengthNeeded<=sizeof(sddata))
	{
		PSID pOwner;
		BOOL OwnerDefaulted;
		if (GetSecurityDescriptorOwner(sd,&pOwner,&OwnerDefaulted))
		{
			if (IsValidSid(pOwner))
			{
				const wchar_t *Owner=GetNameFromSIDCache(pOwner);
				if (!Owner)
				{
					Owner=AddSIDToCache(Computer,pOwner);
				}
				if (Owner)
				{
					strOwner=Owner;
					Result=true;
				}
			}
		}
	}
	return Result;
}
STDMETHODIMP
CDirect2DRM::CreateImageFromSurface(LPDIRECTDRAWSURFACE pdds, BSTR bstrName,
									LPDIRECT2DRMIMAGE *ppImage)
{
	MMASSERT(ppImage);
	if (m_pImageCache == NULL)
		return E_NOTINITIALIZED;

	HRESULT hr;
	LPD2DRMIMAGEPRIVATE pImagePriv = NULL;
	CMFImage *pmfi = NULL;
	CString strName(bstrName);

		// get a reference to the MFImage from the image cache
	if (FAILED(hr = m_pImageCache->GetImageFromSurface(strName, pdds, 0, &pmfi)) ||
		// CoCreate the D2DRMImage object
		FAILED(hr = CoCreateInstance(
						CLSID_CDirect2DRMImage,
						NULL,
						CLSCTX_INPROC_SERVER,
						IID_ID2DRMImagePrivate,
						(LPVOID *) &pImagePriv)) ||
		// initialize the D2DRMImage with the MFImage
		FAILED(hr = pImagePriv->InitFromMFImage(this, pmfi, 0)))
		goto e_CreateImageFromImageFile;

	*ppImage = (LPDIRECT2DRMIMAGE) pImagePriv;

	// release the extra reference we had from the LoadImage
	pmfi->Release();

	return S_OK;

e_CreateImageFromImageFile:
	MMRELEASE(pImagePriv);
	MMRELEASE(pmfi);
	return hr;
}
Esempio n. 14
0
BOOL PSGame::SaveHistory(LPCTSTR lpszPathName)
{
	CString strName(lpszPathName);

	// Open the history file or create a new one.
	CFile f;
	CFileException e;
	strName = strName.Left(strName.GetLength() - 3);
	strName += "dph";
	f.Open(strName, CFile::modeCreate | CFile::modeWrite, &e);
	if (e.m_cause)
		return FALSE;

	// Save the history.
	PSHistory* pHist = GetHistory();
	ASSERT(pHist);
	CArchive arh(&f, CArchive::store);
	pHist->Serialize(arh);
	arh.Close();
	f.Close();

	return TRUE;
}
Esempio n. 15
0
bool CMemoryIniFile::ReadBySecID( unsigned long nSectionID, char* szName, std::string& strValue)
{
    bool bRC = false;
    std::string strName(szName);
    str::ToLower(strName);    
    CIniEntryLst::iterator entryIter;

    if (m_cIniFile.size() <= nSectionID) return false;

    entryIter = m_cIniFile[nSectionID].cEntries.begin();
    while( entryIter != m_cIniFile[nSectionID].cEntries.end() )
    {
        if (entryIter->getName() == strName)
        {
            strValue = entryIter->getValue();
            bRC = true;
            break;
        }
        entryIter++;
    }       
  
    return bRC;
}
Esempio n. 16
0
int CMaxMesh::GetSubmeshMaterialThreadId(int submeshId)
{
    // check if the submesh id is valid
    if((submeshId < 0) || (submeshId >= (int)m_vectorStdMat.size()))
    {
        theExporter.SetLastError("Invalid handle.", __FILE__, __LINE__);
        return -1;
    }

    // get the material of the submesh
    StdMat *pStdMat;
    pStdMat = m_vectorStdMat[submeshId];

    // get name of the material
    std::tstring tname(pStdMat->GetName());
    std::string strName(tname.begin(), tname.end());

    // get positions of the material thread id
    std::string::size_type openPos;
    openPos = strName.find_last_of("[");
    std::string::size_type closePos;
    closePos = strName.find_last_of("]");
    if((openPos == std::string::npos) || (closePos == std::string::npos) || (++openPos >= closePos))
    {
        theExporter.SetLastError("Invalid material thread id in material.", __FILE__, __LINE__);
        return -1;
    }

    // extract material thread id from material name
    std::string strMaterialThreadId;
    strMaterialThreadId = strName.substr(openPos, closePos - openPos);

    int materialThreadId;
    materialThreadId = atoi(strMaterialThreadId.c_str());

    return materialThreadId;
}
Esempio n. 17
0
// -------------------------------------------------------------------
//	Get values for a new material description
void ObjFileParser::getMaterialDesc()
{
	// Get next data for material data
	m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
	if (m_DataIt == m_DataItEnd)
		return;

	char *pStart = &(*m_DataIt);
	while ( !isSeparator(*m_DataIt) && m_DataIt != m_DataItEnd )
		++m_DataIt;

	// Get name
	std::string strName(pStart, &(*m_DataIt));
	if ( strName.empty())
		return;

	// Search for material
	std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( strName );
	if ( it == m_pModel->m_MaterialMap.end() )
	{
		// Not found, use default material
		m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial;
	}
	else
	{
		// Found, using detected material
		m_pModel->m_pCurrentMaterial = (*it).second;
		if ( needsNewMesh( strName ))
		{
			createMesh();	
		}
		m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( strName );
	}

	// Skip rest of line
	m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
}
Esempio n. 18
0
bool MTContactHandler::GetNyms(mapIDName & theMap, int nFilterByContact) //resume
{
    QMutexLocker locker(&m_Mutex);

    QString str_select = QString("SELECT * FROM `nym` WHERE `contact_id`='%1'").arg(nFilterByContact);
//  QString str_select = QString("SELECT * FROM `nym` WHERE `contact_id`='%1' LIMIT 0,1").arg(nFilterByContact);

    bool bFoundAny = false;
    int  nRows     = DBHandler::getInstance()->querySize(str_select);

    for (int ii=0; ii < nRows; ii++)
    {
        QString nym_id   = DBHandler::getInstance()->queryString(str_select, 0, ii);
        QString nym_name = DBHandler::getInstance()->queryString(str_select, 2, ii);

        if (!nym_id.isEmpty())
        {
            bFoundAny = true;

            if (!nym_name.isEmpty())
            {
//              qDebug() << QString("About to decode name: %1").arg(nym_name);
                //Decode base64.
                OTASCIIArmor ascName;
                ascName.Set(nym_name.toStdString().c_str());
                OTString strName(ascName);
                nym_name = QString(strName.Get());
            }
            // ----------------------------
            // At this point we have the nym ID *and* the nym name.
            // So we can add them to our map...
            theMap.insert(nym_id, nym_name);
        }
    }
    // ---------------------------------------------------------------------
    return bFoundAny;
}
Esempio n. 19
0
//---------------------------------------------------------------------------
//	@function:
//		CTableDescriptorTest::EresUnittest_Basic
//
//	@doc:
//		basic naming, assignment thru copy constructors
//
//---------------------------------------------------------------------------
GPOS_RESULT
CTableDescriptorTest::EresUnittest_Basic()
{
	CAutoMemoryPool amp;
	IMemoryPool *pmp = amp.Pmp();

	// Setup an MD cache with a file-based provider
	CMDProviderMemory *pmdp = CTestUtils::m_pmdpf;
	pmdp->AddRef();
	CMDAccessor mda(pmp, CMDCache::Pcache(), CTestUtils::m_sysidDefault, pmdp);

	// install opt context in TLS
	CAutoOptCtxt aoc
					(
					pmp,
					&mda,
					NULL,  /* pceeval */
					CTestUtils::Pcm(pmp)
					);

	CWStringConst strName(GPOS_WSZ_LIT("MyTable"));
	CMDIdGPDB *pmdid = GPOS_NEW(pmp) CMDIdGPDB(GPOPT_MDCACHE_TEST_OID, 1, 1);
	CTableDescriptor *ptabdesc = CTestUtils::PtabdescCreate(pmp, 10, pmdid, CName(&strName));

#ifdef GPOS_DEBUG
	CWStringDynamic str(pmp);
	COstreamString oss(&str);
	ptabdesc->OsPrint(oss);

	GPOS_TRACE(str.Wsz());
#endif // GPOS_DEBUG

	ptabdesc->Release();

	return GPOS_OK;
}
Esempio n. 20
0
BOOL KLU_CheckStringValid(const char* pStr)
{
	const char* szInvalid = " #\\/`~!@~$%^&*()-_+=|{}[];:'\"<>,.?";
	const char* szHZBlank = " "; //中文空格

	if(NULL == pStr) return FALSE;
	std::string strName(pStr);

	if(strName.empty()) return FALSE;

	//查找是否有非法ascii字符
	STRING::size_type nInvalidPos = strName.find_first_of(szInvalid);
	if(nInvalidPos == STRING::npos)
	{
		//中文空格
		nInvalidPos = strName.find(szHZBlank);
	}

	if(nInvalidPos != STRING::npos)
	{
		return FALSE;
	}
	return TRUE;
}
Esempio n. 21
0
void SampleLayout::notifyTreeNodePrepare(MyGUI::TreeControl* pTreeControl, MyGUI::TreeControl::Node* pNode)
{
	if (pNode == pTreeControl->getRoot())
		return;

	pNode->removeAll();

/*#ifdef MYGUI_OGRE_PLATFORM
	Ogre::Archive* pArchive = *(pNode->getData<Ogre::Archive*>());

	MyGUI::UString strPath(getPath(pNode));
	Ogre::StringVectorPtr Resources = pArchive->find(strPath + "*", false, true);
	for (Ogre::StringVector::iterator Iterator = Resources->begin(); Iterator != Resources->end(); ++Iterator)
	{
		MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node(*Iterator, "Folder");
		pChild->setData(pArchive);
		pNode->add(pChild);
	}

	Resources = pArchive->find(strPath + "*", false, false);
	for (Ogre::StringVector::iterator Iterator = Resources->begin(); Iterator != Resources->end(); ++Iterator)
	{
		MyGUI::UString strName(*Iterator);
		MyGUI::UString strExtension;
		size_t nPosition = strName.rfind(".");
		if (nPosition != MyGUI::UString::npos)
		{
			strExtension = strName.substr(nPosition + 1);
			std::transform(strExtension.begin(), strExtension.end(), strExtension.begin(), tolower);
		}

		MyGUI::UString strImage;
		if (strExtension == "png" || strExtension == "tif" || strExtension == "tiff" || strExtension == "jpg" || strExtension == "jpeg")
			strImage = "Image";
		else
		if (strExtension == "mat" || strExtension == "material")
			strImage = "Material";
		else
		if (strExtension == "layout")
			strImage = "Layout";
		else
		if (strExtension == "ttf" || strExtension == "font" || strExtension == "fontdef")
			strImage = "Font";
		else
		if (strExtension == "txt" || strExtension == "text")
			strImage = "Text";
		else
		if (strExtension == "xml")
			strImage = "XML";
		else
		if (strExtension == "mesh")
			strImage = "Mesh";
		else
		if (strExtension == "htm" || strExtension == "html")
			strImage = "HTML";
		else
			strImage = "Unknown";

		MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node(strName, strImage);
		pChild->setPrepared(true);
		pNode->add(pChild);
	}
#else*/
	PairFileInfo info = *(pNode->getData<PairFileInfo>());
	// если папка, то добавляем детей
	if (info.second.folder)
	{
		std::wstring path = info.first + L"/" + info.second.name;
		common::VectorFileInfo result;
		common::getSystemFileList(result, path, L"*.*");

		for (common::VectorFileInfo::iterator item = result.begin(); item != result.end(); ++item)
		{
			if ((*item).name == L".." || (*item).name == L".")
				continue;
			if ((*item).folder)
			{
				MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node((*item).name, "Folder");
				pChild->setData(PairFileInfo(path, *item));
				pNode->add(pChild);
			}
			else
			{
				MyGUI::UString strName((*item).name);
				MyGUI::UString strExtension;
				size_t nPosition = strName.rfind(".");
				if (nPosition != MyGUI::UString::npos)
				{
					strExtension = strName.substr(nPosition + 1);
					std::transform(strExtension.begin(), strExtension.end(), strExtension.begin(), tolower);
				}

				MyGUI::UString strImage;
				if (strExtension == "png" || strExtension == "tif" || strExtension == "tiff" || strExtension == "jpg" || strExtension == "jpeg")
					strImage = "Image";
				else if (strExtension == "mat" || strExtension == "material")
					strImage = "Material";
				else if (strExtension == "layout")
					strImage = "Layout";
				else if (strExtension == "ttf" || strExtension == "font" || strExtension == "fontdef")
					strImage = "Font";
				else if (strExtension == "txt" || strExtension == "text")
					strImage = "Text";
				else if (strExtension == "xml")
					strImage = "XML";
				else if (strExtension == "mesh")
					strImage = "Mesh";
				else if (strExtension == "htm" || strExtension == "html")
					strImage = "HTML";
				else
					strImage = "Unknown";

				MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node((*item).name, strImage);
				pChild->setPrepared(true);
				pNode->add(pChild);
			}
		}
	}

//#endif
}
Esempio n. 22
0
DEV_INFO CDeviceEditDlg::ReadXML()
{
	CMarkup xml;
	DEV_INFO devInfo;
	
	devInfo.nPort=0;
	devInfo.lLoginID=0;
	devInfo.lID=0;
	
	if(xml.Load(GET_MODULE_FILE_INFO.strPath + "UserInfo.xml"))
	{
		while(xml.FindChildElem("ip"))
		{
			//read the information from XML
			CString strIP="",strUserName="",strPsw="",strDevName="";
			UINT nPort;
			long byChanNum=0,lID=0;

			UINT bSerialID,nSerPort;
			CString szSerIP="",szSerialInfo="";			
			xml.IntoElem();		

			xml.FindChildElem("ip2");
			strIP=xml.GetChildData();
			xml.FindChildElem("DEVICENAME");
			strDevName=xml.GetChildData();
			xml.FindChildElem("username");
			strUserName=xml.GetChildData();
			xml.FindChildElem("port");
			nPort=atoi(xml.GetChildData());
			xml.FindChildElem("pwd");
			strPsw=xml.GetChildData();
			xml.FindChildElem("byChanNum");
			byChanNum=atoi(xml.GetChildData());
			xml.FindChildElem("lID");
			lID=atoi(xml.GetChildData());

			xml.FindChildElem("bSerialID");
			bSerialID=atoi(xml.GetChildData());
			xml.FindChildElem("szSerIP");
			szSerIP=xml.GetChildData();
			xml.FindChildElem("nSerPort");
			nSerPort=atoi(xml.GetChildData());
			xml.FindChildElem("szSerialInfo");
			szSerialInfo=xml.GetChildData();//新增ddns记录
			xml.OutOfElem();
			devInfo.nTotalChannel =byChanNum;
			devInfo.nPort = nPort;

			devInfo.bSerialID=bSerialID;		
			devInfo.nSerPort=nSerPort;
			strcpy(devInfo.szSerIP,szSerIP.GetBuffer(0));		
			strcpy(devInfo.szSerialInfo, szSerialInfo.GetBuffer(0));//新增ddns记录		
			strcpy(devInfo.szDevName, strDevName);
			strcpy(devInfo.szUserName, strUserName);
			strcpy(devInfo.szPsw, strPsw);
			strcpy(devInfo.szIpaddress, strIP);
			DEV_INFO *pDev = new DEV_INFO;
			memset( pDev, 0, sizeof(DEV_INFO) );
			memcpy( pDev, &devInfo, sizeof(DEV_INFO) );
			pDev->lID = (long)pDev;
			m_devMap[pDev->lID] = pDev;
			HTREEITEM hAddItem = m_deviceTree.InsertItem(strDevName);
			m_deviceTree.SetItemData(hAddItem, (DWORD)pDev);
			CString strName("");
			for ( int i = 0; i < byChanNum; i ++)
			{
				strName.Format("CAM %d", i+1);
				HTREEITEM item = m_deviceTree.InsertItem(strName, 0, 0, hAddItem);
				m_deviceTree.SetItemData(item, i);
			}
		}
	}
	return devInfo;
}
Esempio n. 23
0
void ecConfigToolView::OnUpdate(wxView *WXUNUSED(sender), wxObject *hintObj)
{
    ecConfigToolDoc* pDoc = (ecConfigToolDoc*) GetDocument();
    ecConfigTreeCtrl* treeCtrl = wxGetApp().GetTreeCtrl();

    wxASSERT (pDoc);

    ecConfigItem* selItem = NULL;

    wxTreeItemId sel = treeCtrl->GetSelection();
    if (sel.IsOk())
    {
        ecTreeItemData* data = (ecTreeItemData*) treeCtrl->GetItemData(sel);
        if (data)
            selItem = data->GetConfigItem() ;
    }

    ecConfigToolHint* hint = (ecConfigToolHint*) hintObj;
    int hintOp = ecNoHint;
    if (hint)
        hintOp = hint->m_op;

    switch (hintOp)
    {
    case ecSelChanged:
        
        {
            // Note that we're cheating a bit here, since we're using the tree view
            // to update another view, instead of having a view per control as in the MFC
            // version. However, it doesn't seem to be worth the extra machinery.
                    // Update the description window
            if (selItem)
            {
                wxGetApp().GetMainFrame()->GetShortDescriptionWindow()->SetValue(selItem->GetDescription());
                
                // Update the properties window
                wxGetApp().GetMainFrame()->GetPropertyListWindow()->Fill(selItem);
            }
            else
            {
                wxGetApp().GetMainFrame()->GetShortDescriptionWindow()->Clear();
                wxGetApp().GetMainFrame()->GetPropertyListWindow()->ClearAll();
            }

        }
        break;
    case ecAllSaved:
        
        {
            int nItem;
#if wxCHECK_VERSION(2, 6, 0)
            for(nItem=0;nItem<pDoc->GetItems().GetCount();nItem++)
#else
            for(nItem=0;nItem<pDoc->GetItems().Number();nItem++)
#endif
            {
                ecConfigItem *pItem = (ecConfigItem*) pDoc->GetItems()[nItem];
                wxTreeItemId treeItem = pItem->GetTreeItem();
                if(treeItem){
                    treeCtrl->SetItemText(treeItem, pItem->GetItemNameOrMacro());
                    //InvalidateItem(h);
                }
            }

            // Update the properties window
            if (selItem)
            {
                wxGetApp().GetMainFrame()->GetPropertyListWindow()->Fill(selItem);
            }

            wxGetApp().GetMainFrame()->UpdateFrameTitle();

            // Update the value pane
            wxGetApp().GetMainFrame()->GetValueWindow()->Refresh();
        }
        break;
    case ecFilenameChanged:
        
        {
            // Update the properties window
            if (selItem)
            {
                wxGetApp().GetMainFrame()->GetPropertyListWindow()->Fill(selItem);
            }
            wxGetApp().GetMainFrame()->UpdateFrameTitle();
        }
        break;
    case ecNameFormatChanged:
        {
            int nItem;
#if wxCHECK_VERSION(2, 6, 0)
            for(nItem=0;nItem<pDoc->GetItems().GetCount();nItem++)
#else
            for(nItem=0;nItem<pDoc->GetItems().Number();nItem++)
#endif
            {
                ecConfigItem *pItem = (ecConfigItem*) pDoc->GetItems()[nItem];
                wxString strName(pItem->GetItemNameOrMacro());
                if(pItem->Modified()){
                    strName+=wxT('*');
                }
                treeCtrl->SetItemText(pItem->GetTreeItem(), strName);
            }
            
            treeCtrl->Refresh();
        }
        break;
    case ecIntFormatChanged:
        {
            if (selItem && selItem->GetOptionType() == ecLong)
            {
                wxGetApp().GetMainFrame()->GetPropertyListWindow()->SetItem(ecPropertyListCtrl::ecValue, selItem->StringValue());
                wxGetApp().GetMainFrame()->GetPropertyListWindow()->SetItem(ecPropertyListCtrl::ecDefaultValue, ecUtils::IntToStr(selItem->DefaultValue(), wxGetApp().GetSettings().m_bHex));
            }

        }
        break;
    case ecClear:		
        {
            m_expandedForFind = wxTreeItemId();

            treeCtrl->DeleteAllItems();

            wxGetApp().GetMainFrame()->GetShortDescriptionWindow()->Clear();
            wxGetApp().GetMainFrame()->GetPropertyListWindow()->Fill(NULL);            
            wxGetApp().GetMainFrame()->GetValueWindow()->Refresh();
            break;
        }

    case ecValueChanged:
        {
            ecConfigItem& ti = *(ecConfigItem *)hint->m_item;

            // Update the tree item
            ti.ConvertFromCdl();
            ti.UpdateTreeItem(* treeCtrl);

            // Update the value cell
            ecValueWindow* valueWindow = wxGetApp().GetMainFrame()->GetValueWindow();
            if (valueWindow)
            {
                wxRect rect = valueWindow->GetItemRect(& ti);
#ifdef __WXMSW__
                valueWindow->Refresh(TRUE, & rect);
#else
                // For some reason, on Linux, the value window gets
                // blanked out if a dialog pops up as a result of the value change.
                valueWindow->Refresh();
#endif
            }

            // Properties window
            if (selItem)
            {
                wxGetApp().GetMainFrame()->GetPropertyListWindow()->RefreshValue();
            }
            wxGetApp().GetMainFrame()->UpdateFrameTitle();
        }		        
        break;

    case ecExternallyChanged:
        {
            int nItem;
#if wxCHECK_VERSION(2, 6, 0)
            for(nItem=0;nItem<pDoc->GetItems().GetCount();nItem++)
#else
            for(nItem=0;nItem<pDoc->GetItems().Number();nItem++)
#endif
            {
                ecConfigItem *pItem = (ecConfigItem*) pDoc->GetItems()[nItem];
                pItem->UpdateTreeItem(* treeCtrl);
            }
            wxGetApp().GetMainFrame()->UpdateFrameTitle();
        }
        break;
    default:
        break; // not for us, apparently
  }
}
Esempio n. 24
0
static status
initialiseEvent(EventObj e, Name id, Any window,
		Int x, Int y, Int bts, Int time)
{ unsigned long t = valInt(time);

  initialiseProgramObject(e);

  if ( notNil(EVENT->value) )
  { EventObj parent = EVENT->value;

    if ( isDefault(x) )      x      = parent->x;
    if ( isDefault(y) )      y      = parent->y;
    if ( isDefault(bts) )    bts    = parent->buttons;
    if ( isDefault(window) ) window = parent->window;
    if ( isDefault(time) )   t      = max(last_time, parent->time);
  } else
  { if ( isDefault(x) )      x      = last_x;
    if ( isDefault(y) )      y      = last_y;
    if ( isDefault(bts) )    bts    = last_buttons;
    if ( isDefault(window) ) window = last_window;
    if ( isDefault(time) )   t      = last_time;
  }

  host_last_time = mclock();
  last_time      = t;
  last_buttons   = bts;			/* save these values */
  last_x         = x;
  last_y         = y;

  assign(e, window,	window);
  assign(e, receiver,	window);
  assign(e, id,		id);
  assign(e, x,		x);
  assign(e, y,		y);
  assign(e, buttons,	bts);
  e->time = t;

  if ( isDownEvent(e) )
  { int clt = CLICK_TYPE_single;
    int px  = valInt(x);
    int py  = valInt(y);

    DEBUG(NAME_multiclick, Cprintf("t: %ld (%ld), x: %d (%d), y: %d (%d) --> ",
				   t, last_down_time, px, last_down_x,
				   py, last_down_y));

    if ( (valInt(e->buttons) & CLICK_TYPE_mask) == CLICK_TYPE_double )
    { switch( last_click_type )
      { case CLICK_TYPE_single:	clt = CLICK_TYPE_double; break;
	case CLICK_TYPE_double:	clt = CLICK_TYPE_triple; break;
	default:		clt = CLICK_TYPE_single; break;
      }
      e->buttons = toInt(valInt(e->buttons) & ~CLICK_TYPE_mask);
    } else
    { if ( (t - last_down_time) < multi_click_time &&
	   abs(last_down_x - px) <= multi_click_diff &&
	   abs(last_down_y - py) <= multi_click_diff &&
	   (valInt(last_down_bts)&BUTTON_mask) == (valInt(bts)&BUTTON_mask) &&
	   last_window == window )
      { switch( last_click_type )
	{ case CLICK_TYPE_single:	clt = CLICK_TYPE_double; break;
	  case CLICK_TYPE_double:	clt = CLICK_TYPE_triple; break;
	}
      }
    }

    last_click_type = clt;
    assign(e, buttons, toInt(valInt(e->buttons) | clt));

    DEBUG(NAME_multiclick, Cprintf("%s\n", strName(getMulticlickEvent(e))));

    last_down_bts     = bts;
    last_down_time    = t;
    last_down_x       = px;
    last_down_y       = py;
  } else if ( isUpEvent(e) )
  { assign(e, buttons, toInt(valInt(e->buttons) | last_click_type));
  }

  if ( !onFlag(window, F_FREED|F_FREEING) )
    last_window = window;

  if ( loc_still_posted )
  { if ( isAEvent(e, NAME_locMove) )
    { DEBUG(NAME_locStill, Cprintf("Re-enabled loc-still on %s\n", pp(e->id)));
      loc_still_posted = FALSE;
    }
  } else if ( isAEvent(e, NAME_area) ||
	      isAEvent(e, NAME_deactivateKeyboardFocus) )
  { DEBUG(NAME_locStill, Cprintf("Disabled loc-still on %s\n", pp(e->id)));
    loc_still_posted = TRUE;
  }

  succeed;
}
Esempio n. 25
0
void CPropertiesWnd::PropertyChanged(CMFCPropertyGridProperty* pProp)
{
	CString strName(pProp->GetName());
	if (strName.CompareNoCase(_T("TYPE")) == 0)
	{
		CMFCPropertyGridProperty* pPropGroup = pProp->GetParent();
		for (int i = pPropGroup->GetSubItemsCount() - 1; i >= 0; i--)
		{
			CMFCPropertyGridProperty* pChildProp = pPropGroup->GetSubItem(i);
			if (pChildProp == pProp)
			{
				break;
			}
			pPropGroup->RemoveSubItem(pChildProp);
		}

		CString strType(pProp->GetValue());
		if (strType.CompareNoCase(_T("Combo")) == 0)
		{
			CMFCPropertyGridProperty* pNewProp = new CMFCPropertyGridProperty(_T("VALUE"), (COleVariant)_T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("ITEMS"), PROP_DATA_ITEMS, TRUE);
			pPropGroup->AddSubItem(pNewProp);
		}
		else if (strType.CompareNoCase(_T("Number")) == 0)
		{ 
			CMFCPropertyGridProperty* pNewProp = new CMFCPropertyGridProperty(_T("VALUE"), (_variant_t)0, _T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("RANGE MIN"), (_variant_t)0, _T(""));
			pNewProp->EnableSpinControl(TRUE, -9999, 9999);
			pPropGroup->AddSubItem(pNewProp);
			pNewProp = new CMFCPropertyGridProperty(_T("RANGE MAX"), (_variant_t)100, _T(""));
			pNewProp->EnableSpinControl(TRUE, -9999, 9999);
			pPropGroup->AddSubItem(pNewProp);

			BOOL bBuddy = FALSE;
			pNewProp = new CMFCPropertyGridProperty(_T("BUDDY"), (_variant_t)(bBuddy == TRUE), _T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("SHORT"), (_variant_t)_T(""), _T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("PREVIEW"), (_variant_t)_T(""), _T(""));
			pPropGroup->AddSubItem(pNewProp);
		}
		else if (strType.CompareNoCase(_T("Text")) == 0)
		{
			CMFCPropertyGridProperty* pNewProp = new CMFCPropertyGridProperty(_T("VALUE"), (COleVariant)_T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("SHORT"), (COleVariant)_T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("PREVIEW"), (COleVariant)_T(""));
			pPropGroup->AddSubItem(pNewProp);
		}

		m_wndPropList.AdjustLayout();
	}
	else if (strName.CompareNoCase(_T("PREVIEW")) == 0)
	{
		((CMainFrame*)AfxGetMainWnd())->GetClassView()->RefreshPreview();
	}
	else if (strName.CompareNoCase(_T("NAME")) == 0)
	{
		((CMainFrame*)AfxGetMainWnd())->GetFileView()->RefreshPropName(pProp);
	}
	((CMainFrame*)AfxGetMainWnd())->GetFileView()->SetFileModifiedFlag(TRUE);
}
Esempio n. 26
0
BOOL CCodeTesterApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	_tsetlocale(LC_CTYPE, _T("chs"));
	AfxInitRichEdit2();

	::AfxSocketInit();

	AfxEnableControlContainer();

	// 创建 shell 管理器,以防对话框包含
	// 任何 shell 树视图控件或 shell 列表视图控件。
	CShellManager *pShellManager = new CShellManager;

	WCHAR buff[100];
	GetCurrentDirectory(100, buff);
	m_ProfileName = buff;
	m_ProfileName += "\\";
	m_ProfileName += m_pszProfileName;

	WIN32_FIND_DATAW findFileData;
	/*
	uint32 value1 = 0x10000000;
	TRACE(L"value1=%08x\n", value1);
	uint32 value2  = value1 << 4;

	TRACE("value=%08x\n", value2);
	uint32 value3 = value1 - value2;
	TRACE("value1 - value2=%08x\n", value1 - value2);
	TRACE("value2 - value1=%08x\n", value2 - value1);
	if(value1 >= 0x0FFFFFFF)
	{
		value1 = (0xFFFFFFFF - value1) << 4;
	}
	*/
	HANDLE handle = FindFirstFile(m_ProfileName, &findFileData);
	if(0xFFFFFFFF ==  (UINT)handle)
	{
		::WritePrivateProfileString(L"FrameInfo",L"CarrierNum",L"10",m_ProfileName);
		::WritePrivateProfileString(L"FrameInfo",L"SiteNum",L"1",m_ProfileName);
		::WritePrivateProfileString(L"FrameInfo",L"GwID",L"1",m_ProfileName);
		::WritePrivateProfileString(L"FrameInfo",L"GwType",L"31",m_ProfileName);
		::WritePrivateProfileString(L"FrameInfo",L"CpuID",L"1",m_ProfileName);

		::WritePrivateProfileString(L"WirelessGate",L"WgIpAddr",L"192.168.0.27",m_ProfileName);
		::WritePrivateProfileString(L"WirelessGate",L"CdmsIpAddr",L"192.168.0.25",m_ProfileName);
		::WritePrivateProfileString(L"WirelessGate",L"BcIpAddr",L"192.168.0.20",m_ProfileName);
		::WritePrivateProfileString(L"WirelessGate",L"IpMask",L"255.255.255.0",m_ProfileName);
		::WritePrivateProfileString(L"WirelessGate",L"IpGate",L"192.168.0.1",m_ProfileName);

		::WritePrivateProfileString(L"CmdList",L"Cmd01",L"0",m_ProfileName);
	}

	CStringA strName(m_ProfileName);
//	CHAR buf[100];
	DWORD ipaddr = 0;

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	if (!AfxSocketInit())
	{
		AfxMessageBox(L"Socket init failed.");
		return FALSE;
	}

	//GetPrivateProfileString(L"wg.ini", L"

	CCodeTesterDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: 在此放置处理何时用
		//  “确定”来关闭对话框的代码
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: 在此放置处理何时用
		//  “取消”来关闭对话框的代码
	}

	// 删除上面创建的 shell 管理器。
	if (pShellManager != NULL)
	{
		delete pShellManager;
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。

	return FALSE;
}
Esempio n. 27
0
void CParametersDumper::SerializeExtensionBuffer(msdk_ostream& sstr,msdk_string prefix,mfxExtBuffer* pExtBuffer)
{
    char name[6]="    .";
    MSDK_MEMCPY(name,&pExtBuffer->BufferId,4);
    std::string strName(name);
    prefix+=msdk_string(strName.begin(),strName.end());

    // Serializing header
    {
        mfxExtBuffer& info = *pExtBuffer;
        SERIALIZE_INFO(BufferId);
        SERIALIZE_INFO(BufferSz);
    }

    // Serializing particular Ext buffer.
    switch(pExtBuffer->BufferId)
    {
    case MFX_EXTBUFF_THREADS_PARAM:
        {
            mfxExtThreadsParam& info = *(mfxExtThreadsParam*)pExtBuffer;
            SERIALIZE_INFO(NumThread);
            SERIALIZE_INFO(SchedulingType);
            SERIALIZE_INFO(Priority);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_JPEG_QT:
        {
            mfxExtJPEGQuantTables& info = *(mfxExtJPEGQuantTables*)pExtBuffer;
            SERIALIZE_INFO_ARRAY(reserved);
            SERIALIZE_INFO(NumTable);
            SERIALIZE_INFO_ARRAY(Qm[4]);
        }
        break;
    case MFX_EXTBUFF_JPEG_HUFFMAN:
        {
            mfxExtJPEGHuffmanTables& info = *(mfxExtJPEGHuffmanTables*)pExtBuffer;
            SERIALIZE_INFO_ARRAY(reserved);
            SERIALIZE_INFO(NumDCTable);
            SERIALIZE_INFO(NumACTable);
            START_PROC_ARRAY(DCTables)
                SERIALIZE_INFO_ARRAY_ELEMENT(DCTables,Bits);
                SERIALIZE_INFO_ARRAY_ELEMENT(DCTables,Values);
            END_PROC_ARRAY
            START_PROC_ARRAY(DCTables)
                SERIALIZE_INFO_ARRAY_ELEMENT(ACTables,Bits);
                SERIALIZE_INFO_ARRAY_ELEMENT(ACTables,Values);
            END_PROC_ARRAY
        }
        break;
    case MFX_EXTBUFF_LOOKAHEAD_CTRL:
        {
            mfxExtLAControl& info = *(mfxExtLAControl*)pExtBuffer;
            SERIALIZE_INFO(LookAheadDepth);
            SERIALIZE_INFO(DependencyDepth);
            SERIALIZE_INFO(DownScaleFactor);
            SERIALIZE_INFO(BPyramid);
            SERIALIZE_INFO_ARRAY(reserved1);
            SERIALIZE_INFO(NumOutStream);
            START_PROC_ARRAY(OutStream)
                SERIALIZE_INFO_ELEMENT(OutStream,Width);
                SERIALIZE_INFO_ELEMENT(OutStream,Height);
                SERIALIZE_INFO_ARRAY_ELEMENT(OutStream,reserved2);
            END_PROC_ARRAY
        }
        break;
    case MFX_EXTBUFF_LOOKAHEAD_STAT:
        {
            mfxExtLAFrameStatistics& info = *(mfxExtLAFrameStatistics*)pExtBuffer;
            SERIALIZE_INFO_ARRAY(reserved);
            SERIALIZE_INFO(NumStream);
            SERIALIZE_INFO(NumFrame);
            //DO_MANUALLY:     mfxLAFrameInfo   *FrameStat; //frame statistics
            //DO_MANUALLY:     mfxFrameSurface1 *OutSurface; //reordered surface
        }
        break;
    case MFX_EXTBUFF_MVC_SEQ_DESC:
        {
            mfxExtMVCSeqDesc& info = *(mfxExtMVCSeqDesc*)pExtBuffer;
            SERIALIZE_INFO(NumView);
            SERIALIZE_INFO(NumViewAlloc);
            //DO_MANUALLY:     mfxMVCViewDependency *View;
            SERIALIZE_INFO(NumViewId);
            SERIALIZE_INFO(NumViewIdAlloc);
            SERIALIZE_INFO_MEMORY(ViewId,NumViewId);
            SERIALIZE_INFO(NumOP);
            SERIALIZE_INFO(NumOPAlloc);
            //DO_MANUALLY:     mfxMVCOperationPoint *OP;
            SERIALIZE_INFO(NumRefsTotal);
            SERIALIZE_INFO_ARRAY(Reserved);
        }
        break;
    case MFX_EXTBUFF_MVC_TARGET_VIEWS:
        {
            mfxExtMVCTargetViews & info = *(mfxExtMVCTargetViews *)pExtBuffer;
            SERIALIZE_INFO(TemporalId);
            SERIALIZE_INFO(NumView);
            SERIALIZE_INFO_ARRAY(ViewId);
        }
        break;
    case MFX_EXTBUFF_VPP_PICSTRUCT_DETECTION:
        {
            // No structure accociated with MFX_EXTBUFF_VPP_PICSTRUCT_DETECTION
        }
        break;
    case MFX_EXTBUFF_CODING_OPTION:
        {
            mfxExtCodingOption& info = *(mfxExtCodingOption*)pExtBuffer;
            SERIALIZE_INFO(reserved1);
            SERIALIZE_INFO(RateDistortionOpt);
            SERIALIZE_INFO(MECostType);
            SERIALIZE_INFO(MESearchType);
            SERIALIZE_INFO(MVSearchWindow.x);
            SERIALIZE_INFO(MVSearchWindow.y);
            SERIALIZE_INFO(EndOfSequence);
            SERIALIZE_INFO(FramePicture);
            SERIALIZE_INFO(CAVLC);
            SERIALIZE_INFO_ARRAY(reserved2);
            SERIALIZE_INFO(RecoveryPointSEI);
            SERIALIZE_INFO(ViewOutput);
            SERIALIZE_INFO(NalHrdConformance);
            SERIALIZE_INFO(SingleSeiNalUnit);
            SERIALIZE_INFO(VuiVclHrdParameters);
            SERIALIZE_INFO(RefPicListReordering);
            SERIALIZE_INFO(ResetRefList);
            SERIALIZE_INFO(RefPicMarkRep);
            SERIALIZE_INFO(FieldOutput);
            SERIALIZE_INFO(IntraPredBlockSize);
            SERIALIZE_INFO(InterPredBlockSize);
            SERIALIZE_INFO(MVPrecision);
            SERIALIZE_INFO(MaxDecFrameBuffering);
            SERIALIZE_INFO(AUDelimiter);
            SERIALIZE_INFO(EndOfStream);
            SERIALIZE_INFO(PicTimingSEI);
            SERIALIZE_INFO(VuiNalHrdParameters);
        }
        break;
    case MFX_EXTBUFF_CODING_OPTION2:
        {
            mfxExtCodingOption2& info = *(mfxExtCodingOption2*)pExtBuffer;
            SERIALIZE_INFO(IntRefType);
            SERIALIZE_INFO(IntRefCycleSize);
            SERIALIZE_INFO(IntRefQPDelta);
            SERIALIZE_INFO(MaxFrameSize);
            SERIALIZE_INFO(MaxSliceSize);
            SERIALIZE_INFO(BitrateLimit);
            SERIALIZE_INFO(MBBRC);
            SERIALIZE_INFO(ExtBRC);
            SERIALIZE_INFO(LookAheadDepth);
            SERIALIZE_INFO(Trellis);
            SERIALIZE_INFO(RepeatPPS);
            SERIALIZE_INFO(BRefType);
            SERIALIZE_INFO(AdaptiveI);
            SERIALIZE_INFO(AdaptiveB);
            SERIALIZE_INFO(LookAheadDS);
            SERIALIZE_INFO(NumMbPerSlice);
            SERIALIZE_INFO(SkipFrame);
            SERIALIZE_INFO(MinQPI);
            SERIALIZE_INFO(MaxQPI);
            SERIALIZE_INFO(MinQPP);
            SERIALIZE_INFO(MaxQPP);
            SERIALIZE_INFO(MinQPB);
            SERIALIZE_INFO(MaxQPB);
            SERIALIZE_INFO(FixedFrameRate);
            SERIALIZE_INFO(DisableDeblockingIdc);
            SERIALIZE_INFO(DisableVUI);
            SERIALIZE_INFO(BufferingPeriodSEI);
            SERIALIZE_INFO(EnableMAD);
            SERIALIZE_INFO(UseRawRef);
        }
        break;
    case MFX_EXTBUFF_CODING_OPTION3:
        {
            mfxExtCodingOption3& info = *(mfxExtCodingOption3*)pExtBuffer;
            SERIALIZE_INFO(NumSliceI);
            SERIALIZE_INFO(NumSliceP);
            SERIALIZE_INFO(NumSliceB);
            SERIALIZE_INFO(WinBRCMaxAvgKbps);
            SERIALIZE_INFO(WinBRCSize);
            SERIALIZE_INFO(QVBRQuality);
            SERIALIZE_INFO(EnableMBQP);
            SERIALIZE_INFO(IntRefCycleDist);
            SERIALIZE_INFO(DirectBiasAdjustment);
            SERIALIZE_INFO(GlobalMotionBiasAdjustment);
            SERIALIZE_INFO(MVCostScalingFactor);
            SERIALIZE_INFO(MBDisableSkipMap);
            SERIALIZE_INFO(WeightedPred);
            SERIALIZE_INFO(WeightedBiPred);
            SERIALIZE_INFO(AspectRatioInfoPresent);
            SERIALIZE_INFO(OverscanInfoPresent);
            SERIALIZE_INFO(OverscanAppropriate);
            SERIALIZE_INFO(TimingInfoPresent);
            SERIALIZE_INFO(BitstreamRestriction);
            SERIALIZE_INFO(LowDelayHrd);
            SERIALIZE_INFO(MotionVectorsOverPicBoundaries);
            SERIALIZE_INFO(ScenarioInfo);
            SERIALIZE_INFO(ContentInfo);
            SERIALIZE_INFO(PRefType);
            SERIALIZE_INFO(FadeDetection);
            SERIALIZE_INFO(GPB);
            SERIALIZE_INFO(MaxFrameSizeI);
            SERIALIZE_INFO(MaxFrameSizeP);
            SERIALIZE_INFO_ARRAY(reserved1);
            SERIALIZE_INFO(EnableQPOffset);
            SERIALIZE_INFO_ARRAY(QPOffset);
            SERIALIZE_INFO_ARRAY(NumRefActiveP);
            SERIALIZE_INFO_ARRAY(NumRefActiveBL0);
            SERIALIZE_INFO_ARRAY(NumRefActiveBL1);
            SERIALIZE_INFO(BRCPanicMode);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_VPP_DONOTUSE:
        {
            mfxExtVPPDoNotUse& info = *(mfxExtVPPDoNotUse*)pExtBuffer;
            SERIALIZE_INFO(NumAlg);
            SERIALIZE_INFO_MEMORY(AlgList,NumAlg);
        }
        break;
    case MFX_EXTBUFF_VPP_DENOISE:
        {
            mfxExtVPPDenoise& info = *(mfxExtVPPDenoise*)pExtBuffer;
            SERIALIZE_INFO(DenoiseFactor);
        }
        break;
    case MFX_EXTBUFF_VPP_DETAIL:
        {
            mfxExtVPPDetail& info = *(mfxExtVPPDetail*)pExtBuffer;
            SERIALIZE_INFO(DetailFactor);
        }
        break;
    case MFX_EXTBUFF_VPP_PROCAMP:
        {
            mfxExtVPPProcAmp& info = *(mfxExtVPPProcAmp*)pExtBuffer;
            SERIALIZE_INFO(Brightness);
            SERIALIZE_INFO(Contrast);
            SERIALIZE_INFO(Hue);
            SERIALIZE_INFO(Saturation);
        }
        break;
    case MFX_EXTBUFF_VPP_AUXDATA:
        {
            mfxExtVppAuxData& info = *(mfxExtVppAuxData*)pExtBuffer;
            SERIALIZE_INFO(SpatialComplexity);
            SERIALIZE_INFO(TemporalComplexity);
            SERIALIZE_INFO(PicStruct);
            SERIALIZE_INFO_ARRAY(reserved);
            SERIALIZE_INFO(SceneChangeRate);
            SERIALIZE_INFO(RepeatedFrame);
        }
        break;
    case MFX_EXTBUFF_CODING_OPTION_SPSPPS:
        {
            mfxExtCodingOptionSPSPPS& info = *(mfxExtCodingOptionSPSPPS*)pExtBuffer;
            SERIALIZE_INFO(SPSBuffer);
            SERIALIZE_INFO(PPSBuffer);
            SERIALIZE_INFO(SPSBufSize);
            SERIALIZE_INFO(PPSBufSize);
            SERIALIZE_INFO(SPSId);
            SERIALIZE_INFO(PPSId);
        }
        break;
    case MFX_EXTBUFF_CODING_OPTION_VPS:
        {
            mfxExtCodingOptionVPS& info = *(mfxExtCodingOptionVPS*)pExtBuffer;
            SERIALIZE_INFO(VPSBuffer);
            SERIALIZE_INFO(reserved1);
            SERIALIZE_INFO(VPSBufSize);
            SERIALIZE_INFO(VPSId);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO:
        {
            mfxExtVideoSignalInfo& info = *(mfxExtVideoSignalInfo*)pExtBuffer;
            SERIALIZE_INFO(VideoFormat);
            SERIALIZE_INFO(VideoFullRange);
            SERIALIZE_INFO(ColourDescriptionPresent);
            SERIALIZE_INFO(ColourPrimaries);
            SERIALIZE_INFO(TransferCharacteristics);
            SERIALIZE_INFO(MatrixCoefficients);
        }
        break;
    case MFX_EXTBUFF_VPP_DOUSE:
        {
            mfxExtVPPDoUse& info = *(mfxExtVPPDoUse*)pExtBuffer;
            SERIALIZE_INFO(NumAlg);
            SERIALIZE_INFO(AlgList);
        }
        break;
    case MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION:
        {
            mfxExtOpaqueSurfaceAlloc& info = *(mfxExtOpaqueSurfaceAlloc*)pExtBuffer;
            SERIALIZE_INFO_ARRAY(reserved1);
            SERIALIZE_INFO_ARRAY(In.reserved2);
            SERIALIZE_INFO(In.Type);
            SERIALIZE_INFO(In.NumSurface);
            SERIALIZE_INFO_ARRAY(Out.reserved2);
            SERIALIZE_INFO(Out.Type);
            SERIALIZE_INFO(Out.NumSurface);
        }
        break;
    case MFX_EXTBUFF_AVC_REFLIST_CTRL:
        {
            mfxExtAVCRefListCtrl& info = *(mfxExtAVCRefListCtrl*)pExtBuffer;
            SERIALIZE_INFO(NumRefIdxL0Active);
            SERIALIZE_INFO(NumRefIdxL1Active);
            START_PROC_ARRAY(PreferredRefList)
                SERIALIZE_INFO_ELEMENT(PreferredRefList,FrameOrder);
                SERIALIZE_INFO_ELEMENT(PreferredRefList,PicStruct);
                SERIALIZE_INFO_ELEMENT(PreferredRefList,ViewId);
                SERIALIZE_INFO_ELEMENT(PreferredRefList,LongTermIdx);
                SERIALIZE_INFO_ARRAY_ELEMENT(PreferredRefList,reserved);
            END_PROC_ARRAY

            START_PROC_ARRAY(RejectedRefList)
                SERIALIZE_INFO_ELEMENT(RejectedRefList,FrameOrder);
                SERIALIZE_INFO_ELEMENT(RejectedRefList,PicStruct);
                SERIALIZE_INFO_ELEMENT(RejectedRefList,ViewId);
                SERIALIZE_INFO_ELEMENT(RejectedRefList,LongTermIdx);
                SERIALIZE_INFO_ARRAY_ELEMENT(RejectedRefList,reserved);
            END_PROC_ARRAY

            START_PROC_ARRAY(LongTermRefList)
                SERIALIZE_INFO_ELEMENT(LongTermRefList,FrameOrder);
                SERIALIZE_INFO_ELEMENT(LongTermRefList,PicStruct);
                SERIALIZE_INFO_ELEMENT(LongTermRefList,ViewId);
                SERIALIZE_INFO_ELEMENT(LongTermRefList,LongTermIdx);
                SERIALIZE_INFO_ARRAY_ELEMENT(LongTermRefList,reserved);
            END_PROC_ARRAY

            SERIALIZE_INFO(ApplyLongTermIdx);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION:
        {
            mfxExtVPPFrameRateConversion& info = *(mfxExtVPPFrameRateConversion*)pExtBuffer;
            SERIALIZE_INFO(Algorithm);
            SERIALIZE_INFO(reserved);
            SERIALIZE_INFO_ARRAY(reserved2);
        }
        break;
    case MFX_EXTBUFF_VPP_IMAGE_STABILIZATION:
        {
            mfxExtVPPImageStab& info = *(mfxExtVPPImageStab*)pExtBuffer;
            SERIALIZE_INFO(Mode);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_PICTURE_TIMING_SEI:
        {
            mfxExtPictureTimingSEI& info = *(mfxExtPictureTimingSEI*)pExtBuffer;
            SERIALIZE_INFO_ARRAY(reserved);

            SERIALIZE_INFO(TimeStamp[0].ClockTimestampFlag);
            SERIALIZE_INFO(TimeStamp[0].CtType);
            SERIALIZE_INFO(TimeStamp[0].NuitFieldBasedFlag);
            SERIALIZE_INFO(TimeStamp[0].CountingType);
            SERIALIZE_INFO(TimeStamp[0].FullTimestampFlag);
            SERIALIZE_INFO(TimeStamp[0].DiscontinuityFlag);
            SERIALIZE_INFO(TimeStamp[0].CntDroppedFlag);
            SERIALIZE_INFO(TimeStamp[0].NFrames);
            SERIALIZE_INFO(TimeStamp[0].SecondsFlag);
            SERIALIZE_INFO(TimeStamp[0].MinutesFlag);
            SERIALIZE_INFO(TimeStamp[0].HoursFlag);
            SERIALIZE_INFO(TimeStamp[0].SecondsValue);
            SERIALIZE_INFO(TimeStamp[0].MinutesValue);
            SERIALIZE_INFO(TimeStamp[0].HoursValue);
            SERIALIZE_INFO(TimeStamp[0].TimeOffset);

            SERIALIZE_INFO(TimeStamp[1].ClockTimestampFlag);
            SERIALIZE_INFO(TimeStamp[1].CtType);
            SERIALIZE_INFO(TimeStamp[1].NuitFieldBasedFlag);
            SERIALIZE_INFO(TimeStamp[1].CountingType);
            SERIALIZE_INFO(TimeStamp[1].FullTimestampFlag);
            SERIALIZE_INFO(TimeStamp[1].DiscontinuityFlag);
            SERIALIZE_INFO(TimeStamp[1].CntDroppedFlag);
            SERIALIZE_INFO(TimeStamp[1].NFrames);
            SERIALIZE_INFO(TimeStamp[1].SecondsFlag);
            SERIALIZE_INFO(TimeStamp[1].MinutesFlag);
            SERIALIZE_INFO(TimeStamp[1].HoursFlag);
            SERIALIZE_INFO(TimeStamp[1].SecondsValue);
            SERIALIZE_INFO(TimeStamp[1].MinutesValue);
            SERIALIZE_INFO(TimeStamp[1].HoursValue);
            SERIALIZE_INFO(TimeStamp[1].TimeOffset);

            SERIALIZE_INFO(TimeStamp[2].ClockTimestampFlag);
            SERIALIZE_INFO(TimeStamp[2].CtType);
            SERIALIZE_INFO(TimeStamp[2].NuitFieldBasedFlag);
            SERIALIZE_INFO(TimeStamp[2].CountingType);
            SERIALIZE_INFO(TimeStamp[2].FullTimestampFlag);
            SERIALIZE_INFO(TimeStamp[2].DiscontinuityFlag);
            SERIALIZE_INFO(TimeStamp[2].CntDroppedFlag);
            SERIALIZE_INFO(TimeStamp[2].NFrames);
            SERIALIZE_INFO(TimeStamp[2].SecondsFlag);
            SERIALIZE_INFO(TimeStamp[2].MinutesFlag);
            SERIALIZE_INFO(TimeStamp[2].HoursFlag);
            SERIALIZE_INFO(TimeStamp[2].SecondsValue);
            SERIALIZE_INFO(TimeStamp[2].MinutesValue);
            SERIALIZE_INFO(TimeStamp[2].HoursValue);
            SERIALIZE_INFO(TimeStamp[2].TimeOffset);
        }
        break;
    case MFX_EXTBUFF_AVC_TEMPORAL_LAYERS:
        {
            mfxExtAvcTemporalLayers& info = *(mfxExtAvcTemporalLayers*)pExtBuffer;
            SERIALIZE_INFO_ARRAY(reserved1);
            SERIALIZE_INFO(reserved2);
            SERIALIZE_INFO(BaseLayerPID);
            SERIALIZE_INFO(Layer[0].Scale);
            SERIALIZE_INFO_ARRAY(Layer[0].reserved);
            SERIALIZE_INFO(Layer[1].Scale);
            SERIALIZE_INFO_ARRAY(Layer[1].reserved);
            SERIALIZE_INFO(Layer[2].Scale);
            SERIALIZE_INFO_ARRAY(Layer[2].reserved);
            SERIALIZE_INFO(Layer[3].Scale);
            SERIALIZE_INFO_ARRAY(Layer[3].reserved);
            SERIALIZE_INFO(Layer[4].Scale);
            SERIALIZE_INFO_ARRAY(Layer[4].reserved);
            SERIALIZE_INFO(Layer[5].Scale);
            SERIALIZE_INFO_ARRAY(Layer[5].reserved);
            SERIALIZE_INFO(Layer[6].Scale);
            SERIALIZE_INFO_ARRAY(Layer[6].reserved);
            SERIALIZE_INFO(Layer[7].Scale);
            SERIALIZE_INFO_ARRAY(Layer[7].reserved);
        }
        break;
    case MFX_EXTBUFF_ENCODER_CAPABILITY:
        {
            mfxExtEncoderCapability& info = *(mfxExtEncoderCapability*)pExtBuffer;
            SERIALIZE_INFO(MBPerSec);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_ENCODER_RESET_OPTION:
        {
            mfxExtEncoderResetOption& info = *(mfxExtEncoderResetOption*)pExtBuffer;
            SERIALIZE_INFO(StartNewSequence);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_ENCODED_FRAME_INFO:
        {
            mfxExtAVCEncodedFrameInfo& info = *(mfxExtAVCEncodedFrameInfo*)pExtBuffer;
            SERIALIZE_INFO(FrameOrder);
            SERIALIZE_INFO(PicStruct);
            SERIALIZE_INFO(LongTermIdx);
            SERIALIZE_INFO(MAD);
            SERIALIZE_INFO(BRCPanicMode);
            SERIALIZE_INFO(QP);
            SERIALIZE_INFO(SecondFieldOffset);
            SERIALIZE_INFO_ARRAY(reserved);
            SERIALIZE_INFO(FrameOrder);
            SERIALIZE_INFO(PicStruct);
            SERIALIZE_INFO(LongTermIdx);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_VPP_COMPOSITE:
        {
            mfxExtVPPComposite& info = *(mfxExtVPPComposite*)pExtBuffer;
            SERIALIZE_INFO(Y);
            SERIALIZE_INFO(R);
            SERIALIZE_INFO(U);
            SERIALIZE_INFO(G);
            SERIALIZE_INFO(V);
            SERIALIZE_INFO(B);
            SERIALIZE_INFO_ARRAY(reserved1);
            SERIALIZE_INFO(NumInputStream);
            for(int i=0;i<info.NumInputStream;i++)
            {
                msdk_char streamName[32];
                msdk_sprintf(streamName,MSDK_STRING("InputStream[%d]."),i);
                SerializeVPPCompInputStream(sstr,prefix+streamName,info.InputStream[i]);
            }
        }
        break;
    case MFX_EXTBUFF_VIDEO_SIGNAL_INFO:
        {
            mfxExtVPPVideoSignalInfo& info = *(mfxExtVPPVideoSignalInfo*)pExtBuffer;
            SERIALIZE_INFO_ARRAY(reserved1);

            SERIALIZE_INFO(In.TransferMatrix);
            SERIALIZE_INFO(In.NominalRange);
            SERIALIZE_INFO_ARRAY(In.reserved2);
            SERIALIZE_INFO(Out.TransferMatrix);
            SERIALIZE_INFO(Out.NominalRange);
            SERIALIZE_INFO_ARRAY(Out.reserved2);

            SERIALIZE_INFO(TransferMatrix);
            SERIALIZE_INFO(NominalRange);
            SERIALIZE_INFO_ARRAY(reserved3);
        }
        break;
    case MFX_EXTBUFF_ENCODER_ROI:
        {
            mfxExtEncoderROI& info = *(mfxExtEncoderROI*)pExtBuffer;
            SERIALIZE_INFO(NumROI);
#if _MSDK_API >= MSDK_API(1,22)
            SERIALIZE_INFO(ROIMode);
#endif //_MSDK_API >= MSDK_API(1,22)
            SERIALIZE_INFO_ARRAY(reserved1);
            START_PROC_ARRAY_SIZE(ROI,NumROI)
                SERIALIZE_INFO_ELEMENT(ROI,Left);
                SERIALIZE_INFO_ELEMENT(ROI,Top);
                SERIALIZE_INFO_ELEMENT(ROI,Right);
                SERIALIZE_INFO_ELEMENT(ROI,Bottom);
                SERIALIZE_INFO_ELEMENT(ROI,Priority);
#if _MSDK_API >= MSDK_API(1,22)
                SERIALIZE_INFO_ELEMENT(ROI,DeltaQP);
#endif //_MSDK_API >= MSDK_API(1,22)

                SERIALIZE_INFO_ARRAY_ELEMENT(ROI,reserved2);
            END_PROC_ARRAY
        }
        break;
    case MFX_EXTBUFF_VPP_DEINTERLACING:
        {
            mfxExtVPPDeinterlacing& info = *(mfxExtVPPDeinterlacing*)pExtBuffer;
            SERIALIZE_INFO(Mode);
            SERIALIZE_INFO(TelecinePattern);
            SERIALIZE_INFO(TelecineLocation);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_AVC_REFLISTS:
        {
            mfxExtAVCRefLists& info = *(mfxExtAVCRefLists*)pExtBuffer;
            SERIALIZE_INFO(NumRefIdxL0Active);
            SERIALIZE_INFO(NumRefIdxL1Active);
            SERIALIZE_INFO_ARRAY(reserved);

            START_PROC_ARRAY(RefPicList0)
                SERIALIZE_INFO_ELEMENT(RefPicList0,FrameOrder);
                SERIALIZE_INFO_ELEMENT(RefPicList0,PicStruct);
                SERIALIZE_INFO_ELEMENT(RefPicList0,reserved);
            END_PROC_ARRAY

            START_PROC_ARRAY(RefPicList1)
                SERIALIZE_INFO_ELEMENT(RefPicList1,FrameOrder);
                SERIALIZE_INFO_ELEMENT(RefPicList1,PicStruct);
                SERIALIZE_INFO_ELEMENT(RefPicList1,reserved);
            END_PROC_ARRAY
        }
        break;
    case MFX_EXTBUFF_VPP_FIELD_PROCESSING:
        {
            mfxExtVPPFieldProcessing& info = *(mfxExtVPPFieldProcessing*)pExtBuffer;
            SERIALIZE_INFO(Mode);
            SERIALIZE_INFO(InField);
            SERIALIZE_INFO(OutField);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
#if _MSDK_API >= MSDK_API(1,22)
    case MFX_EXTBUFF_DEC_VIDEO_PROCESSING:
        {
            mfxExtDecVideoProcessing& info = *(mfxExtDecVideoProcessing*)pExtBuffer;
            SERIALIZE_INFO(In.CropX);
            SERIALIZE_INFO(In.CropY);
            SERIALIZE_INFO(In.CropW);
            SERIALIZE_INFO(In.CropH);
            SERIALIZE_INFO_ARRAY(In.reserved);
            SERIALIZE_INFO(Out.FourCC);
            SERIALIZE_INFO(Out.ChromaFormat);
            SERIALIZE_INFO(Out.Width);
            SERIALIZE_INFO(Out.Height);
            SERIALIZE_INFO(Out.CropX);
            SERIALIZE_INFO(Out.CropY);
            SERIALIZE_INFO(Out.CropW);
            SERIALIZE_INFO(Out.CropH);
            SERIALIZE_INFO_ARRAY(Out.reserved);
        }
        break;
#endif //_MSDK_API >= MSDK_API(1,22)
    case MFX_EXTBUFF_CHROMA_LOC_INFO:
        {
            mfxExtChromaLocInfo& info = *(mfxExtChromaLocInfo*)pExtBuffer;
            SERIALIZE_INFO(ChromaLocInfoPresentFlag);
            SERIALIZE_INFO(ChromaSampleLocTypeTopField);
            SERIALIZE_INFO(ChromaSampleLocTypeBottomField);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_MBQP:
        {
            mfxExtMBQP& info = *(mfxExtMBQP*)pExtBuffer;
            SERIALIZE_INFO_ARRAY(reserved);
            SERIALIZE_INFO(NumQPAlloc);
            SERIALIZE_INFO_MEMORY(QP,NumQPAlloc);
            SERIALIZE_INFO(reserved2);
        }
        break;
    case MFX_EXTBUFF_HEVC_TILES:
        {
            mfxExtHEVCTiles& info = *(mfxExtHEVCTiles*)pExtBuffer;
            SERIALIZE_INFO(NumTileRows);
            SERIALIZE_INFO(NumTileColumns);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_MB_DISABLE_SKIP_MAP:
        {
            mfxExtMBDisableSkipMap& info = *(mfxExtMBDisableSkipMap*)pExtBuffer;
            SERIALIZE_INFO_ARRAY(reserved);
            SERIALIZE_INFO(MapSize);
            SERIALIZE_INFO_MEMORY(Map,MapSize);
            SERIALIZE_INFO(reserved2);
        }
        break;
    case MFX_EXTBUFF_HEVC_PARAM:
        {
            mfxExtHEVCParam& info = *(mfxExtHEVCParam*)pExtBuffer;
            SERIALIZE_INFO(PicWidthInLumaSamples);
            SERIALIZE_INFO(PicHeightInLumaSamples);
            SERIALIZE_INFO(GeneralConstraintFlags);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_DECODED_FRAME_INFO:
        {
            mfxExtDecodedFrameInfo& info = *(mfxExtDecodedFrameInfo*)pExtBuffer;
            SERIALIZE_INFO(FrameType);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_TIME_CODE:
        {
            mfxExtTimeCode& info = *(mfxExtTimeCode*)pExtBuffer;
            SERIALIZE_INFO(DropFrameFlag);
            SERIALIZE_INFO(TimeCodeHours);
            SERIALIZE_INFO(TimeCodeMinutes);
            SERIALIZE_INFO(TimeCodeSeconds);
            SERIALIZE_INFO(TimeCodePictures);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_HEVC_REGION:
        {
            mfxExtHEVCRegion& info = *(mfxExtHEVCRegion*)pExtBuffer;
            SERIALIZE_INFO(RegionId);
            SERIALIZE_INFO(RegionType);
            SERIALIZE_INFO(RegionEncoding);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_PRED_WEIGHT_TABLE:
        {
            mfxExtPredWeightTable& info = *(mfxExtPredWeightTable*)pExtBuffer;
            SERIALIZE_INFO(LumaLog2WeightDenom);
            SERIALIZE_INFO(ChromaLog2WeightDenom);
            SERIALIZE_INFO_ARRAY(LumaWeightFlag[0]);
            SERIALIZE_INFO_ARRAY(LumaWeightFlag[1]);
            SERIALIZE_INFO_ARRAY(ChromaWeightFlag[0]);
            SERIALIZE_INFO_ARRAY(ChromaWeightFlag[1]);
            //DO_MANUALLY: Weights[2][32][3][2];
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_DIRTY_RECTANGLES:
        {
            mfxExtDirtyRect& info = *(mfxExtDirtyRect*)pExtBuffer;
            SERIALIZE_INFO(NumRect);
            SERIALIZE_INFO_ARRAY(reserved1);

            START_PROC_ARRAY_SIZE(Rect,NumRect)
                SERIALIZE_INFO_ELEMENT(Rect,Left);
                SERIALIZE_INFO_ELEMENT(Rect,Top);
                SERIALIZE_INFO_ELEMENT(Rect,Right);
                SERIALIZE_INFO_ELEMENT(Rect,Bottom);
                SERIALIZE_INFO_ARRAY_ELEMENT(Rect,reserved2);
            END_PROC_ARRAY
        }
        break;
    case MFX_EXTBUFF_MOVING_RECTANGLES:
        {
            mfxExtMoveRect& info = *(mfxExtMoveRect*)pExtBuffer;
            SERIALIZE_INFO(NumRect);
            SERIALIZE_INFO_ARRAY(reserved1);

            START_PROC_ARRAY_SIZE(Rect,NumRect)
                SERIALIZE_INFO_ELEMENT(Rect,DestLeft);
                SERIALIZE_INFO_ELEMENT(Rect,DestTop);
                SERIALIZE_INFO_ELEMENT(Rect,DestRight);
                SERIALIZE_INFO_ELEMENT(Rect,DestBottom);
                SERIALIZE_INFO_ELEMENT(Rect,SourceLeft);
                SERIALIZE_INFO_ELEMENT(Rect,SourceTop);
                SERIALIZE_INFO_ARRAY_ELEMENT(Rect,reserved2);
            END_PROC_ARRAY
        }
        break;
    case MFX_EXTBUFF_VPP_ROTATION:
        {
            mfxExtVPPRotation& info = *(mfxExtVPPRotation*)pExtBuffer;
            SERIALIZE_INFO(Angle);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_ENCODED_SLICES_INFO:
        {
            mfxExtEncodedSlicesInfo& info = *(mfxExtEncodedSlicesInfo*)pExtBuffer;
            SERIALIZE_INFO(SliceSizeOverflow);
            SERIALIZE_INFO(NumSliceNonCopliant);
            SERIALIZE_INFO(NumEncodedSlice);
            SERIALIZE_INFO(NumSliceSizeAlloc);
            SERIALIZE_INFO_MEMORY(SliceSize,NumSliceSizeAlloc);
            SERIALIZE_INFO(reserved1);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_VPP_SCALING:
        {
            mfxExtVPPScaling& info = *(mfxExtVPPScaling*)pExtBuffer;
            SERIALIZE_INFO(ScalingMode);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_VPP_MIRRORING:
        {
            mfxExtVPPMirroring& info = *(mfxExtVPPMirroring*)pExtBuffer;
            SERIALIZE_INFO(Type);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_MV_OVER_PIC_BOUNDARIES:
        {
            mfxExtMVOverPicBoundaries& info = *(mfxExtMVOverPicBoundaries*)pExtBuffer;
            SERIALIZE_INFO(StickTop);
            SERIALIZE_INFO(StickBottom);
            SERIALIZE_INFO(StickLeft);
            SERIALIZE_INFO(StickRight);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_VPP_COLORFILL:
        {
            mfxExtVPPColorFill& info = *(mfxExtVPPColorFill*)pExtBuffer;
            SERIALIZE_INFO(Enable);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    case MFX_EXTBUFF_VP8_CODING_OPTION:
        {
            mfxExtVP8CodingOption& info = *(mfxExtVP8CodingOption*)pExtBuffer;
            SERIALIZE_INFO(Version);
            SERIALIZE_INFO(EnableMultipleSegments);
            SERIALIZE_INFO(LoopFilterType);
            SERIALIZE_INFO_ARRAY(LoopFilterLevel);
            SERIALIZE_INFO(SharpnessLevel);
            SERIALIZE_INFO(NumTokenPartitions);
            SERIALIZE_INFO_ARRAY(LoopFilterRefTypeDelta);
            SERIALIZE_INFO_ARRAY(LoopFilterMbModeDelta);
            SERIALIZE_INFO_ARRAY(SegmentQPDelta);
            SERIALIZE_INFO_ARRAY(CoeffTypeQPDelta);
            SERIALIZE_INFO(WriteIVFHeaders);
            SERIALIZE_INFO(NumFramesForIVFHeader);
            SERIALIZE_INFO_ARRAY(reserved);
        }
        break;
    }
    // End of autogenerated code
}
Esempio n. 28
0
IOSTREAM *
Sopen_object(Any obj, const char *mode)
{ if ( instanceOfObject(obj, ClassFile) )
  { Name name = getOsNameFile(obj);
    IOSTREAM *s;

    if ( (s=Sopen_file(nameToFN(name), mode)) )
    { if ( !strchr(mode, 'b') )
      { FileObj f = obj;
	Name oldstat = f->status;
	IOSTREAM *ofd = f->fd;
	int rc;

					/* HACKS */
	f->status = (mode[0] == 'r' ? NAME_read : NAME_write);
	f->fd = s;

	switch(mode[0])
	{ case 'r':
	  { if ( (rc = doBOMFile(f)) )
	      setStreamEncodingSourceSink(obj, s);
	    break;
	  }
	  case 'w':
	  { setStreamEncodingSourceSink(obj, s);
	    rc = doBOMFile(f);
	    break;
	  }
	  default:
	  { setStreamEncodingSourceSink(obj, s);
	    rc = 0;
	  }
	}

	s->newline = (f->newline_mode == NAME_posix ? SIO_NL_POSIX :
		      f->newline_mode == NAME_dos   ? SIO_NL_DOS :
						      SIO_NL_DETECT);

	f->fd = ofd;
	f->status = oldstat;
	if ( !rc )
	  return NULL;
      }
      return s;
    }

    errorPce(obj, NAME_openFile,
	     mode[0] == 'r' ? NAME_read : NAME_write,
	     getOsErrorPce(PCE));

    return s;
  } else if ( instanceOfObject(obj, ClassRC) &&
	      TheCallbackFunctions.rc_open )
  { IOSTREAM *s;
    RC rc = obj;
    char *rc_class;

    if ( notDefault(rc->rc_class) )
      rc_class = strName(rc->rc_class);
    else
      rc_class = NULL;

    if ( notNil(rc->context) && TheCallbackFunctions.setHostContext )
    { Any savedcontext =
	(*TheCallbackFunctions.setHostContext)(rc->context);

      s = (*TheCallbackFunctions.rc_open)(strName(rc->name),
					  rc_class,
					  mode);
      (*TheCallbackFunctions.setHostContext)(savedcontext);
    } else
      s = (*TheCallbackFunctions.rc_open)(strName(rc->name),
					  rc_class,
					  mode);

    if ( !s )
      errorPce(obj, NAME_openFile,
	       mode[0] == 'r' ? NAME_read : NAME_write,
	       getOsErrorPce(PCE));

    return s;
  } else
  { int flags = SIO_TEXT|SIO_RECORDPOS;
    OpenObject h;
    IOSTREAM *stream;

    switch(mode[0])
    { case 'r':
	flags |= SIO_INPUT;
        break;
      case 'w':
	flags |= SIO_OUTPUT;
        break;
      default:
	errno = EINVAL;
        return NULL;
    }

    for(mode++; *mode; mode++)
    { switch(*mode)
      { case 'b':			/* binary */
	  flags &= ~SIO_TEXT;
	  break;
	case 'r':			/* no record */
	  flags &= ~SIO_RECORDPOS;
	  break;
	default:
	  errno = EINVAL;
	  return NULL;
      }
    }

    h = alloc(sizeof(*h));
    h->point = 0;
    h->object = obj;
    addCodeReference(obj);

    stream = Snew(h, flags, &Sobjectfunctions);

    if ( (flags&SIO_TEXT) )
      stream->encoding = ENC_WCHAR;	/* see comment above */
    else
      stream->encoding = ENC_OCTET;
    h->encoding = stream->encoding;

    return stream;
  }
}
Esempio n. 29
0
ecConfigItem *ecConfigToolView::DoFind(const wxString& what, wxWindow* parent)
{
    ecConfigToolDoc *pDoc = wxGetApp().GetConfigToolDoc();
    if (!pDoc)
        return NULL;
#if wxCHECK_VERSION(2, 6, 0)
    int nCount = pDoc->GetItems().GetCount();
#else
    int nCount = pDoc->GetItems().Number();
#endif

    // static LPCTSTR arWhereImage[]={_T("name"),_T("macro"),_T("description string"),_T("current value"),_T("default value")};
    
    wxString strFind(what);

    if(! wxGetApp().GetSettings().m_findMatchCase)
    {
        strFind.MakeLower();
    }
    
    wxTreeItemId h = wxGetApp().GetTreeCtrl()->GetSelection();

    int nItem;  
    if(!h){
        nItem=0;
    } else {
        for (nItem=nCount-1;nItem>=0;--nItem) {
            if(h==pDoc->GetItem(nItem)->GetTreeItem())
            {
                break;
            }
        }
        wxASSERT(nItem>=0);
    }
    
    ecConfigItem *pItem = NULL;

    int i;
    for (i=0 ; i < nCount ; i++)
    {
        if(wxGetApp().GetSettings().m_findDirection)
        {
            nItem=(nItem+1)%nCount;
        } else {
            nItem=(nCount+nItem-1)%nCount;
        }
        pItem = pDoc->GetItem(nItem);

        ecWhereType where = ecConfigItem::WhereStringToType(wxGetApp().GetSettings().m_findSearchWhat);
        
        wxString strName (pItem->StringValue(where));

        if (!wxGetApp().GetSettings().m_findMatchCase)
        {
            strName.MakeLower();
        }

        int nIndex = strName.Find(strFind);
        if(-1!=nIndex)
        {
            if (wxGetApp().GetSettings().m_findMatchWholeWord)
            {
                // Enforce whole-word semantics: to left and right
                if(nIndex>0 && IsWordChar(strName[(unsigned) (nIndex-1)])){
                    continue;
                }
                nIndex += strFind.Length();
                if (nIndex < strName.Length() && IsWordChar(strName[(unsigned) nIndex])){
                    continue;
                }
            }		
            break;
        }
    }

    if (i < nCount)
    {
        if(m_expandedForFind)
        {
            wxGetApp().GetTreeCtrl()->Collapse(m_expandedForFind);
        }

        wxTreeItemId h=pItem->GetTreeItem();
        // Is h visible?

        wxTreeItemId hv;

        for(hv=wxGetApp().GetTreeCtrl()->GetFirstVisibleItem();hv;hv=wxGetApp().GetTreeCtrl()->GetNextVisible(hv))
        {
            if(hv==h)
            {
                break;
            }
        }

#if wxCHECK_VERSION(2, 6, 0)
        if (!hv.IsOk())
#else
        if (0==hv)
#endif
        {
            // we want to record the highest unexpanded item
            for(hv=wxGetApp().GetTreeCtrl()->GetItemParent(h);hv;hv=wxGetApp().GetTreeCtrl()->GetItemParent(hv))
            {
                if (!wxGetApp().GetTreeCtrl()->IsExpanded( hv))
                {
                    m_expandedForFind = hv;
                }
            }
        }
        wxGetApp().GetTreeCtrl()->EnsureVisible(h);
        wxGetApp().GetTreeCtrl()->SelectItem(h);
        
    } else
    {
        wxString msg;
        msg.Printf(_("Cannot find '%s' in %s"), (const wxChar*) what, (const wxChar*) wxGetApp().GetSettings().m_findSearchWhat );
        wxMessageBox(msg, _("Find"), wxOK|wxICON_INFORMATION, parent);
    }

    return pItem;
}
Esempio n. 30
0
bool StoryDataCenter::ReadOneXmlItem(TiXmlElement* pElement)
{
	if (pElement == 0)
	{
		return false;
	}

	unsigned int taskID = 0;
	StroyData storyData;

	// Note: Parse TaskID
	TiXmlAttribute* pAttribute = pElement->FirstAttribute();
	while(pAttribute)
	{
		std::string strName(pAttribute->Name());
		std::string content = pElement->Attribute(strName.c_str());
		if (strName == "task_ID")
		{
			unsigned int task_id = atoi(content.c_str());
			taskID = task_id;
			storyData.setTaskId(task_id);
		}
		else if (strName == "instance_ID")
		{
			unsigned int task_id = atoi(content.c_str());
			taskID = task_id;
			storyData.setTaskId(task_id);
		}
		else if (strName == "map_ID")
		{
			unsigned int map_id = atoi(content.c_str());
			storyData.setMapId(map_id);
		}
		else if (strName == "camera")
		{
			float posx = 0;
			float posy = 0;
			if (SplitPosFromContent(content,posx,posy))
			{
				storyData.setCameraPos(ccp(posx,posy));
			}
		}
		else if (strName == "end_frame")
		{
			int endFrame = atoi(content.c_str());
			storyData.setEndFrame(endFrame);
		}
		else if (strName == "when")
		{
			int nWhen = atoi(content.c_str());
			storyData.setHappendAtWhen(nWhen);
		}
		else if (std::string::npos != strName.find("set_role_position_"))
		{
			unsigned int roleIndex = 0;
			if (SplitRoleID(strName,roleIndex))
			{
				std::vector<std::string> vecContent;
				SplitContent(content,vecContent);
				size_t vecSize = vecContent.size();
				for (size_t index = 0;index<vecSize;index++)
				{
					unsigned int frameIndex = 0;
					float posx = 0;
					float posy = 0;
					if(SplitFrameAndPosFromContent(vecContent[index],frameIndex,posx,posy))
					{
						storyData.InsertRolePosAtFrame(roleIndex,frameIndex,ccp(posx,posy));
					}
				}
			}	
		}
		else if (std::string::npos != strName.find("set_role_act_"))
		{
			unsigned int roleIndex = 0;
			if (SplitRoleID(strName,roleIndex))
			{
				std::vector<std::string> vecContent;
				SplitContent(content,vecContent);
				size_t vecSize = vecContent.size();
				for (size_t index = 0;index<vecSize;index++)
				{
					unsigned int frameIndex = 0;
					int actorId = 0;
					if (SplitFrameAndActorIdFromContent(vecContent[index],frameIndex,actorId))
					{
						storyData.InsertRoleActorAtFrame(roleIndex,frameIndex,actorId);
					}	
				}			
			}
		}
		else if (std::string::npos != strName.find("role_dialog_"))
		{
			unsigned int roleIndex = 0;
			if (SplitRoleID(strName,roleIndex))
			{
				std::vector<unsigned int> vecFrameIndex;
				std::vector<std::string> vecTextId;
				if (SplitFrameAndTextIdFromContent(content,vecFrameIndex,vecTextId))
				{
					size_t count = vecFrameIndex.size();
					for (size_t index = 0;index<count;index++)
					{
						storyData.InsertDialogTextIdAtFrame(roleIndex,vecFrameIndex[index],vecTextId[index]);
					}
				}
			}
		}
		else if (std::string::npos != strName.find("set_role_flip_"))
		{
			unsigned int roleIndex = 0;
			if (SplitRoleID(strName,roleIndex))
			{
				std::vector<std::string> vecContent;
				SplitContent(content,vecContent);
				size_t vecSize = vecContent.size();
				for (size_t index = 0;index<vecSize;index++)
				{
					unsigned int nFrame = 0;
					int nFlip = 0;

					if (SplitFrameAndActorIdFromContent(vecContent[index],nFrame,nFlip))
					{
						storyData.InsertIsFlipAtFrame(roleIndex,nFrame,nFlip);
					}
				}
			}
		}
		else if (std::string::npos != strName.find("set_role_icon_"))
		{
			unsigned int roleIndex = 0;
			if (SplitRoleID(strName,roleIndex))
			{
				storyData.SetRoleLeftIcon(roleIndex,content);
			}
		}
		else if (std::string::npos != strName.find("role_"))
		{
			unsigned int roleIndex = 0;
			if (SplitRoleID(strName,roleIndex))
			{
				unsigned int roleId = 0;
				roleId = atoi(content.c_str());
				//if (roleId == 0)
				//{
				//	roleId = UserData::Get()->getUserId();
				//}
				storyData.SetRoleIdAtIndex(roleIndex,roleId);
			}
		}
		else
		{
			CCError("StoryDataCenter::ReadOneXmlItem() %s attribute undefined ",strName.c_str());
		}

		pAttribute = pAttribute->Next();
	}	

	if (taskID != 0)
	{
		mVecTaskIdAndStoryData.push_back(storyData);

		//bool bHasSameId = false;
		//for (std::vector<StroyData>::iterator iter = mVecTaskIdAndStoryData.begin();
		//	 iter != mVecTaskIdAndStoryData.end(); iter++)
		//{
		//	unsigned int id = (*iter).getTaskId();
		//	if (id == taskID)
		//	{
		//		bHasSameId = true;
		//		break;
		//	}
		//}
		//if (false == bHasSameId)
		//{
		//	mVecTaskIdAndStoryData.push_back(storyData);
		//}
		//else
		//{
		//	CCError("ERROR: mVecTaskIdAndStoryData repeat key %d",taskID);
		//}
	}

	return true;
}