當前位置: 首頁>>代碼示例>>C++>>正文


C++ AddData函數代碼示例

本文整理匯總了C++中AddData函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddData函數的具體用法?C++ AddData怎麽用?C++ AddData使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了AddData函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: AddFlags

void AuxGroupMember::BuildPacket(unsigned char *buffer, long &index)
{
	AddFlags(Flags, sizeof(Flags), buffer, index);

	if (Flags[0] & 0x10)	//ExtendedFlags[1] & 0x01
	{
		AddString(buffer, Data->Name, index);
	}

	if (Flags[0] & 0x20)	//ExtendedFlags[1] & 0x02
	{
		AddData(buffer, Data->GameID, index);
	}

	if (Flags[0] & 0x40)	//ExtendedFlags[1] & 0x04
	{
		AddData(buffer, Data->Formation, index);
	}

	if (Flags[0] & 0x80)	//ExtendedFlags[1] & 0x08
	{
		AddData(buffer, Data->Position, index);
	}

	memset(Flags,0,sizeof(Flags));
}
開發者ID:RavenB,項目名稱:Earth-and-Beyond-server,代碼行數:26,代碼來源:AuxGroupMember.cpp

示例2: sprintf

//以普通方式寫一整數
bool Ini::Write(char *index, char *name, int num)
{
	//__ENTER_FUNCTION

	char string[32];
	sprintf(string, "%d", num);

	int n=FindIndex(index);
	if( n == -1 )	//新建索引
	{
		AddIndex(index);
		n=FindIndex(index);
		n=GotoLastLine(index);
		AddData(n, name, string);	//在當前位置n加一個數據
		return true;
	}

	//存在索引
	int m=FindData(n, name);
	if( m==-1 )		//新建數據
	{
		n=GotoLastLine(index);
		AddData(n, name, string);	//在當前位置n加一個數據
		return true;
	}

	//存在數據
	ModityData(n, name, string);	//修改一個數據

	return true;

	//__LEAVE_FUNCTION

//	return 0 ;
}
開發者ID:CrazyPro,項目名稱:ape,代碼行數:36,代碼來源:Ini.cpp

示例3: AddFlags

void AuxElement::BuildExtendedPacket(unsigned char *buffer, long &index)
{
	AddFlags(ExtendedFlags, sizeof(ExtendedFlags), buffer, index);

	if (ExtendedFlags[0] & 0x10)	//ExtendedFlags[1] & 0x02
	{
		AddString(buffer, Data->SourceEntity, index);
	}

	if (ExtendedFlags[0] & 0x20)	//ExtendedFlags[1] & 0x04
	{
		AddString(buffer, Data->SourceObject, index);
	}

	if (ExtendedFlags[0] & 0x40)	//ExtendedFlags[1] & 0x08
	{
		AddData(buffer, Data->Magnitude, index);
	}

	if (ExtendedFlags[0] & 0x80)	//ExtendedFlags[1] & 0x10
	{
		AddData(buffer, char(Data->IsActive), index);
	}

	if (ExtendedFlags[1] & 0x01)	//ExtendedFlags[1] & 0x20
	{
		AddData(buffer, Data->ExpirationTime, index);
	}
}
開發者ID:RavenB,項目名稱:Earth-and-Beyond-server,代碼行數:29,代碼來源:AuxElement.cpp

示例4: ASSERT_VALID

void CBCGPMSMoneyDemoView::FillGrid ()
{
	ASSERT_VALID (this);

	m_wndGrid.InsertColumn (0, _T(""), 0);
	m_wndGrid.InsertColumn (1, _T("Quarter"), 185);
	m_wndGrid.InsertColumn (2, _T("Amount"), 80);
	m_wndGrid.InsertColumn (3, _T("Change"), 80);

	m_wndGrid.SetColumnAlign (0, HDF_RIGHT);
	m_wndGrid.SetColumnAlign (2, HDF_RIGHT);
	m_wndGrid.SetColumnAlign (3, HDF_RIGHT);
	m_wndGrid.SetHeaderAlign (2, HDF_RIGHT);
	m_wndGrid.SetHeaderAlign (3, HDF_RIGHT);
	m_wndGrid.SetColumnLocked (0);

	AddData (_T("I"), _T("$2,554.00"), 0.0021);
	AddData (_T("II"), _T("$2,370.00"), -0.0052);
	AddData (_T("III"), _T("$1,825.00"), -0.027);
	AddData (_T("IV"), _T("$4,778.00"), 0.0911);

	CBCGPGridRow* pRow5 = m_wndGrid.CreateRow (m_wndGrid.GetColumnCount ());
	
	pRow5->GetItem (0)->SetValue (_T("Total:"));
	pRow5->GetItem (2)->SetValue (_T("$ 1,1527.00"));

	m_wndGrid.AddRow (pRow5);

	m_wndGrid.MergeRange (CBCGPGridRange (0, 4, 1, 4));
	m_wndGrid.MergeRange (CBCGPGridRange (2, 4, 3, 4));

	m_wndGrid.EnableHeader (TRUE, 0);
	m_wndGrid.EnableColumnAutoSize (TRUE);
	m_wndGrid.SetReadOnly (TRUE);
}
開發者ID:zxlooong,項目名稱:bcgexp,代碼行數:35,代碼來源:BCGPMSMoneyDemoView.cpp

示例5: EmptyUsed

BOOL CIOCPBuffer::CreatePackage(BYTE Type, UINT iFilesize,UINT iBufferSize, const BYTE *const pData)
{
	UINT nBufLen=iBufferSize;
	if(iBufferSize<(MAXIMUMPACKAGESIZE-MINIMUMPACKAGESIZE-1-sizeof(UINT)))
	{
		// Perpare Package. 
		// Empty the Buffer..
		EmptyUsed();
		
		// Add one to the size header for the Type byte. .  
		nBufLen++;

		// Add The bytes for the iFilesize data. 
		nBufLen+=sizeof(UINT);

		// Add The Header
		AddData(nBufLen);
		
		// Add the Type. 
		AddData(Type);
		
		//Add the size data
		AddData(iFilesize);

		// Add the Buffer. 
		if(iBufferSize>0)
		AddData(pData,iBufferSize);
	return TRUE;
	}
	return FALSE;
}
開發者ID:jeppeter,項目名稱:IOCP,代碼行數:31,代碼來源:IOCPBuffer.cpp

示例6: StringParser

    void StringParser(const std::string& inStr, 
                      const std::string& inSeparator, 
                      Utils::ManagedList<std::string>& outData,
                      bool removeEmpty)
    {
        outData.Clear();

        //if no separator, return full input string
        if (inSeparator.empty()) 
        {
            AddData(inStr, outData, removeEmpty);
            return;
        }

        // if separtor exists, parse string 
        size_t prev = 0;
        while (true)
        {
            size_t next = inStr.find(inSeparator, prev);// inStr.find_first_of(inSeparator, prev);

            // copy symbols after last separator || 
            // copy all string if separator's not found
            if (next == string::npos)  
            {
                AddData(inStr.substr(prev), outData, removeEmpty);
                break;
            }

            AddData(inStr.substr(prev, (next - prev)), outData, removeEmpty);

            prev = next + inSeparator.size();
        }
    }
開發者ID:ixc-software,項目名稱:lucksi,代碼行數:33,代碼來源:StringParser.cpp

示例7: AddFlags

void AuxBuff::BuildExtendedPacket(unsigned char *buffer, long &index)
{
	AddFlags(ExtendedFlags, sizeof(ExtendedFlags), buffer, index);

	if (ExtendedFlags[0] & 0x10)	//ExtendedFlags[1] & 0x02
	{
		AddString(buffer, Data->BuffType, index);
	}

	if (ExtendedFlags[0] & 0x20)	//ExtendedFlags[1] & 0x04
	{
		AddString(buffer, Data->ScrubTypeName, index);
	}

	if (ExtendedFlags[0] & 0x40)	//ExtendedFlags[1] & 0x08
	{
		AddData(buffer, char(Data->IsPermanent), index);
	}

	if (ExtendedFlags[0] & 0x80)	//ExtendedFlags[1] & 0x10
	{
		AddData(buffer, Data->BuffRemovalTime, index);
	}

	if (ExtendedFlags[1] & 0x01)	//ExtendedFlags[1] & 0x20
	{
		Elements.BuildExtendedPacket(buffer, index);
	}
	else if (ExtendedFlags[1] & 0x20)
	{
		AddData(buffer, char(0x05), index);
	}
}
開發者ID:RavenB,項目名稱:Earth-and-Beyond-server,代碼行數:33,代碼來源:AuxBuff.cpp

示例8: AddFlags

void AuxEffect::BuildPacket(unsigned char *buffer, long &index)
{
	AddFlags(Flags, sizeof(Flags), buffer, index);

	if (Flags[0] & 0x10)	//ExtendedFlags[1] & 0x01
	{
		AddData(buffer, Data->Range, index);
	}

	if (Flags[0] & 0x20)	//ExtendedFlags[1] & 0x02
	{
		AddData(buffer, Data->Usage, index);
	}

	if (Flags[0] & 0x40)	//ExtendedFlags[1] & 0x04
	{
		AddData(buffer, Data->Targets, index);
	}

	if (Flags[0] & 0x80)	//ExtendedFlags[1] & 0x08
	{
		AddData(buffer, Data->Validity, index);
	}

	memset(Flags,0,sizeof(Flags));
}
開發者ID:RavenB,項目名稱:Earth-and-Beyond-server,代碼行數:26,代碼來源:AuxEffect.cpp

示例9: CFormat

HRESULT CSimpleDataObjectImpl::AddData(UINT cfFormat, HGLOBAL hData)
{
	// Remove existing entry
	CFormat* pFormat=FindFormat(cfFormat, TYMED_HGLOBAL);
	if (pFormat)
	{
		m_Formats.Remove(pFormat);
	}
	
	// Create a new format entry
	pFormat=new CFormat(cfFormat, hData);

	// Add it
	m_Formats.Add(pFormat);

	// Add emulated modes...
	if (cfFormat==CF_TEXT && !FindFormat(CF_UNICODETEXT, TYMED_HGLOBAL) && hData)
	{
		AddData(CF_UNICODETEXT, TYMED_HGLOBAL);
	}
	if (cfFormat==CF_UNICODETEXT && !FindFormat(CF_TEXT, TYMED_HGLOBAL) && hData)
	{
		AddData(CF_TEXT, TYMED_HGLOBAL);
	}

	return S_OK;
}
開發者ID:adhawkins,項目名稱:SimpleLib,代碼行數:27,代碼來源:SimpleDataObject.cpp

示例10: FindIndex

/*================================================================ 
* 函數名:    Write
* 參數:      [in] (char *index_name)當前索引名稱
*             [in] (char *key_name)KEY名稱
*             [in] (char *value_name)VALUE名稱
* 功能描述:   以普通方式寫一字符串數據
* 返回值:    成功則返回true, 否則返false
================================================================*/
bool CIni::Write(char *index_name, char *key_name, char *value_name)
{
	int data_pos = FindIndex(index_name);
	if (data_pos == ERROR_DATA_POS)	//新建索引
	{
		AddIndex(index_name);
		data_pos = FindIndex(index_name);
		data_pos = GotoLastLine(index_name);
		AddData(data_pos, key_name, value_name);	//在當前位置n加一個數據
		return true;
	}

	//存在索引
	int data_pos2 = FindData(data_pos, key_name);
	if (data_pos2 == ERROR_DATA_POS)		//新建數據
	{
		data_pos = GotoLastLine(index_name);
		AddData(data_pos, key_name, value_name);	//在當前位置n加一個數據
		return true;
	}

	//存在數據
	ModityData(data_pos, key_name, value_name);	//修改一個數據

	return true;
}
開發者ID:nykma,項目名稱:ykt4sungard,代碼行數:34,代碼來源:Ini.cpp

示例11: hkvMsgAssetProcessed

 hkvMsgAssetProcessed(bool thumbnailCreated, bool dependenciesDetermined)
 : Message(MSG_ASSET_PROCESSED),
   m_thumbnailCreated(thumbnailCreated), m_dependenciesDetermined(dependenciesDetermined)
 {
   AddData(&m_thumbnailCreated, sizeof(bool));
   AddData(&m_dependenciesDetermined, sizeof(bool));
 }
開發者ID:Bewolf2,項目名稱:projectanarchy,代碼行數:7,代碼來源:hkvAssetUpdateIPCMessages.hpp

示例12: sprintf

/*================================================================ 
* 函數名:    Write
* 參數:      [in] (char *index_name)當前索引名稱
*             [in] (char *key_name)KEY名稱
*             [in] (int int_num)整型值
* 功能描述:   以普通方式寫一整數
* 返回值:    成功則返回true, 否則返false
================================================================*/
bool CIni::Write(char *index_name, char *key_name, int int_num)
{
	char string[32];
	sprintf(string, "%d", int_num);

	int data_pos = FindIndex(index_name);
	if (data_pos == ERROR_DATA_POS)	//新建索引
	{
		AddIndex(index_name);
		data_pos = FindIndex(index_name);
		data_pos = GotoLastLine(index_name);
		AddData(data_pos, key_name, string);	//在當前位置n加一個數據
		return true;
	}

	//存在索引
	int data_pos2 = FindData(data_pos, key_name);
	if (data_pos2 == ERROR_DATA_POS)		//新建數據
	{
		data_pos = GotoLastLine(index_name);
		AddData(data_pos, key_name, string);	//在當前位置n加一個數據
		return true;
	}

	//存在數據
	ModityData(data_pos, key_name, string);	//修改一個數據

	return true;
}
開發者ID:nykma,項目名稱:ykt4sungard,代碼行數:37,代碼來源:Ini.cpp

示例13: guard

bool SymbolMap::LoadNocashSym(const char *filename)
{
	lock_guard guard(lock_);
	FILE *f = File::OpenCFile(filename, "r");
	if (!f)
		return false;

	while (!feof(f)) {
		char line[256], value[256] = {0};
		char *p = fgets(line, 256, f);
		if (p == NULL)
			break;

		u32 address;
		if (sscanf(line, "%08X %s", &address, value) != 2)
			continue;
		if (address == 0 && strcmp(value, "0") == 0)
			continue;

		if (value[0] == '.') {
			// data directives
			char* s = strchr(value, ':');
			if (s != NULL) {
				*s = 0;

				u32 size = 0;
				if (sscanf(s + 1, "%04X", &size) != 1)
					continue;

				if (strcasecmp(value, ".byt") == 0) {
					AddData(address, size, DATATYPE_BYTE);
				} else if (strcasecmp(value, ".wrd") == 0) {
					AddData(address, size, DATATYPE_HALFWORD);
				} else if (strcasecmp(value, ".dbl") == 0) {
					AddData(address, size, DATATYPE_WORD);
				} else if (strcasecmp(value, ".asc") == 0) {
					AddData(address, size, DATATYPE_ASCII);
				}
			}
		} else {				// labels
			int size = 1;
			char* seperator = strchr(value,',');
			if (seperator != NULL) {
				*seperator = 0;
				sscanf(seperator+1,"%08X",&size);
			}

			if (size != 1) {
				AddFunction(value,address,size);
			} else {
				AddLabel(value,address);
			}
		}
	}

	fclose(f);
	return true;
}
開發者ID:CLYBOY,項目名稱:ppsspp,代碼行數:58,代碼來源:SymbolMap.cpp

示例14: AddData

void HexAreaClipboardPasteProxy::DoInit()
{
	AddData(HAPAHCI_NEVER,             wxT("never"),               _("Never"),                         SharedPasterPtr(new HexAreaNerverHexPaster));
	AddData(HAPAHCI_ACCORDINGTOCOPIER, wxT("according_to_copier"), _("According To Copying Behavior"), SharedPasterPtr(new HexAreaAccordingToCopierHexPaster));
	AddData(HAPAHCI_IFPOSSIBLE,        wxT("if_possible"),         _("If Possible"),                   SharedPasterPtr(new HexAreaIfPossibleHexPaster));
	AddData(HAPAHCI_ALWAYS,            wxT("always"),              _("Always"),                        SharedPasterPtr(new HexAreaAlwaysHexPaster));

	SetDefault(HAPAHCI_NEVER, IndexToVal(HAPAHCI_NEVER));
}
開發者ID:hltj,項目名稱:wxMEdit,代碼行數:9,代碼來源:utils.cpp

示例15: translate_plug_process

extern "C" int translate_plug_process(CLogRow* row, std::vector<int8_t> inputFields, std::map<int8_t, std::vector<std::string> >& outputData, std::string function) 
{
	uint32_t size=inputFields.size();
	uint32_t ret=0;
	//g_log->log_error("#############item num :<%d>\n", __FILE__, __LINE__,size);
	if(size <= 1) return 0;
	uint32_t partionNum = 0;
	#if 0
	CLogField*  timeField = row->getField(inputFields[0]);
	if(timeField==NULL)
	{
		return 0;
	}
	std::string sTime = timeField->getFieldValStr();
	CLogField* ipField = row->getField(inputFields[1]);
	if(ipField==NULL)
	{
		return 0;
	}
	std::string strIp = ipField->getFieldValStr();
	#endif
	
	for(uint32_t i=0;i<10;i++)
	{

		CLogField* stepField;
		stepField = row->getField(inputFields[i+2]);
		if(stepField==NULL)
		{
			//g_log->log_error("########can not get item:<%d>\n", __FILE__, __LINE__,i+2);
			continue;
		}
		int64_t usedSpace=stepField->_value.iVal;

		stepField = row->getField(inputFields[i+2+10]);
		if(stepField==NULL)
		{
			//g_log->log_error("########can not get item:<%d>\n", __FILE__, __LINE__,i+12);
			continue;
		}
		int64_t totalSpace=stepField->_value.iVal;
		if((usedSpace<0) || (totalSpace<0))
		{
			//g_log->log_error("########partion:<%d> is -1 \n", __FILE__, __LINE__,i);
			continue;
		}
		uint32_t ratio = (usedSpace*100)/totalSpace;

		AddData(0,i,outputData);
		AddData(1,usedSpace,outputData);
		AddData(2,totalSpace,outputData);
		AddData(3,ratio,outputData);
		partionNum++;
	}
	//g_log->log_error("########total partion:<%d> \n", __FILE__, __LINE__,partionNum);
	return partionNum;
}
開發者ID:ownyang,項目名稱:cdp,代碼行數:57,代碼來源:disk_dispatch.cpp


注:本文中的AddData函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。