当前位置: 首页>>代码示例>>C++>>正文


C++ CStdStringA::GetLength方法代码示例

本文整理汇总了C++中CStdStringA::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdStringA::GetLength方法的具体用法?C++ CStdStringA::GetLength怎么用?C++ CStdStringA::GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CStdStringA的用法示例。


在下文中一共展示了CStdStringA::GetLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

CStdString CWordBinaryMetadataDiscoveryWorker::ConvertPropertyFromUTF8(CStdStringA sData)
{
	CStdString sOut;
	int iIncrement = 0;
	int iPos = 0;
	unsigned char* p = (unsigned char *)sData.GetBuffer(-1);

	while (iPos < sData.GetLength())
	{	// *p z y x w v u
		if (*p <= 127)	// 1 byte
		{
			sOut += *p;
			iIncrement = 1;;
		}
		else if (*p >= 192 && *p <= 223)	// 2 bytes
		{	// (z-192)*64 + (y-128)
			sOut += (64 * (*p - 192)) + *(p+1) - 128;
			iIncrement = 2;
		}
		else if (*p >= 224 && *p <= 239)	// 3 bytes
		{	// (z-224)*4096 + (y-128)*64 + (x-128)
			sOut += (4096 * (*p - 224)) + (64 * (*(p+1) - 128)) + *(p+2) - 128;
			iIncrement = 3;
		}
		//else if (*p >= 240 && *p <= 247)	// 4 bytes
		//{	// (z-240)*262144 + (y-128)*4096 + (x-128)*64 + (w-128)
		//	sOut += (262144 * (*p - 240)) + (4096 * (*(p+1) - 128)) + (64 * (*(p+2) - 128)) + *(p+3) - 128;
		//	iIncrement = 4;
		//}
		//else if (*p >= 248 && *p <= 251)	// 5 bytes
		//{	// (z-248)*16777216 + (y-128)*262144 + (x-128)*4096 + (w-128)*64 + (v-128)
		//	sOut += (16777216 * (*p - 248)) + (262144 * (*(p+1) - 128)) + (4096 * (*(p+2) - 128)) + (64 * (*(p+3) - 128)) + *(p+4) - 128;
		//	iIncrement = 5;
		//}
		//else if (*p >= 252 && *p <= 253)	// 6 bytes
		//{	// (z-252)*1073741824 + (y-128)*16777216 + (x-128)*262144 + (w-128)*4096 + (v-128)*64 + (u-128)
		//	sOut += (1073741824 * (*p - 252)) + (16777216 * (*(p+1) - 128)) + (262144 * (*(p+2) - 128)) + (4096 * (*(p+3) - 128)) + (64 * (*(p+4) - 128)) + *(p+5) - 128;
		//	iIncrement = 6;
		//}
		else
		{
			// error - leave as was
			return sData;
		}
		p += iIncrement;
		iPos += iIncrement;
	}
	return sOut;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:49,代码来源:WordBinaryMetadataDiscoveryWorker.cpp

示例2: GetHashCode

int IntelligentDocInfo::GetHashCode(CStdStringA sDocId)
{
	if (sDocId.IsEmpty())
		return 0;
	DWORD dwLargeNumber(3929);
	DWORD dwMultiple(dwLargeNumber); // Some large number
	DWORD dwHash(0);
	unsigned int iSize = sDocId.GetLength();
	{
		for(unsigned int i = 1; i <= iSize; ++i)
		{
			char c = sDocId[i-1];
			dwHash += dwMultiple * i * c;
			dwMultiple *= dwLargeNumber;
		}
	}
	dwHash ^= m_iRehashCode;
	return dwHash;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:19,代码来源:IntelligentDocInfo.cpp

示例3: ProcessCommand


//.........这里部分代码省略.........
							m_ThreadNotificationIDs[index] = pThread;
							if (pThread->Create(THREAD_PRIORITY_NORMAL, CREATE_SUSPENDED)) {
								pThread->ResumeThread();
								m_ThreadArray.push_back(pThread);
							}
						}
						CStdString str;
						str.Format(_T("Number of threads increased to %d."), threadnum);
						ShowStatus(str, 0);
					}
					else if (threadnum < m_ThreadArray.size()) {
						CStdString str;
						str.Format(_T("Decreasing number of threads to %d."), threadnum);
						ShowStatus(str, 0);
						unsigned int i = 0;
						std::vector<CServerThread *> newList;
						for (auto iter = m_ThreadArray.begin(); iter != m_ThreadArray.end(); iter++, i++) {
							if (i >= threadnum) {
								(*iter)->PostThreadMessage(WM_FILEZILLA_THREADMSG, FTM_GOOFFLINE, 2);
								m_ClosedThreads.push_back(*iter);
							}
							else
								newList.push_back(*iter);
						}
						m_ThreadArray.swap(newList);
					}
				}
				if (listenPorts != m_pOptions->GetOption(OPTION_SERVERPORT) ||
					enableSsl != (m_pOptions->GetOptionVal(OPTION_ENABLETLS) != 0) ||
					(m_pOptions->GetOptionVal(OPTION_ENABLETLS) && listenPortsSsl != m_pOptions->GetOption(OPTION_TLSPORTS)) ||
					ipBindings != m_pOptions->GetOption(OPTION_IPBINDINGS))
				{
					if (!m_ListenSocketList.empty()) {
						ShowStatus(_T("Closing all listening sockets"), 0);
						for (std::list<CListenSocket*>::iterator listIter = m_ListenSocketList.begin(); listIter != m_ListenSocketList.end(); ++listIter) {
							(*listIter)->Close();
							delete *listIter;
						}
						m_ListenSocketList.clear();

						if (!CreateListenSocket()) {
							ShowStatus(_T("Failed to create a listen socket on any of the specified ports. Server is not online!"), 1);
							m_nServerState &= ~STATE_ONLINE;
						}
						else {
							ShowStatus(_T("Listen socket port changed"), 0);
							if (!(m_nServerState & STATE_MASK_GOOFFLINE))
								m_nServerState |= STATE_ONLINE;
						}
						SendState();
					}
				}
				if (nAdminListenPort != m_pOptions->GetOptionVal(OPTION_ADMINPORT) || adminIpBindings != m_pOptions->GetOption(OPTION_ADMINIPBINDINGS)) {
					CreateAdminListenSocket();
				}

				VerifyTlsSettings(pAdminSocket);
				VerifyPassiveModeSettings(pAdminSocket);
			}
		}
		break;
	case 6:
		if (!nDataLength) {
			unsigned char *pBuffer = NULL;
			DWORD nBufferLength = 0;
			CPermissions permissions = CPermissions(std::function<void()>());
			permissions.GetAsCommand(&pBuffer, &nBufferLength);
			pAdminSocket->SendCommand(1, 6, pBuffer, nBufferLength);
			delete [] pBuffer;
		}
		else {
			if (nDataLength < 2)
				pAdminSocket->SendCommand(1, 1, "\001Protocol error: Unexpected data length", strlen("\001Protocol error: Unexpected data length")+1);
			else {
				CPermissions permissions = CPermissions(std::function<void()>());
				if (!permissions.ParseUsersCommand(pData, nDataLength)) {
					pAdminSocket->SendCommand(1, 1, "\001Protocol error: Invalid data, could not import account settings.", strlen("\001Protocol error: Invalid data, could not import account settings.")+1);
					char buffer = 1;
					pAdminSocket->SendCommand(1, 6, &buffer, 1);
					break;
				}
				char buffer = 0;
				pAdminSocket->SendCommand(1, 6, &buffer, 1);
			}
		}
		break;
	case 8:
		pAdminSocket->SendCommand(1, 8, NULL, 0);
		break;
	default:
		{
			CStdStringA str;
			str.Format("\001Protocol error: Unknown command (%d).", nID);
			pAdminSocket->SendCommand(1, 1, str.c_str(), str.GetLength());
		}
		break;
	}

	return TRUE;
}
开发者ID:soulic,项目名称:FileZilla-Server,代码行数:101,代码来源:Server.cpp


注:本文中的CStdStringA::GetLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。