本文整理汇总了C++中DataReader::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ DataReader::GetValue方法的具体用法?C++ DataReader::GetValue怎么用?C++ DataReader::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataReader
的用法示例。
在下文中一共展示了DataReader::GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertData
//.........这里部分代码省略.........
case eLanguage_Assembler:
cHeaderFormatString=m_cLabelName+"\r\n"; // _SampleQuiTue
cEntrySeparator=",";
m_bEnableLineNumber=false;
switch (m_nDataSize)
{
case 1:
cHeaderPreLine="\t.byt ";
cEntryFormat="$%02x";
break;
case 2:
cHeaderPreLine="\t.word ";
cEntryFormat="$%04x";
break;
case 4:
cHeaderPreLine="\t.long ";
cEntryFormat="$%08x";
break;
}
break;
case eLanguage_BASIC:
// Basic supports only uppercase hexadecimal letters !
cHeaderFormatString=StringFormat("%d REM %s \r\n",m_nFirstLineNumber,m_cLabelName.c_str()); // nnnn REM _SampleQuiTue
m_nFirstLineNumber+=m_nIncrementLineNumber;
cHeaderPreLine="DATA ";
cEntryFormat="#%d";
m_bEnableLineNumber=true;
switch (m_nDataSize)
{
case 1:
cEntryFormat="#%02X";
break;
case 2:
cEntryFormat="#%04X";
break;
case 4:
cEntryFormat="#%08X"; // That one will probably fail on most 8 bits basics
break;
}
cEntrySeparator=",";
break;
}
if (m_nNumericBase==_eNumericBase_Decimal)
{
// Set to decimal output
cEntryFormat="%d";
}
int file_size=nFileSize;
int nEntryCount=(file_size+m_nDataSize-1)/m_nDataSize;
// To avoid numerous memory allocation, pre allocate a string long enough
cDestString="";
cDestString.reserve(nFileSize*5);
// Block header
cDestString+=StringFormat(cHeaderFormatString.c_str(),m_cLabelName.c_str(),nEntryCount); // unsigned char _SampleQuiTue[]={
while (file_size>0)
{
// Line numbers
if (m_bEnableLineNumber)
{
cDestString+=StringFormat("%d ",m_nFirstLineNumber);
m_nFirstLineNumber+=m_nIncrementLineNumber;
}
// Line header
cDestString+=cHeaderPreLine;
// Content of the line
for (unsigned long x=0;x<m_nValuesPerLine;x++)
{
unsigned long c=cDataReader.GetValue(m_nDataSize);
file_size-=m_nDataSize;
cDestString+=StringFormat(cEntryFormat.c_str(),c);
if ((x!=(m_nValuesPerLine-1)) && file_size)
{
cDestString+=cEntrySeparator;
}
if (file_size<=0) break;
}
// Optional last separator (for C)
if (bAddSeparatorOnEndOfLine && (file_size>0))
{
cDestString+=cEntrySeparator;
}
// End of line carriage return
cDestString+="\r\n";
}
// Block footer
cDestString+=cFooterFormatString;
// End of file carriage return
cDestString+="\r\n";
}