本文整理汇总了C++中DataReader::SetEndian方法的典型用法代码示例。如果您正苦于以下问题:C++ DataReader::SetEndian方法的具体用法?C++ DataReader::SetEndian怎么用?C++ DataReader::SetEndian使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataReader
的用法示例。
在下文中一共展示了DataReader::SetEndian方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertData
void TextFileGenerator::ConvertData(std::string& cDestString,const void* pSourceData,size_t nFileSize)
{
if ( ((nFileSize/m_nDataSize)*m_nDataSize)!=nFileSize)
{
ShowError("The filesize must be a multiple of the data size.");
}
DataReader cDataReader;
cDataReader.SetPointer(pSourceData);
if (m_nEndianness==_eEndianness_Big)
{
cDataReader.SetEndian(true);
}
else
{
cDataReader.SetEndian(false);
}
std::string cHeaderFormatString;
std::string cFooterFormatString;
std::string cHeaderPreLine;
std::string cEntryFormat;
std::string cEntrySeparator;
bool bAddSeparatorOnEndOfLine=false;
switch (m_nFileType)
{
default:
break;
case eLanguage_C:
cHeaderPreLine="\t";
cEntrySeparator=",";
bAddSeparatorOnEndOfLine=true;
m_bEnableLineNumber=false;
switch (m_nDataSize)
{
case 1:
cHeaderFormatString="unsigned char %s[%d]=\r\n{\r\n"; // unsigned char _SampleQuiTue[]={
cEntryFormat="0x%02x";
break;
case 2:
cHeaderFormatString="unsigned short %s[%d]=\r\n{\r\n"; // unsigned short _SampleQuiTue[]={
cEntryFormat="0x%04x";
break;
case 4:
cHeaderFormatString="unsigned long %s[%d]=\r\n{\r\n"; // unsigned long _SampleQuiTue[]={
cEntryFormat="0x%08x";
break;
}
cFooterFormatString="};";
break;
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)
//.........这里部分代码省略.........