本文整理汇总了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));
}
示例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 ;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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();
}
}
示例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);
}
}
示例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));
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}