当前位置: 首页>>代码示例>>C++>>正文


C++ BinaryFile::Close方法代码示例

本文整理汇总了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;
}
开发者ID:pmatos,项目名称:boomerang,代码行数:41,代码来源:FrontPentTest.cpp

示例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;
}
开发者ID:gattschardo,项目名称:s25client,代码行数:17,代码来源:GameSavegame.cpp

示例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;
}
开发者ID:gattschardo,项目名称:s25client,代码行数:17,代码来源:GameSavegame.cpp

示例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;
    }
开发者ID:Fuatnow,项目名称:Pyros3D,代码行数:101,代码来源:AssimpModelImporter.cpp


注:本文中的BinaryFile::Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。