本文整理汇总了C++中BinaryFile::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryFile::Close方法的具体用法?C++ BinaryFile::Close怎么用?C++ BinaryFile::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryFile
的用法示例。
在下文中一共展示了BinaryFile::Close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testFindMain
void FrontPentTest::testFindMain()
{
// Test the algorithm for finding main, when there is a call to __libc_start_main
// Also tests the loader hack
BinaryFileFactory bff;
BinaryFile *pBF = bff.Load(FEDORA2_TRUE);
CPPUNIT_ASSERT(pBF != NULL);
Prog *prog = new Prog;
FrontEnd *pFE = new PentiumFrontEnd(pBF, prog, &bff);
prog->setFrontEnd(pFE);
CPPUNIT_ASSERT(pFE != NULL);
bool found;
ADDRESS addr = pFE->getMainEntryPoint(found);
ADDRESS expected = 0x8048b10;
CPPUNIT_ASSERT_EQUAL(expected, addr);
pBF->Close();
bff.UnLoad();
pBF = bff.Load(FEDORA3_TRUE);
CPPUNIT_ASSERT(pBF != NULL);
pFE = new PentiumFrontEnd(pBF, prog, &bff);
prog->setFrontEnd(pFE);
CPPUNIT_ASSERT(pFE != NULL);
addr = pFE->getMainEntryPoint(found);
expected = 0x8048c4a;
CPPUNIT_ASSERT_EQUAL(expected, addr);
pBF->Close();
bff.UnLoad();
pBF = bff.Load(SUSE_TRUE);
CPPUNIT_ASSERT(pBF != NULL);
pFE = new PentiumFrontEnd(pBF, prog, &bff);
prog->setFrontEnd(pFE);
CPPUNIT_ASSERT(pFE != NULL);
addr = pFE->getMainEntryPoint(found);
expected = 0x8048b60;
CPPUNIT_ASSERT_EQUAL(expected, addr);
pBF->Close();
delete pFE;
}
示例2: Save
/**
*
* @author OLiver
*/
bool Savegame::Save(const std::string& filename)
{
BinaryFile file;
if(!file.Open(filename, OFM_WRITE))
return false;
bool ret = Save(file);
file.Close();
return ret;
}
示例3: Load
/**
*
* @author OLiver
*/
bool Savegame::Load(const std::string& filePath, const bool load_players, const bool load_sgd)
{
BinaryFile file;
if(!file.Open(filePath, OFM_READ))
return false;
bool ret = Load(file, load_players, load_sgd);
file.Close();
return ret;
}
示例4: ConvertToPyrosFormat
//.........这里部分代码省略.........
bin->Write(&Out, sizeof(uchar));
}
}
// SubMeshes
int32 subMeshesSize = subMeshes.size();
bin->Write(&subMeshesSize, sizeof(int32));
for (std::vector<SubMesh>::iterator i=subMeshes.begin();i!=subMeshes.end();i++)
{
// Name
int32 nameSize = (*i).Name.size();
bin->Write(&nameSize,sizeof(int32));
if (nameSize>0)
bin->Write((*i).Name.c_str(),sizeof(char)*nameSize);
// Index
int32 indexSize = (*i).tIndex.size();
bin->Write(&indexSize,sizeof(int32));
if (indexSize>0)
bin->Write(&(*i).tIndex[0], sizeof(int32)*indexSize);
// Vertex
int32 vertexSize = (*i).tVertex.size();
bin->Write(&vertexSize,sizeof(int32));
if (vertexSize>0)
bin->Write(&(*i).tVertex[0], sizeof(Vec3)*vertexSize);
// Normal
int32 normalSize = (*i).tNormal.size();
bin->Write(&normalSize,sizeof(int32));
if (normalSize>0)
bin->Write(&(*i).tNormal[0], sizeof(Vec3)*normalSize);
// Tangent
int32 tangentSize = (*i).tTangent.size();
bin->Write(&tangentSize,sizeof(int32));
if (tangentSize>0)
{
bin->Write(&(*i).tTangent[0], sizeof(Vec3)*tangentSize);
bin->Write(&(*i).tBitangent[0], sizeof(Vec3)*tangentSize);
}
// Texcoord
int32 texcoordSize = (*i).tTexcoord.size();
bin->Write(&texcoordSize, sizeof(int32));
if (texcoordSize>0)
bin->Write(&(*i).tTexcoord[0], sizeof(Vec2)*texcoordSize);
// Vertex Color
int32 vertexColorSize = (*i).tVertexColor.size();
bin->Write(&vertexColorSize, sizeof(int32));
if (vertexColorSize>0)
bin->Write(&(*i).tVertexColor[0], sizeof(Vec4)*vertexColorSize);
// Bones
int32 BonesSize = (*i).tBonesID.size();
bin->Write(&BonesSize, sizeof(int32));
if (BonesSize>0)
{
bin->Write(&(*i).tBonesID[0], sizeof(Vec4)*BonesSize);
bin->Write(&(*i).tBonesWeight[0], sizeof(Vec4)*BonesSize);
}
// Map Bones IDs
int32 MapBoneIDsSize = (*i).MapBoneIDs.size();
bin->Write(&MapBoneIDsSize, sizeof(int32));
if (MapBoneIDsSize>0)
{
// Copy Index
for (std::map<int32,int32>::iterator k=(*i).MapBoneIDs.begin();k!=(*i).MapBoneIDs.end();k++)
{
bin->Write(&(*k).first, sizeof(int32));
bin->Write(&(*k).second, sizeof(int32));
}
}
// Offset Matrix
int32 BoneOffsetMatrixSize = (*i).BoneOffsetMatrix.size();
bin->Write(&BoneOffsetMatrixSize, sizeof(int32));
if (BoneOffsetMatrixSize>0)
{
// Copy Index
for (std::map<int32,Matrix>::iterator k=(*i).BoneOffsetMatrix.begin();k!=(*i).BoneOffsetMatrix.end();k++)
{
bin->Write(&(*k).first, sizeof(int32));
bin->Write(&(*k).second.m[0], sizeof(Matrix));
}
}
// Material ID
bin->Write(&(*i).materialID, sizeof(int32));
}
bin->Close();
delete bin;
return true;
} else return false;
}