Пример #1
0
void LevelUploader::loadFileName(QString nom)
{
	fullfilename=nom;
	QFileInfo infofile(fullfilename);
	filename = infofile.fileName();
	label_namefile->setText(tr("Name file: %1").arg(filename));
}
Пример #2
0
//----------------< Do Post Process >--------------------------------
//
void PostHandler::DoProcess()
{
    setProtocal(this->_http_Request._protocal);
    std::string action;
    //check the action
    if (this->_http_Request._relativeURL.find("message/") != std::string::npos) {
        //this is message action
        action = "message";
        /* Put the code of how to handle the message */
        std::cout<<"the message is:\n";
        for(int i=0; i<_http_Request._content_Length; i++)
            std::cout<<this->_http_Request._requestContent[i];
        std::cout<<"\n";
    } else if (this->_http_Request._relativeURL.find("files/") != std::string::npos) {
        //this is a file action
        action="file";
        ResourceSave(this->_http_Request._relativeURL,
                     this->_http_Request._requestContent,
                     this->_http_Request._content_Length);
        /* write the file info to the info file */

        std::ofstream infofile("info.txt");
        infofile<<ScanFiles("files/");
        infofile.close();
    } else {
        //handle the unknown action


        this->setContentType("text/html");
        std::string msgBody("<p>post failure</p>");
        this->setContentLength(msgBody.size());
        char *msg = new char[msgBody.size()];
        for(size_t i=0; i<msgBody.size(); i++)
            msg[i]=msgBody[i];
        this->setMsgBody(msg);
        setStatus("404 Bad");
        _hasProcessed = true;
        return;
    }
    this->setContentType("text/html");
    std::string msgBody("<p>"+action+" posted successfully</p>");
    this->setContentLength(msgBody.size());
    char *msg = new char[msgBody.size()];
    for(size_t i=0; i<msgBody.size(); i++)
        msg[i]=msgBody[i];
    this->setMsgBody(msg);
    setStatus("200 OK");
    _hasProcessed = true;
    return;
}
bool parallelPlanningOnce(ConstrainedProblem &cp, enum PLANNER_TYPE planner, bool output)
{
    cp.setPlanner(planner, "parallel");

    // Solve the problem
    ob::PlannerStatus stat = cp.solveOnce(output, "parallel");

    if (output)
    {
        OMPL_INFORM("Dumping problem information to `parallel_info.txt`.");
        std::ofstream infofile("parallel_info.txt");
        infofile << cp.type << std::endl;
        dynamic_cast<ParallelConstraint *>(cp.constraint.get())->dump(infofile);
        infofile.close();
    }

    cp.atlasStats();

    return stat;
}
Пример #4
0
bool spherePlanningOnce(ConstrainedProblem &cp, enum PLANNER_TYPE planner, bool output)
{
    cp.setPlanner(planner, "sphere");

    // Solve the problem
    ob::PlannerStatus stat = cp.solveOnce(output, "sphere");

    if (output)
    {
        OMPL_INFORM("Dumping problem information to `sphere_info.txt`.");
        std::ofstream infofile("sphere_info.txt");
        infofile << cp.type << std::endl;
        infofile.close();
    }

    cp.atlasStats();

    if (output)
        cp.dumpGraph("sphere");

    return stat;
}
Пример #5
0
int main(int argc, char* argv[])
{
	char filename[512];
	char filetoget[512];
	char ofilename[512];
	char outputformat[512];
	char layoutformat[128];
	char temp[512];
	int loaderid;
	int interfacemode;
	int doublestep;

	HXCFLOPPYEMULATOR* hxcfe;

	verbose=0;
	doublestep=-1;

	hxcfe=hxcfe_init();
	hxcfe_setOutputFunc(hxcfe,&CUI_affiche);

	printf("HxC Floppy Emulator : Floppy image file converter\n");
	printf("Copyright (C) 2006-2013 Jean-Francois DEL NERO\n");
	printf("This program comes with ABSOLUTELY NO WARRANTY\n");
	printf("This is free software, and you are welcome to redistribute it\n");
	printf("under certain conditions;\n\n");

	printf("libhxcfe version : %s\n\n",hxcfe_getVersion(hxcfe));

	// License print...
	if(isOption(argc,argv,"license",0)>0)
	{
		printf("License :\n%s\n\n",hxcfe_getLicense(hxcfe));
	}

	// Verbose option...
	if(isOption(argc,argv,"verbose",0)>0)
	{
		printf("verbose mode\n");
		verbose=1;
	}

	// help option...
	if(isOption(argc,argv,"help",0)>0)
	{
		printhelp(argv);
	}

	memset(filename,0,sizeof(filename));

	// Input file name option
	if(isOption(argc,argv,"finput",(char*)&filename)>0)
	{
		printf("Input file : %s\n",filename);
	}

	// Output file name option
	memset(ofilename,0,512);
	isOption(argc,argv,"foutput",(char*)&ofilename);

	// Module list option
	if(isOption(argc,argv,"modulelist",0)>0)
	{
		printlibmodule(hxcfe);
	}

	// Interface mode list option
	if(isOption(argc,argv,"interfacelist",0)>0)
	{
		printinterfacemode(hxcfe);
	}

	// Interface mode list option
	if(isOption(argc,argv,"rawlist",0)>0)
	{
		printdisklayout(hxcfe);
	}

	// Interface mode option
	interfacemode=-1;
	if(isOption(argc,argv,"ifmode",(char*)&temp)>0)
	{
		interfacemode=hxcfe_getFloppyInterfaceModeID(hxcfe,temp);
		if(interfacemode<0)
		{
			printf("Unknown Interface mode ! : %s\n",temp);
			printf("Please use the -interfacelist option for possible interface modes.\n\n");
			hxcfe_deinit(hxcfe);
			return -1;
		}
	}

	if(isOption(argc,argv,"infos",0)>0)
	{
		infofile(hxcfe,filename);
	}

	// Convert a file ?
	if(isOption(argc,argv,"conv",0)>0)
	{
		strcpy(outputformat,PLUGIN_HXC_HFE);
		isOption(argc,argv,"conv",(char*)&outputformat);

		loaderid=hxcfe_getLoaderID(hxcfe,outputformat);
		if(loaderid>=0)
		{
			if(!strlen(ofilename))
			{
				get_filename(filename,ofilename);
				strcat(ofilename,".");
				strcat(ofilename,hxcfe_getLoaderExt(hxcfe,loaderid));
			}

			printf("Output file : %s\n",ofilename);

		}

		if(isOption(argc,argv,"uselayout",(char*)&layoutformat)>0)
		{
			convertrawfile(hxcfe,filename,layoutformat,ofilename,outputformat,interfacemode);
		}
		else
		{
			convertfile(hxcfe,filename,ofilename,outputformat,interfacemode);
		}
	}

	if(isOption(argc,argv,"singlestep",0)>0)
	{
		doublestep=0;
	}

	if(isOption(argc,argv,"doublestep",0)>0)
	{
		doublestep=0xFF;
	}

	if(isOption(argc,argv,"list",0)>0)
	{
		imagedir(hxcfe,filename);
	}

	if(isOption(argc,argv,"getfile",(char*)&filetoget)>0)
	{
		getfile(hxcfe,filename,filetoget);
	}

	if(isOption(argc,argv,"putfile",(char*)&filetoget)>0)
	{
		putfile(hxcfe,filename,filetoget);
	}

	
	// Input file name option
	if(isOption(argc,argv,"usb",(char*)&temp)>0)
	{
		usbload(hxcfe,filename,temp[0]-'0',doublestep,interfacemode);
	}

	if( (isOption(argc,argv,"help",0)<=0) && 
		(isOption(argc,argv,"license",0)<=0) &&
		(isOption(argc,argv,"modulelist",0)<=0) &&
		(isOption(argc,argv,"interfacelist",0)<=0) &&
		(isOption(argc,argv,"list",0)<=0) &&
		(isOption(argc,argv,"getfile",0)<=0) &&
		(isOption(argc,argv,"putfile",0)<=0) &&
		(isOption(argc,argv,"conv",0)<=0) &&
		(isOption(argc,argv,"usb",0)<=0) &&
		(isOption(argc,argv,"rawlist",0)<=0) &&
		(isOption(argc,argv,"infos",0)<=0 )
		)
	{
		printhelp(argv);
	}

	hxcfe_deinit(hxcfe);

	return 0;
}