Esempio n. 1
0
AAFRESULT ImplAAFTypeDefExtEnum::LookupValByName(aafUID_t *pVal, const aafCharacter *pName)
{
	aafUInt32 i=0;
	aafUInt32 count=0;
	aafBoolean_t  bFound = kAAFFalse;
	aafCharacter Name_buf[256]; 
	aafUInt32 bufSize = 256;
	
	check_hr ( CountElements(&count) );
	while ( (i<count) && !bFound)
	{
		check_hr ( GetElementName (i, Name_buf, bufSize) );
		if ( wcscmp (Name_buf, pName) == 0 ) //matched
		{
			bFound = kAAFTrue;
			
			check_hr (GetElementValue(i, pVal));
			break;
			
		}//if
		i++;
	}//while

	if (!bFound)
		return AAFRESULT_INVALID_PARAM;

	return AAFRESULT_SUCCESS;
}
Esempio n. 2
0
AAFRESULT STDMETHODCALLTYPE
ImplAAFTypeDefExtEnum::GetNameBufLenFromAUID (
											  const aafUID_t & value,
											  aafUInt32 * pLen)
{
	if (! pLen)
		return AAFRESULT_NULL_PARAM;
	
	aafUInt32 i;
	aafUInt32 count;
	AAFRESULT hr;
	hr = CountElements(&count);
	if (AAFRESULT_FAILED(hr))
		return hr;
	for (i = 0; i < count; i++)
	{
		aafUID_t val;
		hr = GetElementValue (i, &val);
		if (AAFRESULT_FAILED(hr))
			return hr;
		if (EqualAUID (&val, &value))
		{
			aafUInt32 len;
			hr = GetElementNameBufLen(i, &len);
			if (AAFRESULT_FAILED(hr))
				return hr;
			ASSERTU (pLen);
			*pLen = len;
			return AAFRESULT_SUCCESS;
		}
	}
	// fell out of for() loop, so we didn't find it.
	return AAFRESULT_ILLEGAL_VALUE;
}
Esempio n. 3
0
CPDF_Stream* CPDF_Array::GetStream(FX_DWORD i) const
{
    CPDF_Object* p = GetElementValue(i);
    if (p == NULL || p->GetType() != PDFOBJ_STREAM) {
        return NULL;
    }
    return (CPDF_Stream*)p;
}
Esempio n. 4
0
CPDF_Array* CPDF_Array::GetArray(FX_DWORD i) const
{
    CPDF_Object* p = GetElementValue(i);
    if (p == NULL || p->GetType() != PDFOBJ_ARRAY) {
        return NULL;
    }
    return (CPDF_Array*)p;
}
Esempio n. 5
0
CPDF_Array* CPDF_Dictionary::GetArray(FX_BSTR key) const
{
    CPDF_Object* p = GetElementValue(key);
    if (p == NULL || p->GetType() != PDFOBJ_ARRAY) {
        return NULL;
    }
    return (CPDF_Array*)p;
}
Esempio n. 6
0
CPDF_Stream* CPDF_Dictionary::GetStream(FX_BSTR key) const
{
    CPDF_Object* p = GetElementValue(key);
    if (p == NULL || p->GetType() != PDFOBJ_STREAM) {
        return NULL;
    }
    return (CPDF_Stream*)p;
}
CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const {
  CPDF_Object* p = GetElementValue(key);
  if (!p)
    return nullptr;
  if (CPDF_Dictionary* pDict = p->AsDictionary())
    return pDict;
  if (CPDF_Stream* pStream = p->AsStream())
    return pStream->GetDict();
  return nullptr;
}
CPDF_Dictionary* CPDF_Array::GetDict(FX_DWORD i) const {
  CPDF_Object* p = GetElementValue(i);
  if (!p)
    return NULL;
  if (CPDF_Dictionary* pDict = p->AsDictionary())
    return pDict;
  if (CPDF_Stream* pStream = p->AsStream())
    return pStream->GetDict();
  return NULL;
}
Esempio n. 9
0
CPDF_Dictionary* CPDF_Dictionary::GetDict(FX_BSTR key) const
{
    CPDF_Object* p = GetElementValue(key);
    if (p == NULL) {
        return NULL;
    } else if (p->GetType() == PDFOBJ_DICTIONARY) {
        return (CPDF_Dictionary*)p;
    } else if (p->GetType() == PDFOBJ_STREAM) {
        return ((CPDF_Stream*)p)->GetDict();
    }
    return NULL;
}
Esempio n. 10
0
CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const
{
    CPDF_Object* p = GetElementValue(key);
    if (!p) {
        return nullptr;
    }
    if (p->GetType() == PDFOBJ_DICTIONARY) {
        return (CPDF_Dictionary*)p;
    }
    if (p->GetType() == PDFOBJ_STREAM) {
        return ((CPDF_Stream*)p)->GetDict();
    }
    return nullptr;
}
Esempio n. 11
0
CPDF_Dictionary* CPDF_Array::GetDict(FX_DWORD i) const
{
    CPDF_Object* p = GetElementValue(i);
    if (!p) {
        return NULL;
    }
    if (p->GetType() == PDFOBJ_DICTIONARY) {
        return (CPDF_Dictionary*)p;
    }
    if (p->GetType() == PDFOBJ_STREAM) {
        return ((CPDF_Stream*)p)->GetDict();
    }
    return NULL;
}
Esempio n. 12
0
AAFRESULT STDMETHODCALLTYPE
ImplAAFTypeDefExtEnum::GetNameFromAUID (
										const aafUID_t & value,
										wchar_t * pName,
										aafUInt32 bufSize)
{
	if (! pName)
		return AAFRESULT_NULL_PARAM;
	
	AAFRESULT hr;
	aafUInt32 len;
	// following call may return AAFRESULT_ILLEGAL_VALUE if value isn't
	// recognized
	hr = GetNameBufLenFromAUID (value, &len);
	if (AAFRESULT_FAILED(hr))
		return hr;
	
	// len includes space for trailing null
	if (bufSize < len)
		return AAFRESULT_SMALLBUF;
	
	aafUInt32 i;
	aafUInt32 count;
	hr = CountElements(&count);
	if (AAFRESULT_FAILED(hr))
		return hr;
	for (i = 0; i < count; i++)
	{
		aafUID_t val;
		hr = GetElementValue (i, &val);
		if (AAFRESULT_FAILED(hr))
			return hr;
		if (EqualAUID (&val, &value))
		{
			// given integer value matches value of "i"th element.
			hr = GetElementName(i, pName, bufSize);
			if (AAFRESULT_FAILED(hr))
				return hr;
			return AAFRESULT_SUCCESS;
		}
	}
	// fell out of for() loop, so we didn't find it.
	// redundant, since GetNameBufLenFromInteger() should have already
	// found it.
	return AAFRESULT_ILLEGAL_VALUE;
}
CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const {
  return ToStream(GetElementValue(key));
}
ECode CVariableOfCarArray::GetObjectPtrElement(
    /* [in] */ Int32 index,
    /* [out] */ PInterface* value)
{
    return GetElementValue(index, value, CarDataType_Interface);
}
ECode CVariableOfCarArray::GetECodeElement(
    /* [in] */ Int32 index,
    /* [out] */ ECode* value)
{
    return GetElementValue(index, value, CarDataType_ECode);
}
ECode CVariableOfCppVector::GetLocalTypeElement(
    /* [in] */ Int32 index,
    /* [out] */ PVoid value)
{
    return GetElementValue(index, value, CarDataType_LocalType);
}
ECode CVariableOfCppVector::GetEnumElement(
    /* [in] */ Int32 index,
    /* [out] */ Int32* value)
{
    return GetElementValue(index, value, CarDataType_Enum);
}
ECode CVariableOfCppVector::GetDoubleElement(
    /* [in] */ Int32 index,
    /* [out] */ Double* value)
{
    return GetElementValue(index, value, CarDataType_Double);
}
ECode CVariableOfCppVector::GetBooleanElement(
    /* [in] */ Int32 index,
    /* [out] */ Boolean* value)
{
    return GetElementValue(index, value, CarDataType_Boolean);
}
Esempio n. 20
0
int C51JobWebPost::GetHtmlCtrl(IHTMLDocument2 *pDoc2)
{
	if(pDoc2==NULL)
	{
		return 0;
	}
	IHTMLElementCollection   *pColl=NULL;
	HRESULT hr=pDoc2->get_all(&pColl);
	if(SUCCEEDED(hr)   &&   pColl!=NULL)   
	{   
		long   lcount   =   0;   
		pColl->get_length(&lcount);
		CString strName = "name";
		BSTR bstrText = strName.AllocSysString();
		int iFindCount = 0;
		for(int i=0;i<lcount;i++)   
		{
			if (iFindCount >= 8)
			{
				//break;
			}
			CComVariant   index;   
			index.vt=VT_I4;   
			index.intVal=i;   
			CComPtr<IDispatch>   disp;   
			pColl->item(index,index,&disp);   
			if(disp==NULL)   
				hr=E_FAIL;   
			else   
			{
				CComPtr<IHTMLElement>   pElement;
				hr=disp->QueryInterface(IID_IHTMLElement,
					(void**)&pElement);
				if(SUCCEEDED(hr))   
				{   
					BSTR   bstrID;					
					pElement->get_id(&bstrID);
					CString strID(bstrID);
					VARIANT  varValue;
					pElement->getAttribute(bstrText,0,&varValue);
					strID.MakeLower();
					if (strID == "machineserial")		//email name repassword password
					{
						m_strMac = GetElementValue(pElement);
						ShowMessage(m_strMac);
					}
					else if (strID == "transactionid")
					{
						m_strTrans = GetElementValue(pElement);
						ShowMessage(m_strTrans);
					}
					else if (strID == "verify")
					{
						//找到VERIFY
						//ShowMessage("找到verify");
						m_strVerify = GetElementValue(pElement);
						ShowMessage(m_strVerify);
						break;
					}
				}
			}
		}
		::SysFreeString(bstrText);
		pColl->Release();   
	}   
	pDoc2->Release();
	return 0;
}
ECode CVariableOfCppVector::GetFloatElement(
    /* [in] */ Int32 index,
    /* [out] */ Float* value)
{
    return GetElementValue(index, value, CarDataType_Float);
}
ECode CVariableOfCarArray::GetStringElement(
    /* [in] */ Int32 index,
    /* [out] */ String* value)
{
    return GetElementValue(index, value, CarDataType_String);
}
CPDF_Array* CPDF_Dictionary::GetArray(const CFX_ByteStringC& key) const {
  return ToArray(GetElementValue(key));
}
ECode CVariableOfCarArray::GetCharElement(
    /* [in] */ Int32 index,
    /* [out] */ Char32* value)
{
    return GetElementValue(index, value, CarDataType_Char32);
}
CPDF_Array* CPDF_Array::GetArray(FX_DWORD i) const {
  return ToArray(GetElementValue(i));
}
CPDF_Stream* CPDF_Array::GetStream(FX_DWORD i) const {
  return ToStream(GetElementValue(i));
}
Esempio n. 27
0
BOOL ParseXMLElements(const TCHAR * config_file_name)
{
	BOOL bRet = TRUE;
	// 
	DWORD dwNum = WideCharToMultiByte(CP_OEMCP,NULL,config_file_name,-1,NULL,0,NULL,FALSE);
	char * file_name = new char[dwNum];
	if (!file_name)
	{
		return FALSE;
	}
	
	WideCharToMultiByte(CP_OEMCP,NULL,config_file_name,-1,file_name,dwNum,NULL,FALSE);

	TiXmlDocument document(file_name);
	if(!document.LoadFile(TIXML_ENCODING_UTF8))
	{
		bRet = FALSE;
		goto cleanup;
	}

	const TiXmlElement* pRootElement = document.RootElement();
	if (NULL == pRootElement)
	{
		bRet = FALSE;
		goto cleanup;
	}

	//get the  resource download url
	GetElementValue(pRootElement, "resUrl", g_resUrl);
	if (NULL == g_resUrl)
	{
		bRet = FALSE;
		goto cleanup;
	}


	const TiXmlElement* pDefaultElement = pRootElement->FirstChildElement("default");
	
	//default extensions
	if (NULL == pDefaultElement)
	{
		bRet = FALSE;
		goto cleanup;
	}
	
	for(const TiXmlElement* pDefaultExtension = pDefaultElement->FirstChildElement();pDefaultExtension;pDefaultExtension = pDefaultExtension->NextSiblingElement())
	{
		defaultExtensionInfo defaultExtension;
		TCHAR * pDefault = NULL;
		if (!GetElementValue(pDefaultExtension, "file", defaultExtension.file))
		{
			bRet = FALSE;
			goto cleanup;
		}
		if (GetElementValue(pDefaultExtension, "unpacked", pDefault))
		{
			if (_tcsicmp(pDefault, _T("true")) == 0 || _tcsicmp(pDefault, _T("1")) == 0)
			{
				defaultExtension.unpacked = true;
			}		
		}
		g_defaultExtensions.push_back(defaultExtension);
	}
	

	const TiXmlNode* node = NULL;
	node = pRootElement->FirstChildElement()->NextSibling();

	// group
	for (node = node->NextSibling(); node; node = node->NextSibling())
	{	
		// groupInfo
		const TiXmlElement* pGroupInfo = node->FirstChildElement("groupInfo");
		if (NULL == pGroupInfo)
		{
			bRet = FALSE;
			goto cleanup;
		}
		
		TCHAR * pDefaultSelected = NULL;
		TCHAR * pDefaultUnpacked = NULL;
		TCHAR * pType =NULL;
		GroupInfo group;

		// group description
		if (!GetElementValue(pGroupInfo, "discription", group.description))
		{
			bRet = FALSE;
			goto cleanup;
		}
		// group picture 
		if (!GetElementValue(pGroupInfo, "picture", group.picture_url))
		{
			bRet = FALSE;
			goto cleanup;
		}
		// intro 1 
		if (!GetElementValue(pGroupInfo, "intro1", group.intro[0]))
		{
			bRet = FALSE;
			goto cleanup;
		}
		// intro 2
		if (!GetElementValue(pGroupInfo, "intro2", group.intro[1]))
		{
			bRet = FALSE;
			goto cleanup;
		}
		// intro 3
		if (!GetElementValue(pGroupInfo, "intro3", group.intro[2]))
		{
			bRet = FALSE;
			goto cleanup;
		}
		// intro 4
		if (!GetElementValue(pGroupInfo, "intro4", group.intro[3]))
		{
			bRet = FALSE;
			goto cleanup;
		}
		if (GetElementValue(pGroupInfo, "selected", pDefaultSelected))
		{
			if (_tcsicmp(pDefaultSelected, _T("true")) == 0 || _tcsicmp(pDefaultSelected, _T("1")) == 0)
			{
				group.checked = true;
			}
			//delete[] pDefaultSelected;
		}

		// extensions
		const TiXmlElement* pExtensions = node->FirstChildElement("extensions");
		if (NULL == pExtensions)
		{
			bRet = FALSE;
			goto cleanup;
		}

		for (const TiXmlElement* extension = pExtensions->FirstChildElement(); extension; extension = extension->NextSiblingElement())
		{	
			ExtensionInfo extInfo;
			
			// extension name
			if (!GetElementValue(extension, "name", extInfo.name))
			{
				bRet = FALSE;
				goto cleanup;
			}
			// extension file
			if (!GetElementValue(extension, "file", extInfo.file))
			{
				bRet = FALSE;
				goto cleanup;
			}
			// extension picture
			if (!GetElementValue(extension, "picture", extInfo.picture_url))
			{
				bRet = FALSE;
				goto cleanup;
			}
			// extension intro1
			if (!GetElementValue(extension, "intro1", extInfo.intro[0]))
			{
				bRet = FALSE;
				goto cleanup;
			}
			// extension intro2
			if (!GetElementValue(extension, "intro2", extInfo.intro[1]))
			{
				bRet = FALSE;
				goto cleanup;
			}
			// extension intro3
			if (!GetElementValue(extension, "intro3", extInfo.intro[2]))
			{
				bRet = FALSE;
				goto cleanup;
			}
			// extension intro4
			if (!GetElementValue(extension, "intro4", extInfo.intro[3]))
			{
				bRet = FALSE;
				goto cleanup;
			}

			if (GetElementValue(extension, "selected", pDefaultSelected))
			{
				if (_tcsicmp(pDefaultSelected, _T("true")) == 0 || _tcsicmp(pDefaultSelected, _T("1")) == 0)
				{
					extInfo.checked = true;
				}
				delete[] pDefaultSelected;
			}
			if (GetElementValue(extension, "unpacked", pDefaultUnpacked))
			{
				if (_tcsicmp(pDefaultUnpacked, _T("true")) == 0 || _tcsicmp(pDefaultUnpacked, _T("1")) == 0)
				{
					extInfo.unpacked = true;
				}
				delete[] pDefaultUnpacked;
			}
			if (!GetElementValue(extension, "url", extInfo.url))
			{
				bRet = FALSE;
				goto cleanup;
			}
			if (!GetElementValue(extension, "cmd", extInfo.cmd))
			{
				bRet = FALSE;
				goto cleanup;
			}
			if (GetElementValue(extension, "type", pType))
			{
				extInfo.type = _wtoi(pType);
			}
			if (!GetElementValue(extension, "id", extInfo.id))
			{
				bRet = FALSE;
				goto cleanup;
			}

			group.extensions.push_back(extInfo);
		}
	
		g_groupsInfo.push_back(group);
	}

cleanup:
	delete[] file_name;
	return bRet;
}
Esempio n. 28
0
int C51JobWebPost::GetHtmlCtrl(IHTMLDocument2 *pDoc2)
{
	if(pDoc2==NULL)
	{
		return 0;
	}
	IHTMLElementCollection   *pColl=NULL;
	HRESULT hr=pDoc2->get_all(&pColl);
	if(SUCCEEDED(hr)   &&   pColl!=NULL)   
	{   
		long   lcount   =   0;   
		pColl->get_length(&lcount);
		CString strName = "name";
		BSTR bstrText = strName.AllocSysString();
		//CString strValue = "onfocus";
		//BSTR bstrValue = strName.AllocSysString();
		int iFindCount = 0;
		for(int i=0;i<lcount;i++)   
		{
			if (iFindCount >= 8)
			{
				//break;
			}
			CComVariant   index;   
			index.vt=VT_I4;   
			index.intVal=i;   
			CComPtr<IDispatch>   disp;   
			pColl->item(index,index,&disp);   
			if(disp==NULL)   
				hr=E_FAIL;   
			else   
			{
				CComPtr<IHTMLElement>   pElement;
				//CComPtr<IHTMLImgElement> pImg;
				hr=disp->QueryInterface(IID_IHTMLElement,
					(void**)&pElement);
				if(SUCCEEDED(hr))   
				{   
					BSTR   bstrID;					
					pElement->get_id(&bstrID);
					CString strID(bstrID);
					VARIANT  varValue;
					pElement->getAttribute(bstrText,0,&varValue);
					strID.MakeLower();
					//pElement->
// 					CString strValue = "";
// 					if (varValue.vt == VT_BSTR)
// 					{
// 						strValue.Format ("%s",(const char*)(_bstr_t)(_variant_t)varValue);
// 					}
// 					strValue.MakeLower();
// 					ShowMessage(strValue);
// 					if (strID == "imgReg")
// 					{
// 						ShowMessage("找到注册按钮");
// 						//m_pRegBtn = pElement;
// 						iFindCount ++;
// 						//pElement->click();
// 					}
// 					else if (strID == "introducer")
// 					{
// 						ShowMessage("找到推荐人输入框");
// 						//pElement->setAttribute(bstrValue,"aa",0);
// 						//pElement->
// 						//pUserIntroman = (CComPtr<IHTMLInputTextElement>)pElement;
// 						iFindCount ++;
// 					}
					if (strID == "machineserial")		//email name repassword password
					{
						//ShowMessage("找到MAC地址隐藏域");
						m_strMac = GetElementValue(pElement);
						ShowMessage(m_strMac);
						//iFindCount ++;
					}
// 					else if (strID == "username")		
// 					{
// 						ShowMessage("找到USERNAME");
// 						iFindCount ++;
// 					}
// 					else if (strID == "userpwd")
// 					{
// 						ShowMessage("找到密码");
// 						iFindCount ++;
// 					}
// 					else if (strID == "repassword" || strValue == "repassword")
// 					{
// 						ShowMessage("找到密码确认");
// 						iFindCount ++;
// 					}
// 					else if (strID == "checkcode" || strValue == "checkcode")
// 					{
// 						ShowMessage("找到验证码");
// 						iFindCount ++;
// 					}
					else if (strID == "transactionid")
					{
						//找到TRANS
						//ShowMessage("找到TRANS");
						m_strTrans = GetElementValue(pElement);
						ShowMessage(m_strTrans);
					}
					else if (strID == "verify")
					{
						//找到VERIFY
						//ShowMessage("找到verify");
						m_strVerify = GetElementValue(pElement);
						ShowMessage(m_strVerify);
						break;
					}
				}
			}
		}
		::SysFreeString(bstrText);
		pColl->Release();   
	}   
	pDoc2->Release();
	return 0;
}