• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ parseInput函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中parseInput函数的典型用法代码示例。如果您正苦于以下问题:C++ parseInput函数的具体用法?C++ parseInput怎么用?C++ parseInput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parseInput函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: insertKeystroke

bool ofxGuiInputField<Type>::keyPressed(ofKeyEventArgs & args){
	if(hasFocus && !bMousePressed){

		int newCursorIdx = -1;
		if(args.key >= '0' && args.key <= '9'){
			int digit = args.key - '0';
			newCursorIdx = insertKeystroke(ofToString(digit));
		}else if(args.key == '.' ){
			newCursorIdx = insertKeystroke(".");
		}else if(args.key == OF_KEY_BACKSPACE || args.key == OF_KEY_DEL){
			if(hasSelectedText()){
				input.erase(selectStartPos,selectEndPos-selectStartPos);
				newCursorIdx = selectStartPos;
				parseInput();
			}else{
				int deleteIdx = -1;
				if(args.key == OF_KEY_BACKSPACE){
					deleteIdx = selectStartPos-1;
				}else if(args.key == OF_KEY_DEL){
					deleteIdx = selectStartPos;
				}

				//erase char if valid deleteIdx
				if(deleteIdx >= 0 && deleteIdx < (int)input.size()){
					input.erase(deleteIdx,1);
					newCursorIdx = deleteIdx;
					parseInput();
				}
			}
		}else if(args.key == OF_KEY_LEFT){
			if(hasSelectedText()){
				newCursorIdx = selectStartPos;
			}else{
				newCursorIdx = selectStartPos == 0 ? 0 : selectStartPos-1;
			}
		}else if(args.key == OF_KEY_RIGHT){
			if(hasSelectedText()){
				newCursorIdx = selectEndPos;
			}else{
				newCursorIdx = selectStartPos == (int)input.size() ? (int)input.size() : selectStartPos+1;
			}
		}else if(args.key == OF_KEY_RETURN){
			leaveFocus();
		}else if((args.key >= '!' && args.key <= '~')
				 || (args.key <= 'a' && args.key >= 'Z')
				 || (args.key == ' ')){
			newCursorIdx = insertAlphabetic(ofToString((char)args.key));
		}

		if(newCursorIdx != -1){
			//set cursor
			calculateSelectionArea(newCursorIdx,newCursorIdx);
		}
		return true;
	}
	return false;
}
开发者ID:nanu-c,项目名称:ofxGuiExtended,代码行数:57,代码来源:ofxGuiInputField.cpp


示例2: switch

void interaction::takeAction() {
    int status;
    switch((status=parseInput())) {
        case QUIT:
            quit();
            break;
        case HELP:
            help();
            break;
        case ME:
            traceMe();
            break;
        case FNAME:
            traceFname();
            break;
        case IPHOST:
            traceIpHost(ipHostFname);
            break;
        case INVLD:
            invalid();
            break;
        default:
            break;
    }
}
开发者ID:ryanzhao,项目名称:tracerouteServer,代码行数:25,代码来源:interaction.cpp


示例3: throw

Engine::Engine(std::string inputFileName, unsigned int baseTicks) throw (std::string) 
{
    this->baseTicks = baseTicks;

    // set parse error message
    std::stringstream parseErrorStream;
    parseErrorStream << "Was not able to parse File." << std::endl << "Please check if syntax is valid" 
        << std::endl << "Abborting ...." << std::endl;
    parseError = parseErrorStream.str();

    // Try to open File
    inputFile = new std::ifstream(inputFileName.c_str(), std::ifstream::in);
    // Check if File was opened succesfull
    if (!*inputFile) 
    {
        std::stringstream error;
        error << "Was not able to open File." << std::endl << "Please check if File exists" 
            << std::endl << "Abborting ...." << std::endl;
        throw error.str();
    }

    // Parse Input
    try 
    {
        parseInput();
    }
    catch (std::string error)
    {
        throw error;
    }
}
开发者ID:maxeler,项目名称:FuzzyLogicGenerator,代码行数:31,代码来源:engine.cpp


示例4: main

int main(void)
{
	char connect_param[200];
	
	sprintf(connect_param,
				"host=csl2.cs.technion.ac.il dbname=%s user=%s password=%s",
				USERNAME, USERNAME, PASSWORD);
				
	conn = PQconnectdb(connect_param);
	
	/* check to see that the backend connection was successfully made */
	if (!conn || PQstatus(conn) == CONNECTION_BAD)
	{
		fprintf(stderr, "Connection to server failed: %s\n",
		PQerrorMessage(conn));
		PQfinish(conn);
		return 1;
	}

	parseInput();
	
	/* Close the connection to the database and cleanup */
	PQfinish(conn);
	
	return 0;
}
开发者ID:dekel2003,项目名称:DBS_HW2,代码行数:26,代码来源:wet.c


示例5: main

int main()
{
    while(loop == 0)
    {
        // Gets the current working directory for the application and prints it out
        char currDir[256];
        getcwd(currDir, 255);
        fprintf(stdout, "%s\n", currDir);
        
        fgets(input, buffer, stdin);
        
        // Get a list of all the commands to be run
        cmdTok = strtok(input, &delim);
        numCmd = 1;
        while(cmdTok)
        {            
           cmdArray = realloc (cmdArray, sizeof (char*) * numCmd);
           if(cmdTok[strlen(cmdTok)-1] == '\n')
                cmdTok[strlen(cmdTok)-1] = '\0';
           cmdArray[numCmd-1] = cmdTok;
           numCmd++;            
           cmdTok = strtok(NULL, &delim);
        }
        // Run all the commands (This didn't work for me in the one loop for some reason)
        for(i = 0; i < numCmd-1; i++)
        {
            parseInput(cmdArray[i]);
        }
    }
    
    return 0;
}
开发者ID:jamesd24,项目名称:SystemsProgramming,代码行数:32,代码来源:terminal.c


示例6: startDemon

void startDemon() {
  DWIFIClose();
  sleep(500);
  DWIFITCPOpenServer(80);
  RS485clearRead();
  parseInput();
}
开发者ID:rpgteamtn,项目名称:3rdPartyDriversLibrary,代码行数:7,代码来源:dexterind-wifi.c


示例7: parseAssign

/*** Parse a statement ***/
Node* Parser::parseStatement()
{
	if(hasTokens(2) && peekToken().getType() == T_IDENTIFIER && peekToken(2).getType() == T_ASSIGN)
		return parseAssign();
	if(hasTokens(2) && peekToken().getType() == T_IDENTIFIER && peekToken(2).getType() == T_LPAREN)
		return parseCall();
	if(hasTokens() && peekToken().getType() == T_CALL)
		return parseCall();
	if(hasTokens() && peekToken().getType() == T_CASE)
		return parseCase();
	if(hasTokens() && peekToken().getType() == T_DO)
		return parseDo();
	if(hasTokens() && peekToken().getType() == T_END)
		return parseEnd();
	if(hasTokens() && peekToken().getType() == T_EXIT)
		return parseExit();
	if(hasTokens() && peekToken().getType() == T_FOR)
		return parseFor();
	if(hasTokens() && peekToken().getType() == T_IF)
		return parseIf();
	if(hasTokens() && peekToken().getType() == T_INPUT)
		return parseInput();
	if(hasTokens() && peekToken().getType() == T_OUTPUT)
		return parseOutput();
	if(hasTokens() && peekToken().getType() == T_REPEAT)
		return parseRepeat();
	if(hasTokens() && peekToken().getType() == T_RETURN)
		return parseReturn();
	if(hasTokens(2) && peekToken(1).getType() == T_IDENTIFIER && peekToken(2).getType() == T_LBRACKET)
		return parseSliceSelectAssign();
	if(hasTokens() && peekToken().getType() == T_WHILE)
		return parseWhile();
	throw ParserSyntaxException(getToken(), "Invalid statement!");
	return 0;
}
开发者ID:denrusio,项目名称:vak-opensource,代码行数:36,代码来源:parser.cpp


示例8: readBlocksFile

//Read the blocks file
int readBlocksFile() {
	
	FILE* fp;
	char line[256];
	int blockIndex = 0;
	
	//if fp is null, display error
	fp = fopen("Blocks.txt", "r");
	if(fp == NULL){
		perror("[ERROR]");
		return 0;
	} else {
		//loop through each line (ignoring text at beginning) and store relevant information
		while(fgets(line, 300, fp) != NULL) {
			if(line[0] == '#' || line[0] == ' ' || line[0] == '\n'){ continue; } 
			else {
				parseInput(line, blockIndex);
				blockIndex++;
			}
		}

		fclose(fp);
		return blockIndex;
	}
}
开发者ID:mhixon,项目名称:CIS308,代码行数:26,代码来源:lab3.c


示例9: main

/* Note: When a single t is given, we assume R = r
 */
int main(void)
{
    int T, input[MAX_NUM_INPUT], numInput;
    char line[MAX_LEN_LINE + 1];
    double R, r;

    scanf("%d", &T);
    gets(line);

    while(T)
    {
        gets(line);

        numInput = parseInput(line, input);

        if(numInput == 1)
        {
            R = input[0] / 4.0;
            r = R;
        }
        else
        {
            R = (double) input[0];
            r = (double) input[1];
        }
        printf("%.4lf\n", computeCircleArea(R + r)
               - computeCircleArea(R)
               - computeCircleArea(r));
        T--;
    }
    return 0;
}
开发者ID:sabbir25112,项目名称:uva-online-judge-solutions,代码行数:34,代码来源:UVA10573.c


示例10: acceptInput

void acceptInput() {

        char line[256];
        char input[256];
	char request[256];
	char response[256];

        // infinite loop
        while(1) {
                // display prompt
                fputs(">> ", stderr);
                // accept input
                fgets(line, sizeof line, stdin);
                sscanf(line, "%s", input);
                // if input is "exit"
                if(strcmp(input, "exit") == 0)
                        exit(0); // quit program
                else {
                        fprintf(stdout, "String Entered %s, Characters read : %d\n", input, strlen(line) - 1);
			parseInput(input, request);
			submitRequest(request);
			acceptResponse(response);
			parseResponse(response);
		}
        }
}
开发者ID:ConorLambert,项目名称:sql-database,代码行数:26,代码来源:sql_client.c


示例11: shellLoop

void shellLoop()
{
    char *input, *originalInput;
    TokenContainer tc;
    bool running = true;

    while(running)
    {
        printf(YELLOW "λ mini437sh-JG-DS: " NORMAL_COLOR);
        input = getInput();
        originalInput = malloc(strlen(input) + 1);
        strcpy(originalInput, input);
        tc = parseInput(input);
        if (!emptyInput(&tc))
        {
            if (exitRequested(&tc))
                running = false;
            else
            {
                running = launchCommands(&tc, originalInput);
            }
        }
        free(input);
        free(originalInput);
    }
    killChildren();
    free(tc.tokens);
}
开发者ID:l50,项目名称:jdshell,代码行数:28,代码来源:mini437_JG_DS.c


示例12: getArgument

void
ManagerFilter::buildInitialWork()
{
    // Get Params and Read Graph
    int numVertices;
    string graphFile = getArgument("n");
    parseInput(graphFile, edges, numVertices);
    this->gamma = atof(getArgument("g").c_str());
    this->minQCSize = atoi(getArgument("q").c_str());

    // Initially, all vertices ar in candExt
    Candidate start;
    for (int i = 1; i <= numVertices; i++) {
        start.candExt.insert(i);
    }

    // Remove vertices that obviously are not candidates 
    int min = (int) ceil(gamma*(minQCSize-1));
    IntSet::iterator it = start.candExt.begin();
    while (it != start.candExt.end()) {
        IntSet::iterator aux = it;
        it++;
        if (edges[*aux].size() < min) {
            start.candExt.erase(aux);
        }
    }

    // Add it as new work
    workQueue.push(start);
}
开发者ID:leolvt,项目名称:FSPD-SCORP,代码行数:30,代码来源:ManagerFilter.cpp


示例13: searchInput

void searchInput(const char *flastok, const char *fhit)
{
	MFILE *mfbuf=mfopen();
	const char *input, *ta, *hit, *select, *end, *test;

	hit=flastok;
	do{
		input=strstr(hit, "<input");
		ta=strstr(hit, "<textarea");
		select=strstr(hit, "<select");
		hit=(char*)0x8FFFFFFF;
		if(input!=NULL && input<hit) hit=input;
		if(ta!=NULL && ta<hit) hit=ta;
		if(select!=NULL && select < hit) hit=select;
		if(hit!=(char*)0x8FFFFFFF && hit<fhit){
			end=strchr(hit, '>');
			test=strchr(hit+1, '<');
			if(test!=NULL && test<end) end=strchr(end+1, '>');
			mfSetLength(mfbuf, 0);
			mfwrite((void*)hit+1, 1, end-hit-1, mfbuf);
			printf("Input: %s\n", mfGetData(mfbuf));
			parseInput(mfGetData(mfbuf));
			hit++;
		}
	}while(hit!=(char*)0x8FFFFFFF && hit<fhit);

	mfclose(mfbuf);
}
开发者ID:LogisticalComputingAndInternetworking,项目名称:LoRS,代码行数:28,代码来源:html2h.c


示例14: QWidget

SodController::SodController(QWidget* parent)
  : QWidget(parent)
{
  input = new CLineEdit(this);
  output = new QPlainTextEdit(this);

  commandPos = 0;
  historySize = 300;
  connect(input, SIGNAL(returnPressed()), this, SLOT(parseInput()) );
  connect(input, SIGNAL(arrowPressed(bool)), this, SLOT(repeatCommand(bool)) );

  QVBoxLayout* mainBox = new QVBoxLayout(this);
  mainBox->addWidget(output);
  mainBox->addWidget(input);

  // and the set of general functions
  general_functions["read_distances"] = &SodController::read_distances;
  general_functions["read_positions"] = &SodController::read_positions;
  general_functions["read_annotation"] = &SodController::read_annotation;
  general_functions["shrink_dims"] = &SodController::shrink_dims;
  general_functions["set_plot_par"] = &SodController::set_plot_par;
  general_functions["titrate"] = &SodController::titrate;
  general_functions["gaussian_bg"] = &SodController::make_gaussian_background;
  general_functions["export_points"] = &SodController::export_points;
  general_functions["export_positions"] = &SodController::export_positions;
  general_functions["postscript"] = &SodController::postscript;
  general_functions["draw_grid"] = &SodController::drawGrid;
}
开发者ID:lmjakt,项目名称:dvreader,代码行数:28,代码来源:SodController.cpp


示例15: parseInput

progC::progC(std::ifstream& infile){
    

    //infile.open("file1");
	parseInput(infile);
    
}
开发者ID:oscarmendezm,项目名称:LOGO_Interpreter_Xcode,代码行数:7,代码来源:progC.cpp


示例16: main

int main(int argc, char *argv[]) {
  char inputSequenceFile[100], log_desc[1000] ;
  int ret ;

  if(argc != 2) {
    printf("Usage: %s <input-transaction-file-path>\n", argv[0]) ;
    return  0 ;
  }
  strcpy(inputSequenceFile, argv[1]) ;
  ret = checkFileExists(inputSequenceFile) ;
  if(ret == -1) {
   printf("main: File %s does not exist or is an empty file. Exiting\n", inputSequenceFile) ;
   return  0 ;
  }
  FILE *fp = fopen("repcrec.log", "w") ;
  if(fp == NULL) {
    printf("main: failed to open log file in write mode. Error: %s\n", (char *)strerror(errno)) ;
  }
  else {
    fclose(fp) ;
  }
  initializeTransactionManager() ;
  initializeSiteData() ;
  ret = parseInput(inputSequenceFile) ;
  if(ret == -1) {
   printf("main: parseInput could not parse file %s. Exiting\n", inputSequenceFile) ;
   return  0 ;
  }
  startTransactionManager() ;
  sprintf(log_desc, "main: Transaction Manager exiting\n") ;
  logString(log_desc) ;
  return  0 ;
}
开发者ID:Amortized,项目名称:A-Replicated-Concurrency-and-Recovery-Control-Protocol,代码行数:33,代码来源:main.c


示例17: assert

XDebugCommand* XDebugServer::parseCommand() {
  assert(m_bufferAvail > 0);

  // Log the passed in command
  log("<- %s\n", m_bufferCur);
  logFlush();

  // Attempt to parse the input.  parseInput will initialize cmd_str and args.
  String cmd_str;
  Array args;

  folly::StringPiece input(m_bufferCur);

  // Bump the current buffer pointer forward *before* calling parseInput, so we
  // don't get stuck in an infinite loop if parseInput throws.
  auto consumed = strlen(m_bufferCur) + 1;
  assert(consumed <= m_bufferAvail);
  m_bufferCur += consumed;
  m_bufferAvail -= consumed;

  parseInput(input, cmd_str, args);

  // Create the command from the command string & args
  return XDebugCommand::fromString(*this, cmd_str, args);
}
开发者ID:hechunwen,项目名称:hhvm,代码行数:25,代码来源:xdebug_server.cpp


示例18: toByteCode

  PtrWalker<uchar>* toByteCode(const char* text, size_t length) {
    init(text, length);
  
    parseInput();

    return output;
  }
开发者ID:Quasilyte,项目名称:Interpreter-CPP,代码行数:7,代码来源:compilation.cpp


示例19: main

int main(void)
{
	char string[64];
	unsigned char count = 0;
	
	// run the initialization routines
	initializer();

   	 //Begin forever chatting with the PC
	 for(;;) 
	 {	
		// Check to see if a character is waiting
		if( isCharAvailable() == 1 )
		{
			// If a new character is received, get it
			string[count++] = receiveChar();
			
			// receive a packet up to 64 bytes long
			if(string[count-1] == '\n')// Hyperterminal string ends with \r\n
			{	
				string[count-2] = '\0'; //convert to a string
				parseInput(string);
				string[0] = '\0';
				count = 0;
			}
			else if(count > 64)
			{
				count = 0;
				string[0] = '\0';
				sendString("Error - received > 64 characters");			
			}		
		}
    }
	return 0;
}
开发者ID:bnnttlee,项目名称:CIS541_Pacemaker,代码行数:35,代码来源:PC_Comm.c


示例20: TEST_F

TEST_F(VolatilizeTests, KeepAlreadyVolatileLoadsAndStoresVolatile)
{
	std::string orig = R"(
			@r = global i32 0
			define void @func() {
				%a = load i32, i32* @r
				store i32 %a, i32* @r
				%b = load volatile i32, i32* @r
				store volatile i32 %b, i32* @r
				ret void
			})";
	parseInput(orig);

	// Volatilize.
	//
	pass.runOnModule(*module);

	std::string exp = R"(
			@r = global i32 0
			define void @func() {
				%a = load volatile i32, i32* @r
				store volatile i32 %a, i32* @r
				%b = load volatile i32, i32* @r
				store volatile i32 %b, i32* @r
				ret void
			})";
	checkModuleAgainstExpectedIr(exp);

	// Unvolatilize.
	//
	pass.runOnModule(*module);
	checkModuleAgainstExpectedIr(orig);
}
开发者ID:SchuckBeta,项目名称:retdec,代码行数:33,代码来源:volatilize_tests.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ parseMessage函数代码示例发布时间:2022-05-30
下一篇:
C++ parseIdentifier函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap