亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? myhttpclient.cpp

?? 自定義HttpClient類
?? CPP
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
	// If the specified key name does not exist in the map
	if ( cKeys.Value () == 0 )
		return FALSE ;

	// Allocates memory to save pointers to key name.
	// If the allocation failed, the memory pointed by the key name pointer are leaked.
	::SafeInt<size_t>	cbRequired ;
	PCSZ *				arrKeys = NULL ;
	try {
		cbRequired = cKeys ;
		cbRequired *= sizeof (PCSZ) ;
		arrKeys = (PCSZ *) ::malloc (cbRequired.Value ()) ;
	} catch (::SafeIntException &) {
		arrKeys = NULL ;
	}

	std::pair<MapIter, MapIter>		pairIter = m_map.equal_range (szName) ;

	MapSizeType		nIdx = 0 ;
	for (MapIter iter = pairIter.first; iter != pairIter.second; ++iter) {
		(iter->second).Delete () ;

		// Saves the key name pointer
		if ( arrKeys )
			arrKeys[nIdx++] = iter->first ;
	}

	m_map.erase (pairIter.first, pairIter.second) ;

	if ( arrKeys == NULL )
		return TRUE ;

	for (nIdx = 0; nIdx < cKeys; nIdx++)
		SAFEFREE ( arrKeys[nIdx] ) ;
	SAFEFREE ( arrKeys ) ;

	return TRUE ;
}

// This function deletes an element of which the key name equals to szName and the index is nIdx.
// If some data cleared, it will return TRUE, otherwise return FALSE.
template <typename HttpTool>
BOOL CHttpClientMapT<HttpTool>::Remove (PCSZ szName, DWORD nIdx)
	throw (Exception &)
{
	HTTPCLIENT_ASSERT (szName != NULL, "CHttpClientMapT::Remove: szName can not be NULL.") ;

	std::pair<MapIter, MapIter>		pairIter = m_map.equal_range (szName) ;

	// If the specified key name does not exist in the map
	if ( pairIter.first == pairIter.second )
		return FALSE ;

	MapIter iter = pairIter.first ;
	for (DWORD i = 0; i < nIdx; i++) {
		++iter ;

		// If the nIdx is out of range.
		if ( iter == pairIter.second )
			return FALSE ;
	}

	// Deletes the element
	(iter->second).Delete () ;
	PCSZ	szKeyName = iter->first ;
	m_map.erase (iter) ;
	SAFEFREE (szKeyName) ;

	return TRUE ;
}

template <typename HttpTool>
BOOL CHttpClientMapT<HttpTool>::Exists (PCSZ szName, DWORD nIdx)
	throw (Exception &)
{
	HTTPCLIENT_ASSERT (szName != NULL, "CHttpClientMapT::Exists: szName can not be NULL.") ;

	::SafeInt<MapSizeType>		cKeys = m_map.count (szName) ;
	return (cKeys > nIdx) ;
}

// If the szName is NULL, it will return the count of elements.
template <typename HttpTool>
DWORD CHttpClientMapT<HttpTool>::Count (PCSZ szName)
	throw ()
{
	::SafeInt<DWORD>		cKeys ;
	try {
		cKeys = szName ? m_map.count (szName) : m_map.size () ;
	} catch (::SafeIntException &) {
		cKeys = cKeys.MaxInt () ;	// This statement is never executed.
	}
	return cKeys.Value () ;
}

template <typename HttpTool>
BOOL CHttpClientMapT<HttpTool>::Empty (void) const
	throw ()
{
	return m_map.empty () ? TRUE : FALSE ;
}

// If the nIdx is not valid, it will return NULL.
template <typename HttpTool>
typename CHttpClientMapT<HttpTool>::PCSZ
CHttpClientMapT<HttpTool>::GetKey (DWORD nIdx)
	throw ()
{
	if ( m_map.empty () )
		return NULL ;

	MapIter		iter = m_map.begin () ;
	for (DWORD i = 0; i < nIdx; i++) {
		++iter ;

		// If the nIdx is not valid.
		if ( iter == m_map.end () )
			return NULL ;
	}
	return iter->first ;
}

// If the specified element is not found in position nIdx,
// returns MapValue of which szValue is NULL.
template <typename HttpTool>
typename CHttpClientMapT<HttpTool>::MapValue
CHttpClientMapT<HttpTool>::Get (DWORD nIdx)
	throw ()
{
	MapValue	mapValue = { NULL, 0 } ;

	if ( m_map.empty () )
		return mapValue ;

	MapIter		iter = m_map.begin () ;
	for (DWORD i = 0; i < nIdx; i++) {
		++iter ;

		// If the nIdx is not valid.
		if ( iter == m_map.end () )
			return mapValue ;
	}

	mapValue = iter->second ;
	if ( mapValue.szValue == NULL )
		mapValue.szValue = HttpTool::szEmptyString ;

	return mapValue ;
}

// If the specified element is not found, it will return NULL.
template <typename HttpTool>
typename CHttpClientMapT<HttpTool>::PCSZ
CHttpClientMapT<HttpTool>::GetValue (DWORD nIdx)
	throw ()
{
	return Get (nIdx).szValue ;
}

// Returns 0 if the specified element is not found.
// (If the dwFlag in MapValue is 0, it also returns 0)
template <typename HttpTool>
DWORD CHttpClientMapT<HttpTool>::GetFlag (DWORD nIdx)
	throw ()
{
	return Get (nIdx).dwFlag ;
}

// If the specified element is not found, returns MapValue of which szValue is NULL.
template <typename HttpTool>
typename CHttpClientMapT<HttpTool>::MapValue
CHttpClientMapT<HttpTool>::Get (PCSZ szName, DWORD nIdx)
	throw (Exception &)
{
	HTTPCLIENT_ASSERT (szName != NULL, "CHttpClientMapT::Get: szName can not be NULL.") ;

	MapValue	mapValue = { NULL, 0 } ;
	std::pair<MapIter, MapIter>	pairIter ;
	pairIter = m_map.equal_range (szName) ;

	// If the key is not found.
	if ( pairIter.first == pairIter.second )
		return mapValue ;

	MapIter iter = pairIter.first ;
	for (DWORD i = 0; i < nIdx; i++) {
		++iter ;

		// If the nIdx is not valid
		if ( iter == pairIter.second )
			return mapValue ;
	}

	mapValue = iter->second ;
	if ( mapValue.szValue == NULL )
		mapValue.szValue = HttpTool::szEmptyString ;

	return mapValue ;
}

// Returns NULL if the specified element is not found.
template <typename HttpTool>
typename CHttpClientMapT<HttpTool>::PCSZ
CHttpClientMapT<HttpTool>::GetValue (PCSZ szName, DWORD nIdx)
	throw ()
{
	return Get (szName, nIdx).szValue ;
}

// Returns 0 if the specified element is not found.
// (If the dwFlag in MapValue is 0, it also returns 0)
template <typename HttpTool>
DWORD CHttpClientMapT<HttpTool>::GetFlag (PCSZ szName, DWORD nIdx)
	throw ()
{
	return Get (szName, nIdx).dwFlag ;
}

// Adds a new MapValue. It also receives the ownership of memory pointed by szName and szValue.
// The szName and szValue must be allocated by using ::malloc.
// The szValue could be NULL.
template <typename HttpTool>
void CHttpClientMapT<HttpTool>::AddPointerDirectly (PSZ szName, PSZ szValue, BOOL dwFlag)
	throw (Exception &)
{
	HTTPCLIENT_ASSERT (szName != NULL, "CHttpClientMapT::AddPointerDirectly: szName can not be NULL.") ;

	try {
		// Checks the arithmetic overflow exception
		::SafeInt<MapSizeType>	cKeys = Count () ;
		::SafeInt<DWORD>		cdwKeys = cKeys ;
		cKeys++ ;
		cdwKeys++ ;

		MapValue	newValue = { (PCSZ) szValue, dwFlag } ;
		m_map.insert (MapItem ((PCSZ) szName, newValue)) ;
	} catch (::SafeIntException & e) {
		HttpTool::ThrowException (e) ;
	} catch (std::exception & e) {
		HttpTool::ThrowException (e.what (), HTTPCLIENT_ERR_STD_EXCEPTION) ;
	} catch (...) {
		HttpTool::ThrowException (HTTPCLIENT_ERR_UNEXPECTED_ERROR) ;
	}
}

// The szValue could be NULL.
template <typename HttpTool>
void CHttpClientMapT<HttpTool>::Add (PCSZ szName, PCSZ szValue, BOOL dwFlag)
	throw (Exception &)
{
	HTTPCLIENT_ASSERT (szName != NULL, "CHttpClientMapT::Add: szName can not be NULL.") ;

	PSZ					szNewName = NULL ;
	PSZ					szNewValue = NULL ;
	::SafeInt<size_t>	cbName, cbValue ;

	try {
		cbName = HttpTool::StringLen (szName) ;
		cbName++ ;
		cbName *= sizeof (CharType) ;

		szNewName = (PSZ) ::malloc (cbName.Value ()) ;
		if ( szNewName == NULL )
			HttpTool::ThrowException (HTTPCLIENT_ERR_OUT_OF_MEMORY) ;
		HttpTool::StringCopy (szNewName, szName) ;

		if ( szValue != NULL ) {
			cbValue = HttpTool::StringLen (szValue) ;
			cbValue++ ;
			cbValue *= sizeof (CharType) ;

			szNewValue = (PSZ) ::malloc (cbValue.Value ()) ;
			if ( szNewValue == NULL )
				HttpTool::ThrowException (HTTPCLIENT_ERR_OUT_OF_MEMORY) ;
			HttpTool::StringCopy (szNewValue, szValue) ;
		}
		AddPointerDirectly (szNewName, szNewValue, dwFlag) ;

	} catch (::SafeIntException & e) {
		SAFEFREE (szNewName) ;
		SAFEFREE (szNewValue) ;
		HttpTool::ThrowException (e) ;
	} catch (Exception &) {
		SAFEFREE (szNewName) ;
		SAFEFREE (szNewValue) ;
		throw ;
	}
}

// If the specified element is not found, it will add a new value.
// otherwise it will modifiy the existing value.
// The szValue could be NULL.
template <typename HttpTool>
void CHttpClientMapT<HttpTool>::Set (PCSZ szName, PCSZ szValue, BOOL dwFlag, DWORD nIdx)
	throw (Exception &)
{
	HTTPCLIENT_ASSERT (szName != NULL, "CHttpClientMapT::Set: szName can not be NULL.") ;

	std::pair<MapIter, MapIter>	pairIter ;
	pairIter = m_map.equal_range (szName) ;

	// Adds a new value if the specified element is not found.
	if ( pairIter.first == pairIter.second ) {
		// The nIdx must be 0
		_ASSERTE ( nIdx == 0 ) ;
		Add (szName, szValue, dwFlag) ;
		return ;
	}

	MapIter iter = pairIter.first ;
	for (DWORD i = 0; i < nIdx; i++) {
		++iter ;

		// The nIdx must be valid
		_ASSERTE ( iter != pairIter.second ) ;
	}

	MapValue		newValue = { NULL, dwFlag } ;
	if ( szValue ) {
		::SafeInt<size_t>		cbValue ;

		try {
			cbValue = HttpTool::StringLen (szValue) ;
			cbValue++ ;
			cbValue *= sizeof (CharType) ;
		} catch (::SafeIntException & e) {
			HttpTool::ThrowException (e) ;
		}

		newValue.szValue = (PCSZ) ::malloc (cbValue.Value ()) ;
		if ( newValue.szValue == NULL )
			HttpTool::ThrowException (HTTPCLIENT_ERR_OUT_OF_MEMORY) ;

		HttpTool::StringCopy ((PSZ) newValue.szValue, szValue) ;
	}

	MapValue		oldValue = iter->second ;
	iter->second = newValue ;
	oldValue.Delete () ;
}

template <typename HttpTool>
typename CHttpClientMapT<HttpTool>::ConstMapIter
CHttpClientMapT<HttpTool>::Begin (void) const
	throw ()
{
	return m_map.begin () ;
}

template <typename HttpTool>
typename CHttpClientMapT<HttpTool>::ConstMapIter
CHttpClientMapT<HttpTool>::End (void) const
	throw ()
{
	return m_map.end () ;
}
///////////////////////////////////////// CHttpClientMapT /////////////////////////////////////////


///////////////////////////////////////// CHttpEncoder /////////////////////////////////////////
/*!
 * This method has no meaning because the input string is an Ansi string.
 * It just returns the length of the input string.
 *
 * \param szStr			[in] A string which is encoded.
 * \param CodePage		[in] Ignored.
 * \return				The number of bytes required. (Not including the terminating NULL character)
 * \throw				Throws a httpclientexception if an error occurs.
 */
DWORD CHttpEncoderA::AnsiEncodeLen (PCSTR szStr, UINT /* CodePage */)
	throw (Exception &)
{
	if ( szStr == NULL || szStr[0] == '\0' )
		return 0 ;

	::SafeInt<DWORD>	dwLen ;
	try {
		dwLen = ::strlen (szStr) ;
	} catch (::SafeIntException & e) {
		CHttpToolA::ThrowException (e) ;
	}
	return dwLen.Value () ;
}

/*!
 * This method has no meaning because the input string is an Ansi string.
 * It just returns the copy of the input string.
 *
 * \param szBuff		[out] A buffer to save the encoded string. The buffer can not be NULL.
 * \param szStr			[in] A string which is encoded.
 * \param CodePage		[in] Ignored.
 * \return				An encoded string.
 * \throw				Throws a httpclientexception if an error occurs.
 */
PSTR CHttpEncoderA::AnsiEncode (PSTR szBuff, PCSTR szStr, UINT /* CodePage */)
	throw (Exception &)
{
	HTTPCLIENT_ASSERTA (szBuff != NULL, "CHttpEncoderA::AnsiEncode: szBuff can not be NULL.") ;

	if ( (szStr == NULL) || (szStr[0] == '\0') ) {
		szBuff[0] = '\0' ;
		return szBuff ;
	}
	return ::strcpy (szBuff, szStr) ;
}

/*!
 * This method has no meaning because the decoded string is an Ansi string.
 * It just returns the length of the input string.
 *
 * \param szEncoded		[in] A string to decode.
 * \param CodePage		[in] Ignored.
 * \return				The number of bytes required. (Not including the terminating NULL character)
 * \throw				Throws a httpclientexception if an error occurs.
 */
DWORD CHttpEncoderA::AnsiDecodeLen (PCSTR szEncoded, UINT /* CodePage */)
	throw (Exception &)
{
	if ( szEncoded == NULL || szEncoded[0] == '\0' )
		return 0 ;

	::SafeInt<DWORD>	dwLen ;
	try {
		dwLen = ::strlen (szEncoded) ;
	} catch (::SafeIntException & e) {
		CHttpToolA::ThrowException (e) ;
	}
	return dwLen.Value () ;
}

/*!
 * This method has no meaning because the decoded string is an Ansi string.
 * It just returns the copy of the input string.
 *
 * \param szBuff		[out] A buffer to save the decoded string. The buffer can not be NULL.
 * \param

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久久久久免费相片| 亚洲欧美影音先锋| 99精品国产视频| 麻豆精品国产91久久久久久| 亚洲品质自拍视频| 国产亚洲精品福利| 欧美日韩国产免费一区二区| 成人手机电影网| 激情综合五月天| 亚洲五月六月丁香激情| 国产欧美久久久精品影院| 日韩亚洲欧美在线观看| 欧美影视一区在线| 91免费观看国产| 国产传媒一区在线| 久久99热这里只有精品| 图片区小说区国产精品视频| 一区二区免费在线| 1000精品久久久久久久久| 久久男人中文字幕资源站| 欧美一级高清片| 欧美精品久久99久久在免费线| 99v久久综合狠狠综合久久| 国产精品 欧美精品| 国产在线视频不卡二| 奇米精品一区二区三区在线观看一 | 国产精品国产三级国产aⅴ原创| 欧美一个色资源| 欧美色爱综合网| 欧美午夜影院一区| 在线看不卡av| 欧美综合一区二区| 色成人在线视频| 色婷婷综合久久久中文一区二区| 国产成人福利片| 国产一区二区三区久久久| 老司机精品视频在线| 久久国产精品露脸对白| 久久国产尿小便嘘嘘| 久久国产三级精品| 国产呦萝稀缺另类资源| 国产一区二区在线影院| 国产一区二区三区不卡在线观看| 精品一区二区三区免费观看| 狠狠色综合播放一区二区| 欧美午夜精品久久久久久超碰| 色偷偷成人一区二区三区91| 色伊人久久综合中文字幕| 在线一区二区视频| 精品视频在线看| 欧美一区二区精品在线| 欧美成人精品福利| 久久亚区不卡日本| 国产精品午夜久久| 有坂深雪av一区二区精品| 午夜免费欧美电影| 看国产成人h片视频| 国产精品一卡二卡在线观看| av成人老司机| 欧美三区在线视频| 日韩精品一区二区三区swag| 久久久久久久精| 1024国产精品| 日本亚洲天堂网| 国产老肥熟一区二区三区| 9i在线看片成人免费| 欧美在线免费视屏| 欧美不卡在线视频| 亚洲素人一区二区| 男男视频亚洲欧美| 成人va在线观看| 欧美日韩在线观看一区二区| 欧美电视剧在线看免费| 国产精品美女久久久久久久久| 亚洲资源中文字幕| 国产一本一道久久香蕉| 色偷偷一区二区三区| 欧美成人福利视频| 亚洲欧美怡红院| 蜜桃久久久久久| 成人va在线观看| 日韩三级在线免费观看| 国产精品久久久久9999吃药| 五月天亚洲婷婷| 成人福利视频在线看| 7777精品伊人久久久大香线蕉完整版 | 色婷婷av久久久久久久| 日韩免费高清av| 日韩一区有码在线| 麻豆成人91精品二区三区| 91麻豆国产福利在线观看| 日韩欧美中文一区| 亚洲黄色尤物视频| 国产福利精品一区二区| 欧美精品在线一区二区| 国产精品国产三级国产普通话三级 | 成人在线视频一区二区| 欧美亚洲愉拍一区二区| 国产日本欧洲亚洲| 午夜成人免费电影| av一本久道久久综合久久鬼色| 欧美一级精品大片| 一区二区欧美精品| 成人免费av网站| 精品三级在线看| 亚洲成人激情综合网| 99精品桃花视频在线观看| 精品欧美久久久| 五月天精品一区二区三区| 91网站在线播放| 中文字幕+乱码+中文字幕一区| 蜜桃精品视频在线| 欧美理论在线播放| 亚洲精品欧美激情| 9i看片成人免费高清| 国产欧美日韩另类一区| 久久国产视频网| 4438成人网| 亚洲第一搞黄网站| 色综合咪咪久久| 国产精品网站在线观看| 国产毛片精品视频| 精品国产精品一区二区夜夜嗨| 午夜精品久久久久久不卡8050| 99久久99精品久久久久久| 中文字幕欧美日韩一区| 国产夫妻精品视频| 国产亚洲成aⅴ人片在线观看 | 91性感美女视频| 中文字幕永久在线不卡| 成人精品免费网站| 国产精品久久久久婷婷二区次| 国产传媒久久文化传媒| 久久久久国产精品免费免费搜索| 秋霞成人午夜伦在线观看| 欧美疯狂性受xxxxx喷水图片| 亚洲五码中文字幕| 欧美蜜桃一区二区三区| 性欧美大战久久久久久久久| 欧美日韩免费不卡视频一区二区三区| 樱花草国产18久久久久| 日本韩国精品一区二区在线观看| 中文字幕一区二区三区在线观看| 成人一级片在线观看| 亚洲国产成人午夜在线一区| 成人黄色电影在线| 亚洲欧美日韩久久精品| 色屁屁一区二区| 亚洲第一久久影院| 日韩视频一区二区| 国产精品主播直播| √…a在线天堂一区| 欧洲一区二区三区在线| 三级亚洲高清视频| 精品国产伦一区二区三区免费| 国产精品18久久久久久久久| 国产精品国产自产拍高清av王其| 色域天天综合网| 午夜电影一区二区| 精品国产第一区二区三区观看体验 | 欧美在线999| 天天爽夜夜爽夜夜爽精品视频| 日韩一区二区三区免费看| 国产精品一区在线观看乱码| 中文字幕一区二区三区精华液| 欧美在线观看禁18| 精品一区二区三区影院在线午夜 | 日本视频中文字幕一区二区三区| 日韩精品最新网址| 成人三级在线视频| 亚洲小说春色综合另类电影| 欧美一区二区精品在线| 丰满岳乱妇一区二区三区| 一区二区三区在线免费观看| 欧美一区二区三区视频免费 | 国产成人综合在线观看| 一区二区三区不卡在线观看| 日韩精品一区二区三区四区视频 | 91丝袜国产在线播放| 婷婷六月综合亚洲| 精品国产乱码久久久久久免费| 99riav久久精品riav| 麻豆91精品视频| 国产精品对白交换视频| 337p亚洲精品色噜噜噜| 夫妻av一区二区| 免费成人小视频| 一区二区三区精品在线| 久久亚洲一级片| 制服视频三区第一页精品| 成人免费毛片片v| 蜜桃一区二区三区四区| 中文字幕字幕中文在线中不卡视频| 日韩亚洲电影在线| 欧洲国内综合视频| 福利一区在线观看| 奇米一区二区三区av| 亚洲在线免费播放| 国产精品污污网站在线观看| 日韩片之四级片|