本文整理汇总了C++中std::istream类的典型用法代码示例。如果您正苦于以下问题:C++ istream类的具体用法?C++ istream怎么用?C++ istream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了istream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bs
bool demo_csgo::handle_cmdheader<DEMO_USERCMD>(std::istream& is, demo_cmdheader& cmdheader) {
int32_t seq_num_out;
if(!stream_read_primitive<int32_t>(is, seq_num_out)) {
std::cerr << "handle_cmdheader<DEMO_USERCMD>(): !stream_read_primitive<int32_t>(is, seq_num_out)" << std::endl;
return false;
}
int32_t data_length = 0;
if(!stream_read_primitive<int32_t>(is, data_length)) {
std::cerr << "handle_cmdheader<DEMO_USERCMD>(): !stream_read_primitive<int32_t>(is, data_length)" << std::endl;
return false;
}
char* buffer = new char[data_length];
is.read(buffer, data_length);
CBitRead bs(buffer, data_length);
usercmd ucmd = this->progressive_usercmd;
if(bs.ReadOneBit()) { // bs.read(1);
ucmd.command_number = bs.ReadUBitLong(32); // bs.nReadUInt(32);
} else {
ucmd.command_number = this->progressive_usercmd.command_number + 1;
}
if(bs.ReadOneBit()) { // bs.read(1)
ucmd.tick_count = bs.ReadUBitLong(32); // bs.nReadUInt(32);
} else {
ucmd.tick_count = this->progressive_usercmd.tick_count + 1;
}
if(bs.ReadOneBit()) { // bs.read(1)
float v;
bs.ReadBits(reinterpret_cast<char*>(&v), 32);
ucmd.viewangles[0] = v;
}
if(bs.ReadOneBit()) { // bs.read(1)
float v;
bs.ReadBits(reinterpret_cast<char*>(&v), 32);
ucmd.viewangles[1] = v;
}
if(bs.ReadOneBit()) {
float v;
bs.ReadBits(reinterpret_cast<char*>(&v), 32);
ucmd.viewangles[2] = v;
}
if(bs.ReadOneBit()) {
float v;
bs.ReadBits(reinterpret_cast<char*>(&v), 32);
ucmd.aimdirection[0] = v;
}
if(bs.ReadOneBit()) {
float v;
bs.ReadBits(reinterpret_cast<char*>(&v), 32);
ucmd.aimdirection[1] = v;
}
if(bs.ReadOneBit()) {
float v;
bs.ReadBits(reinterpret_cast<char*>(&v), 32);
ucmd.aimdirection[2] = v;
}
if(bs.ReadOneBit()) {
float v;
bs.ReadBits(reinterpret_cast<char*>(&v), 32);
ucmd.forwardmove = v;
}
if(bs.ReadOneBit()) {
float v;
bs.ReadBits(reinterpret_cast<char*>(&v), 32);
ucmd.sidemove = v;
}
if(bs.ReadOneBit()) {
float v;
bs.ReadBits(reinterpret_cast<char*>(&v), 32);
ucmd.upmove = v;
}
if(bs.ReadOneBit()) {
ucmd.buttons = bs.ReadUBitLong(32); // bs.nReadUInt(32);
}
if(bs.ReadOneBit()) {
ucmd.impulse = bs.ReadUBitLong(8); // bs.nReadUInt(8);
}
if(bs.ReadOneBit()) {
ucmd.weapon_select = bs.ReadUBitLong(MAX_EDICT_BITS); // bs.nReadUInt(MAX_EDICT_BITS);
if(bs.ReadOneBit()) {
ucmd.weapon_subtype = bs.ReadUBitLong(WEAPON_SUBTYPE_BITS); // bs.nReadUInt(WEAPON_SUBTYPE_BITS);
}
}
//.........这里部分代码省略.........
示例2: loadModel
bool PolyModel::loadModel(std::istream& istr)
{
int vertex_count;
int face_count;
string data;
if (!istr.good())
return false;
char line[1024];
istr.getline(line, 1024);
std::istringstream sstr(line);
sstr >> data >> vertex_count >> face_count;
std::string attrib_type;
bool has_texcoords = false;
while (!sstr.eof() && sstr.good()) {
sstr >> attrib_type;
if (attrib_type == "tex-coords1")
has_texcoords = true;
}
//m_verts.clear();
//m_polys.clear();
m_verts.resize(vertex_count);
m_polys.resize(face_count);
for(int i = 0; i < m_verts.capacity(); i++)//STORE VERTEX
{
string temp1,temp2,temp3;
istr.getline(line, 1024);
std::istringstream sstr(line);
sstr >> temp1 >> temp2 >> temp3;
m_verts[i].set(atof(temp1.c_str()), atof(temp2.c_str()), atof(temp3.c_str()));
}
for(int i = 0; i < m_polys.capacity(); i++)//STORE PLOY NUMBERS
{
string temp1,temp;
istr.getline(line, 1024);
std::istringstream sstr(line);
sstr>>temp1;
m_polys[i].insert(m_polys[i].begin(), atoi(temp1.c_str()));
for(int j = 0; j < atoi(temp1.c_str()); j++)
{
sstr>>temp;
atoi(temp.c_str());
m_polys[i].insert(m_polys[i].begin()+j+1,atoi(temp.c_str()));
}
}
/* for(int i =0;i<2;i++)
{
for(int j =0;j<4;j++)
cout<<m_polys[i][j]<<" ";
cout<<"\n";
}*/
m_center = 0.0f;
m_max_bounding = -numeric_limits<float>::max();
m_min_bounding = numeric_limits<float>::max();
computeFaceNormals();
computeVertexNormals();
return true;
}
示例3: error
bool
CompareTestBaseline
::DoComparison( std::istream & testCSV,
std::istream & baselineCSV )
{
this->StringError.clear();
this->AbsoluteError.clear();
this->FractionalError.clear();
this->RowCount = 0;
this->MaxColumnCount = 1;
this->StringErrorCount = 0;
this->AbsoluteErrorCount = 0;
this->FractionalErrorCount = 0;
// the stream gets partitioned into lines, then tokens, then type
// converted to a double or white-space removed string.
std::string testLine;
std::string baselineLine;
std::istringstream testLineStream;
std::istringstream baselineLineStream;
std::string testToken;
std::string baselineToken;
std::istringstream testTokenStream;
std::istringstream baselineTokenStream;
double testTokenAsDouble;
double baselineTokenAsDouble;
std::string testTokenAsString;
std::string baselineTokenAsString;
bool fractionalErrorOccured = false;
bool absoluteErrorOccurred = false;
bool stringErrorOccurred = false;
// for every line
while( testCSV.good() )
{
++this->RowCount;
StringErrorRowType stringErrorRow;
NumericalErrorRowType fractionalErrorRow;
NumericalErrorRowType absoluteErrorRow;
getline( testCSV, testLine );
getline( baselineCSV, baselineLine );
if( testCSV.good() && !baselineCSV.good() || !testCSV.good() && baselineCSV.good() )
{
std::ostringstream ostrm;
ostrm << "The Baseline does not have the same number of rows"
<< " as the Test.";
this->ComparisonMessage = ostrm.str();
return false;
}
testLineStream.str( testLine );
baselineLineStream.str( baselineLine );
IndexValueType columnCount = 0;
// for every token in a line
while( testLineStream.good() )
{
++columnCount;
// get the token
getline( testLineStream, testToken, this->Parameters->Delimiter );
getline( baselineLineStream, baselineToken, this->Parameters->Delimiter );
if( testLineStream.good() && !baselineLineStream.good() || !testLineStream.good() && baselineLineStream.good() )
{
std::ostringstream ostrm;
ostrm << "The Baseline does not have the same number of columns"
<< " as the Test in row " << this->RowCount << ".";
this->ComparisonMessage = ostrm.str();
return false;
}
testTokenStream.clear();
baselineTokenStream.clear();
testTokenStream.str( testToken );
baselineTokenStream.str( baselineToken );
baselineTokenStream >> baselineTokenAsDouble;
if( !baselineTokenStream.fail() )
{
testTokenStream >> testTokenAsDouble;
if( testTokenStream.fail() )
{
std::ostringstream ostrm;
ostrm << "Test entry was not a number when Baseline was a number"
<< " in row " << this->RowCount << " column " << columnCount << ".";
this->ComparisonMessage = ostrm.str();
return false;
}
double fractionalError = fabs( testTokenAsDouble - baselineTokenAsDouble ) / fabs( baselineTokenAsDouble );
if( fractionalError >= this->Parameters->FractionalTolerance )
{
NumericalErrorPairType error( columnCount - 1, fractionalError );
fractionalErrorRow.push_back( error );
fractionalErrorOccured = true;
++this->FractionalErrorCount;
}
double absoluteError = fabs( testTokenAsDouble - baselineTokenAsDouble );
if( absoluteError >= this->Parameters->AbsoluteTolerance )
{
NumericalErrorPairType error( columnCount - 1, absoluteError );
absoluteErrorRow.push_back( error );
//.........这里部分代码省略.........
示例4: readInts
//---------------------------------------------------------------------
void OgreMeshDeserializer::readInts(std::istream& stream, std::uint32_t* pDest, size_t count)
{
stream.read(reinterpret_cast<char*>(pDest), sizeof(std::uint32_t) * count);
flipFromLittleEndian(pDest, sizeof(std::uint32_t), count);
}
示例5: logic_error
task4_4::a_message::a_message( std::istream& inp )
{
inp.read( content_, content_size );
if ( inp.eof() )
throw std::logic_error("bad input stream, a_message cannot be readed");
}
示例6: importHistogram
bool ossimMultiResLevelHistogram::importHistogram(std::istream& in)
{
if (!in) // Check stream state.
{
return false;
}
ossimString buffer;
getline(in, buffer);
if ( in.eof() ) // Zero byte files will hit here.
{
return false;
}
// check to see if it is a proprietary histogram file
//
if((buffer =="") || (buffer.c_str()[0] != 'F' ||
buffer.c_str()[1] != 'i'))
{
in.seekg(0, ios::beg);
ossimKeywordlist kwl;
if (kwl.parseStream(in) == true)
{
return loadState(kwl);
}
else
{
return false;
}
}
ossimProprietaryHeaderInformation header;
in.seekg(0, ios::beg);
deleteHistograms();
if(header.parseStream(in))
{
ossim_uint32 numberOfResLevels = header.getNumberOfResLevels();
if(numberOfResLevels)
{
theHistogramList.resize(numberOfResLevels);
for(ossim_uint32 counter = 0; counter < (ossim_uint32)theHistogramList.size(); ++counter)
{
theHistogramList[counter] = NULL;
}
ossimString reslevelBuffer;
ossimString buffer;
for(ossim_uint32 idx = 0; idx < numberOfResLevels; ++idx)
{
getline(in, buffer);
if(buffer.find("RR Level") != string::npos)
{
std::string::size_type offset = buffer.find(":");
if(offset != string::npos)
{
reslevelBuffer = buffer.substr(offset+1);
}
else
{
deleteHistograms();
return false;
}
}
else
{
deleteHistograms();
return false;
}
ossim_uint32 resLevelIdx = reslevelBuffer.toUInt32();
if(resLevelIdx < (ossim_uint32)theHistogramList.size())
{
if(!theHistogramList[resLevelIdx])
{
ossimRefPtr<ossimMultiBandHistogram> histogram = new ossimMultiBandHistogram;
if(histogram->importHistogram(in))
{
theHistogramList[resLevelIdx] = histogram;
}
else
{
deleteHistograms();
return false;
}
}
}
else
{
deleteHistograms();
return false;
}
ossimString skipDot;
getline(in, skipDot);
}
}
else
{
//.........这里部分代码省略.........
示例7: atoi
void ossimDoqq::ldstr_v1(std::istream& in)
{
static const char MODULE[] = "ossimDoqq::ldstr_v1(istream& in)";
if (!in)
{
theErrorStatus = OSSIM_ERROR;
return;
}
char tmp1[DATA_ORDER_SIZE+1];
in.seekg(DATA_ORDER_OFFSET, std::ios::beg);
in.get(tmp1, DATA_ORDER_SIZE+1);
theDataOrder = tmp1;
//***
// Perform a sanity check on the data order just in case this isn't a
// ossimDoqq file.
//***
tmp1[DATA_ORDER_SIZE] = '\0';
int data_order = atoi(tmp1);
if ( (data_order != 1) && (data_order != 2) )
{
theErrorStatus = OSSIM_ERROR;
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_WARN)
<< MODULE << " NOTICE:\n"
<< "Invalid data ordering. Not a doq?" << std::endl;
}
}
char tmp2[LINE_SIZE+1];
in.seekg(LINE_OFFSET, std::ios::beg);
in.get(tmp2, LINE_SIZE+1);
theLine = atoi(tmp2);
char tmp3[SAMPLE_SIZE+1];
in.seekg(SAMPLE_OFFSET,std::ios::beg);
in.get(tmp3, SAMPLE_SIZE+1);
theSample = atoi(tmp3);
// Check for valid lines and samples.
if (theLine <= 0 || theSample <= 0)
{
theErrorStatus = OSSIM_ERROR;
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_WARN)
<< MODULE << " ERROR:\n"
<< "\tInvalid lines or samples."
<< std::endl;
}
return;
}
char tmp4[PROJECTION_SIZE+1];
in.seekg(PROJECTION_OFFSET, std::ios::beg);
in.get(tmp4, PROJECTION_SIZE+1);
theProjection = tmp4;
char tmp5[UTM_ZONE_SIZE+1];
in.seekg(UTM_ZONE_OFFSET, std::ios::beg);
in.get(tmp5, UTM_ZONE_SIZE+1);
theUtmZone = atoi(tmp5);
char tmp8[DATUM_SIZE+1];
in.seekg(DATUM_OFFSET, std::ios::beg);
in.get(tmp8, DATUM_SIZE+1);
theDatum = tmp8;
char rgbType[RGB_SIZE+1];
in.seekg(RGB_OFFSET, std::ios::beg);
in.get(rgbType, RGB_SIZE+1);
if(atoi(rgbType) == 5)
{
theRgb = 3;
}
else
{
theRgb = 1;
}
theHeaderSize = (theSample * theRgb * 4);
// Calculate the size of each record.
theRecordSize = (theSample * theRgb);
char tmp6[UL_EASTING_SIZE+1];
in.seekg( (theRecordSize * 2) + UL_EASTING_OFFSET, std::ios::beg);
in.get(tmp6, UL_EASTING_SIZE+1);
char tmp7[UL_NORTHING_SIZE+1];
in.seekg( (theRecordSize * 2) + UL_NORTHING_OFFSET, std::ios::beg);
in.get(tmp7, UL_NORTHING_SIZE+1);
//.........这里部分代码省略.........
示例8: if
void ossimDoqq::ldstr_v2(std::istream& in)
{
static const char MODULE[] = "ossimDoqq::ldstr_v2(istream& in)";
if (!in)
{
theErrorStatus = OSSIM_ERROR;
return;
}
char line[100];
char dum1[30];
char dum2[30];
char dum3[30];
char dum4[30];
while((strncmp(line, "END_USGS_HEADER", 15) != 0)&&
(in.good()))
{
// Read in one line of header at a time.
in.getline(line, 100);
if(strncmp(line, "SAMPLES_AND_LINES", 17) == 0)
{
sscanf(line, "%s %s %s", dum1, dum2, dum3);
theLine = atoi(dum3);
theSample = atoi(dum2);
}
else if(strncmp(line, "HORIZONTAL_COORDINATE_SYSTEM", 28) == 0)
{
sscanf(line, "%s %s", dum1, dum2);
theProjection = dum2;
}
else if(strncmp(line, "NW_QUAD_CORNER_XY", 17) == 0)
{
sscanf(line, "%s %s %s", dum1, dum2, dum3);
theUE = atof(dum2);
theUN = atof(dum3);
}
else if(strncmp(line, "NE_QUAD_CORNER_XY", 17) == 0)
{
sscanf(line, "%s %s %s", dum1, dum2, dum3);
theLE = atof(dum2);
theLN = atof(dum3);
}
else if(strncmp(line, "COORDINATE_ZONE", 15) == 0)
{
sscanf(line, "%s %s", dum1, dum2);
theUtmZone = atoi(dum2);
}
else if(strncmp(line, "SOURCE_IMAGE_DATE", 17) == 0)
{
sscanf(line, "%s %s %s %s", dum1, dum2, dum3, dum4);
theAcqYear = ossimString(dum2);
theAcqMonth = ossimString(dum3);
theAcqDay = ossimString(dum4);
}
else if((strncmp(line, "XY_ORIGIN", 9) == 0))
{
sscanf(line, "%s %s %s", dum1, dum2, dum3);
theEasting = atof(dum2);
theNorthing = atof(dum3);
}
else if((strncmp(line, "HORIZONTAL_DATUM", 16) == 0) && theDatum.empty())
{
ossimString datum;
sscanf(line, "%s %s", dum1, dum2);
datum = dum2;
if(datum.contains("NAD27"))
theDatum = "NAD";
else
theDatum = "NAR";
}
else if(strncmp(line, "BYTE_COUNT", 10) == 0)
{
ossimString header;
sscanf(line, "%s %s", dum1, dum2);
header = dum2;
theHeaderSize = atoi(header.chars());
}
else if(strncmp(line, "BAND_CONTENT", 12) == 0)
{
ossimString rgbType;
sscanf(line, "%s %s", dum1, dum2);
rgbType = dum2;
if(rgbType.contains("BLACK&WHITE"))
theRgb = 1;
//.........这里部分代码省略.........
示例9: Load
void matrix::Load(std::istream& in)
{
int i,j;
for( i=0; i<vert; i++ ) for( j=0; j<horz; j++ )
in.read((char*) &(*this)(i, j), sizeof(float));
}
示例10: updateConfigObject
bool Settings::updateConfigObject(std::istream &is, std::ostream &os,
const std::string &end, u32 tab_depth)
{
std::map<std::string, SettingsEntry>::const_iterator it;
std::set<std::string> present_entries;
std::string line, name, value;
bool was_modified = false;
bool end_found = false;
// Add any settings that exist in the config file with the current value
// in the object if existing
while (is.good() && !end_found) {
std::getline(is, line);
SettingsParseEvent event = parseConfigObject(line, end, name, value);
switch (event) {
case SPE_END:
os << line << (is.eof() ? "" : "\n");
end_found = true;
break;
case SPE_MULTILINE:
value = getMultiline(is);
/* FALLTHROUGH */
case SPE_KVPAIR:
it = m_settings.find(name);
if (it != m_settings.end() &&
(it->second.is_group || it->second.value != value)) {
printEntry(os, name, it->second, tab_depth);
was_modified = true;
} else {
os << line << "\n";
if (event == SPE_MULTILINE)
os << value << "\n\"\"\"\n";
}
present_entries.insert(name);
break;
case SPE_GROUP:
it = m_settings.find(name);
if (it != m_settings.end() && it->second.is_group) {
os << line << "\n";
sanity_check(it->second.group != NULL);
was_modified |= it->second.group->updateConfigObject(is, os,
"}", tab_depth + 1);
} else {
printEntry(os, name, it->second, tab_depth);
was_modified = true;
}
present_entries.insert(name);
break;
default:
os << line << (is.eof() ? "" : "\n");
break;
}
}
// Add any settings in the object that don't exist in the config file yet
for (it = m_settings.begin(); it != m_settings.end(); ++it) {
if (present_entries.find(it->first) != present_entries.end())
continue;
printEntry(os, it->first, it->second, tab_depth);
was_modified = true;
}
return was_modified;
}
示例11: demo_sequence_info_read
bool demo_sequence_info_read(std::istream& is, demo_sequence_info& s) {
is.read(reinterpret_cast<char*>(&s.seq_number_in), sizeof(s.seq_number_in));
is.read(reinterpret_cast<char*>(&s.seq_number_out), sizeof(s.seq_number_out));
return is.good();
}
示例12: demo_cmdinfo_read
bool demo_cmdinfo_read(std::istream& is, demo_cmdinfo& s) {
demo_cmdinfo_player_read(is, s.players[0]);
demo_cmdinfo_player_read(is, s.players[1]);
return is.good();
}
示例13: istrstream
}
};
std::ostream& operator<<(std::ostream& out, const ostrstream& x) {
out << static_cast<strstreambuf*>(x.rdbuf())->str();
return out;
}
class istrstream : public std::istream {
strstreambuf sb;
public:
istrstream(char* buf) : sb(buf) { }
template<class T>
istrstream& operator>>(T& x) {
std::istream in(&sb);
in.copyfmt(*this);
in >> x;
setstate(in.rdstate());
return *this;
}
};
}
int main() {
using namespace std;
using namespace ch21;
char buf[1024];
ostrstream out(buf, 1024);
out << "foo bar " << 12345;
示例14:
fourcc::fourcc( std::istream &in )
{
in.read( _char, 4 );
}
示例15: LoadFromStream
Bool TgaFile::LoadFromStream( std::istream & p_Stream )
{
// Read the stream size.
p_Stream.seekg( 0, std::fstream::end );
SizeType fileSize = static_cast<SizeType>( p_Stream.tellg( ) );
p_Stream.seekg( 0, std::fstream::beg );
// Error check the stream size
if( fileSize < 18 )
{
bitLogGraErr( "Missing header field." );
p_Stream.seekg( 0, std::fstream::beg ); // Go back to the begining of the stream
return false;
}
// Read the header.
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_IdLength ), 1 );
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ColorMapType ), 1 );
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ImageType ), 1 );
// Read color map specifications
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ColorMapSpec.m_Offset ), 2 );
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ColorMapSpec.m_Length ), 2 );
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ColorMapSpec.m_EntrySize ), 1 );
// Read image specifications
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ImageSpec.m_OriginX ), 2 );
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ImageSpec.m_OriginY ), 2 );
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ImageSpec.m_ImageWidth ), 2 );
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ImageSpec.m_ImageHeight ), 2 );
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ImageSpec.m_PixelDepth ), 1 );
p_Stream.read( reinterpret_cast<char *>( &m_Header.m_ImageSpec.m_ImageDescriptor ), 1 );
// Error check the header field.
if( m_Header.m_ImageSpec.m_PixelDepth != 8 &&
m_Header.m_ImageSpec.m_PixelDepth != 16 &&
m_Header.m_ImageSpec.m_PixelDepth != 24 &&
m_Header.m_ImageSpec.m_PixelDepth != 32 )
{
bitLogGraErr( "Not supporting " << (int)m_Header.m_ImageSpec.m_PixelDepth << " bit pixel depth." );
p_Stream.seekg( 0, std::fstream::beg ); // Go back to the begining of the stream
return false;
}
// Error check the image type
if( m_Header.GetImageType( ) != UncompressedTrueColorImage &&
m_Header.GetImageType( ) != UncompressedGrayscaleImage )
{
bitLogGraErr( "Not supporting color mapped or compressed images." );
p_Stream.seekg( 0, std::fstream::beg ); // Go back to the begining of the stream
return false;
}
if( m_Header.GetImageType( ) == UncompressedGrayscaleImage && m_Header.m_ImageSpec.m_PixelDepth != 8 )
{
bitLogGraErr( "Not supporting non 8 bit grayscale iamges." );
p_Stream.seekg( 0, std::fstream::beg ); // Go back to the begining of the stream
return false;
}
// Clear the old pixel data.
if( m_pData )
{
delete m_pData;
}
// Calcualte the data size.
m_DataSize = static_cast<SizeType>( m_Header.m_ImageSpec.m_ImageWidth ) *
static_cast<SizeType>( m_Header.m_ImageSpec.m_ImageHeight ) *
static_cast<SizeType>( m_Header.m_ImageSpec.m_PixelDepth / 8 );
// Read the data if we are expecting any data.
if( m_DataSize != 0 )
{
// Check if the data fits in the file
if( fileSize < m_DataSize + 18 )
{
bitLogGraErr( "The expected data size is too large." );
p_Stream.seekg( 0, std::fstream::beg ); // Go back to the begining of the stream
return false;
}
// Allocate the data
m_pData = new Uint8[ m_DataSize ];
// Read the bitmap data
p_Stream.read( reinterpret_cast<char *>( m_pData ), m_DataSize );
}
// Read the footer( optional )
if( fileSize >= 44 + m_DataSize )
{
// Seek to the end where the footer is expected to be
p_Stream.seekg( 26, std::fstream::end );
// Read the footer
p_Stream.read( reinterpret_cast<char *>( &m_Footer.m_ExtensionOffset ), 4 );
p_Stream.read( reinterpret_cast<char *>( &m_Footer.m_DeveloperAreaOffset ), 4 );
p_Stream.read( reinterpret_cast<char *>( m_Footer.m_Signature ), 16 );
p_Stream.read( reinterpret_cast<char *>( &m_Footer.m_Dot ), 1 );
p_Stream.read( reinterpret_cast<char *>( &m_Footer.m_End ), 1 );
}
//.........这里部分代码省略.........