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

C++ ParseLine函数代码示例

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

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



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

示例1: ParseLine

bool OpTransform::Initialize()
{
  _dataLoaded=true;
  _transforms.clear();
  ifstream ifs;
  if(ifs.is_open())
    ifs.close();
  char charBuffer[BUFF_SIZE];

  // Set the locale for number parsing to avoid locale issues: PR#1785463
  obLocale.SetLocale();

  if(strcmp(_filename,"*"))
  {
    if(!strncmp(_filename,"TRANSFORM",9))//A single transform can replace the filename
    {
      ParseLine(_filename);
      return true;
    }
    OpenDatafile(ifs, _filename);
    if(!ifs)
    {
      obErrorLog.ThrowError(__FUNCTION__," Could not open " + string(_filename), obError);
      return false;
    }
    while(ifs.getline(charBuffer,BUFF_SIZE))
      ParseLine(charBuffer);
  }
  else //When filename is * use data in lines following
    for(int i=4;i<_textlines.size();++i)
      ParseLine(_textlines[i].c_str());
      
          
  // return the locale to the original one
  obLocale.RestoreLocale();
  
  return true;
}
开发者ID:baoilleach,项目名称:obstereo-2-2-x,代码行数:38,代码来源:optransform.cpp


示例2: WebRunBinCmd

static void 
WebRunBinCmd(FILE *f, const char *query, int priv)
{
    Console		c = &gConsole;
    struct console_session css;
    ConsoleSession	cs = &css;
    char		*buf;
    char		*tmp;
    int			argc, k;
    char		*argv[MAX_CONSOLE_ARGS];
  
    memset(cs, 0, sizeof(*cs));

    cs->cookie = f;
    cs->console = c;
    cs->close = NULL;
    cs->write = WebConsoleSessionWrite;
    cs->writev = WebConsoleSessionWriteV;
    cs->prompt = WebConsoleSessionShowPrompt;
    cs->context.cs = cs;
    cs->context.priv = priv;

    tmp = buf = Mstrdup(MB_WEB, query);
    for (argc = 0; (argv[argc] = strsep(&tmp, "&")) != NULL;)
	if (argv[argc][0] != '\0')
    	    if (++argc >= MAX_CONSOLE_ARGS)
        	break;

    for (k = 0; k < argc; k++) {
	int	ac, rtn;
	char	*av[MAX_CONSOLE_ARGS];
	char	*buf1;

	buf1 = Malloc(MB_WEB, strlen(argv[k]) + 1);
	http_request_url_decode(argv[k], buf1);
        Log2(LG_CONSOLE, ("[%s] WEB: %s", 
	    cs->context.lnk ? cs->context.lnk->name :
		(cs->context.bund? cs->context.bund->name : ""), 
	    buf1));
	ac = ParseLine(buf1, av, sizeof(av) / sizeof(*av), 0);
	cs->context.errmsg[0] = 0;
	rtn = DoCommandTab(&cs->context, gCommands, ac, av);
	Freee(buf1);
	fprintf(f, "RESULT: %d %s\n", rtn, cs->context.errmsg);
    }
    Freee(buf);
    RESETREF(cs->context.lnk, NULL);
    RESETREF(cs->context.bund, NULL);
    RESETREF(cs->context.rep, NULL);
}
开发者ID:ZRouter,项目名称:ZRouter,代码行数:50,代码来源:web.c


示例3: Read

// reads data from socket
void Read(int conn)
{
 char buffer[1024+1];
 
 // read request
 const int total = read(conn, buffer, 1024);
 
 // handle error
 if (total < 0) {
  printf("Error: read failed (%i)\n", errno);
  SendError(conn, 500, NULL);
  //AddToWatchList( conn );
  return;
 }
 
 // nothing read
 if (total == 0) return;

 // check if we got everything
 if (total == 1024) {
  char dummy;
  if (read(conn, &dummy, 1) > 0) {
   SendError(conn, 431, NULL);
   //AddToWatchList( conn );
   return;
  }
 }
 
 // terminate buffer
 buffer[total] = '\0';
 
 // reject if bad characters in request string
 for (int i=0; i<total; i++)
 {
  if (!IsValidChar( buffer[i] )) {
   //AddToWatchList( conn );
   return;
  }
 }
 
 //printf(">>> buffer:[%s]\n", buffer);
 
 // tokenize first line
 char *tok = strtok(buffer, "\r\n");
 
 // process
 if (tok) {
  ParseLine(conn, tok);
 }
}
开发者ID:ByteHazard,项目名称:WeeWeeWeb,代码行数:51,代码来源:main.cpp


示例4: in

bool ObjectImporter::Import(std::wstring file, ImportedObjectData* rawData)
{
	size_t first = file.find_last_of('\\') + 1;
	size_t last = file.find_last_of('.');
	rawData->name = file.substr(first, last-first);
	

	std::wifstream in (file);
	if(!in.is_open())
	{
		std::wstring msg = L"Failed to open file: \n";
		msg.append(file);
		MessageBox(0, msg.c_str(), L"Import error", 0);
		return false;
	}
	else
	{
		std::wstring buff;

		while (!in.eof())
		{
			in >> buff;

			if(buff.size())
			{
				if(buff == ObjImpFormat::animationCount) 
				{ 
					int count = 0;
					if(!ParseInteger(in, count))
						return false;

					if(count)
					{
						rawData->animations.resize(count);
						if(!ParseAnimationFile(in, rawData))
							return false;
					}
					else		
						if(!ParseStandardFile(in, rawData))
							return false;
				}
				else { ParseLine(in, true); }
			}
		}

		in.close();
	}

	return true;
}
开发者ID:Engman,项目名称:fly,代码行数:50,代码来源:ObjectImporter.cpp


示例5: GetSection

// Return a list of all keys in a section
bool IniFile::GetKeys(const char* sectionName, std::vector<std::string>& keys) const
{
	const Section* section = GetSection(sectionName);
	if (!section)
		return false;
	keys.clear();
	for (std::vector<std::string>::const_iterator liter = section->lines.begin(); liter != section->lines.end(); ++liter)
	{
		std::string key;
		ParseLine(*liter, &key, 0, 0);
		keys.push_back(key);
	}
	return true;
}
开发者ID:Everscent,项目名称:dolphin-emu,代码行数:15,代码来源:IniFile.cpp


示例6: fs

void ConfigInfo::Parse(string fileName) {
	string line;
	ifstream fs(fileName.c_str());
	if (fs.is_open()) {
		param_set.clear();
		while (fs.good()) {
			getline(fs, line);
			ParseLine(line, '=');
		}
		fs.close();
	} else {
		cout << "Cannot open config file to read." << endl;
	}
}
开发者ID:UVA-High-Speed-Networks,项目名称:FMTP-LDM7,代码行数:14,代码来源:ConfigInfo.cpp


示例7: ParseScene

   void ParseScene(SceneObjectList& objList, const char *ScenePath) {
      objList.clear();

      std::string line;
      RTextFile scenefile(ScenePath);

      K_LOG("ESceneParser -- Start parsing: %s",ScenePath);
      SceneObjectMap obj;
      while (scenefile.GetLine(line)) {
         ParseLine(obj,line);
         if (obj.size() > 0)
            objList.push_back(obj);
      }
      K_LOG("ESceneParser -- End parsing: %s",ScenePath); 
   }
开发者ID:CortlandNation9,项目名称:Gamecodeur,代码行数:15,代码来源:ESceneParser.cpp


示例8: while

bool
NmeaReplay::ReadUntilRMC(NMEAInfo &data)
{
  char *buffer;

  while ((buffer = reader->ReadLine()) != NULL) {
    ParseLine(buffer, data);

    if (StringStartsWith(buffer, "$GPRMC") ||
        StringStartsWith(buffer, "$FLYSEN"))
      return true;
  }

  return false;
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:15,代码来源:NmeaReplay.cpp


示例9: ParseFile

void ParseFile(std::string Path)
{
	FILE *localFP;
	if ((localFP = fopen(Path.c_str(), READ)) == NULL)
	{
		error  = "File does not exist: ";
		
	}
	char line[MAX_RECORD_SIZE];
	//get each line
	while(fgets(line, sizeof(line), localFP) != NULL)
	{
		ParseLine(std::string(line));	
	}
}
开发者ID:GuitarNoob,项目名称:cs530a3,代码行数:15,代码来源:Parser.cpp


示例10:

void
DeviceDescriptor::LineReceived(const char *line)
{
  NMEALogger::Log(line);

  if (pipe_to_device && pipe_to_device->port) {
    // stream pipe, pass nmea to other device (NmeaOut)
    // TODO code: check TX buffer usage and skip it if buffer is full (outbaudrate < inbaudrate)
    pipe_to_device->port->Write(line);
    pipe_to_device->port->Write("\r\n");
  }

  if (ParseLine(line))
    device_blackboard->ScheduleMerge();
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:15,代码来源:Descriptor.cpp


示例11: locations

bool MemoryWatcher::LoadAddresses(const std::string& path)
{
	std::ifstream locations(path);
	if (!locations)
	{
	  std::cout << "No MemoryWatcher Locations." << std::endl;
		return false;
	}

	std::string line;
	while (std::getline(locations, line))
		ParseLine(line);

	return m_values.size() > 0;
}
开发者ID:adit-chandra,项目名称:dolphin,代码行数:15,代码来源:MemoryWatcher.cpp


示例12: Clear

bool BezierParser::ParseFile(const std::string& filename)
{
	Clear();

	std::ifstream fs(filename.c_str());
	if(!fs) 
	{
		m_valid = false;
		return false;
	}

	std::string fileLine;
	char file_line[1000];
	while(!fs.eof()) 
	{
		fs.getline(file_line, 1000, '\n');
		fileLine = std::string(file_line);
		
		if(!ParseLine(fileLine))
		{ 
			fs.close();
			m_valid = false;
			return false; 
		}

		if(ParseStateDone == m_state)
		{ break; }
	}

	// eof
	if(SplineTypeBspline == m_curves[m_crvIdx].m_type)
	{
		if(ParseStatePoints == m_state)
		{
			m_state = ParseStateDone;
		}
	}
	else if(SplineTypeBezier == m_curves[m_crvIdx].m_type)
	{
		if(ParseStateNone == m_state)
		{
			m_state = ParseStateDone;
		}
	}

	fs.close();
	return (ParseStateDone == m_state);
}
开发者ID:ogurdima,项目名称:technion-236716-cagd-2012,代码行数:48,代码来源:BezierParser.cpp


示例13: while

	void SourceTASReader::ParseVariables()
	{
		while (ParseLine())
		{
			if (IsFramesLine())
			{
				break;
			}

			if (!freezeVariables)
				ParseVariable();
		}

		variables.Iteration(searchType);
		variables.PrintState();
	}
开发者ID:YaLTeR,项目名称:SourcePauseTool,代码行数:16,代码来源:srctas_reader.cpp


示例14: while

void DOS_Shell::RunInternal(void)
{
	char input_line[CMD_MAXLINE] = {0};
	while(bf && bf->ReadLine(input_line)) 
	{
		if (echo) {
				if (input_line[0] != '@') {
					ShowPrompt();
					WriteOut_NoParsing(input_line);
					WriteOut_NoParsing("\n");
				};
			};
		ParseLine(input_line);
	}
	return;
}
开发者ID:KitoHo,项目名称:iDOS,代码行数:16,代码来源:shell.cpp


示例15: playerSize

GameplaySettings::GameplaySettings( const std::string& levelpath )
: playerSize( 10, 32 )
, playerOffset( 0, 0 )
{
	std::ifstream file( levelpath + "/gameplay.txt" );
	if( !file )
	{
		Debug::Error( "Could not open ", levelpath, "/gameplay.txt!" );
	}
	std::string curLine;
	while( std::getline( file, curLine ) )
	{
		std::transform( curLine.begin(), curLine.end(), curLine.begin(), std::tolower );
		ParseLine( curLine );
	}
}
开发者ID:mrwonko,项目名称:IGJam6Platformer,代码行数:16,代码来源:gameplaySettings.cpp


示例16: FILE_ParseFile

int FILE_ParseFile( const char *fileName, FILE_ParserCallback_t *callback )
{
    FILE       *fs = NULL;
    Parser_t    parser;
    char        line[ 100 ];
    int         rc = FALSE;

    memset( &parser, 0, sizeof( parser ));

    parser.lineNum = 0;
    parser.callback = callback;

    if (( fs = fopen( fileName, "rt" )) == NULL )
    {
        Error( &parser, "Unable to open file '%s' for reading", fileName );
        goto cleanup;
    }

    while ( fgets( line, sizeof( line ), fs ) != NULL )
    {
        parser.lineNum++;

        if ( !ParseLine( &parser, line ))
        {
            goto cleanup;
        }
    }
    if ( !Flush( &parser ))
    {
        goto cleanup;
    }

    // Everything went successfully

    rc = TRUE;

cleanup:

    if ( fs != NULL )
    {
        fclose( fs );
    }

    return rc;

} // FILE_ParseFile
开发者ID:Linux-enCaja,项目名称:ecbot,代码行数:46,代码来源:FILE_Parser.c


示例17: ParseLine

void
WaypointReaderBase::Parse(Waypoints &way_points, TLineReader &reader,
                          OperationEnvironment &operation)
{
  const long filesize = std::max(reader.GetSize(), 1l);
  operation.SetProgressRange(100);

  // Read through the lines of the file
  TCHAR *line;
  for (unsigned i = 0; (line = reader.ReadLine()) != nullptr; i++) {
    // and parse them
    ParseLine(line, i, way_points);

    if ((i & 0x3f) == 0)
      operation.SetProgressPosition(reader.Tell() * 100 / filesize);
  }
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:17,代码来源:WaypointReaderBase.cpp


示例18: fin

bool KNN::LoadCenteroidVec(string & fileName)
{
	 map<int,vector<float> > cache;

	 
	 ifstream fin(fileName.c_str());                                              
	 string line;                                                                 
     float featureDotProduct = 0.0;
	                                                                                                   
	 while(getline(fin,line))   
	 {

		vector<float> oneCentor;
		int catIndex;
		if(ParseLine(line,oneCentor,catIndex,m_FeatureSize,featureDotProduct)==false)
		{
			cout<<"Wrong:parsing knn model file("<<fileName<< ") wrong"<<endl;
			return false;
		}
		else
		{
			pair<int,vector<float> > value=make_pair(catIndex,oneCentor);
			cache.insert(value);
		}
        m_centoroidFeatureDotProduct.push_back(sqrt(featureDotProduct));
	 }

	 m_CatNum=cache.size();

	 /*transfer to memory data structure,note:according to the cat index number*/
	 map<int,vector<float> >::iterator it;
	 for(it=cache.begin();it!=cache.end();it++)
	 {
		m_centoroid.push_back((*it).second);

	 }


	 if(cache.size()!=m_CatNum)
	 {
		cout<<"Wrong:the category number is wrong!"<<endl;
		return false;
	 }

	 return true;
}
开发者ID:reedboat,项目名称:applib,代码行数:46,代码来源:KNN.cpp


示例19: IsTimeFile

bool IsTimeFile(vector<string> &linesInFile)
{
	bool bIsValid = true;
	string currentLine;
	long line = 0;

	DateTimeRec time;
	VelocityRec velocity;

	currentLine = linesInFile[line++];

	std::replace(currentLine.begin(), currentLine.end(), ',', ' ');
	if (!ParseLine(currentLine, time, velocity))
		bIsValid = false;

	return bIsValid;
}
开发者ID:JamesMakela-NOAA,项目名称:PyGnome,代码行数:17,代码来源:TimeValuesIO.cpp


示例20: ParsePage

/** Parse a teletext page
 * \param filename - Name of the teletext file
 * \return true if there is an error
 */
uint8_t ParsePage(PAGE *page, char *filename)
{
	FILE *file;
	char *str;
	const unsigned char MAXLINE=80;
	char line[MAXLINE];
	// printf("[Parse page]Started looking at %s\n",filename);
	// open the page
	file=fopen(filename,"r");
	if (!file)
	{
		printf("[Parse page]Failed to open tti page\n");			
		//put_rc(res);
		return 1;
	}
	// Shouldn't we clear the page at this point?
	ClearPage(page);
	// page->filesize=(unsigned int)file.fsize; // Not sure that Pi needs this
	// Read a line
	// printf("[ParsePage]Ready to parse\n");
	while (!feof(file))
	{
		str=fgets(line,MAXLINE,file);
		if (!str) break;	// Ooops, no more data
		/* debug
		for (i=0;i<16;i++)
			printf("%02x ",str[i]);
		printf("[ParsePage]Parsing a line %s\n",str);
		printf("\n");
		*/
		if (ParseLine(page,str))
		{
			fclose(file);
			return 1;
		}
		// printf("[ParsePage] chewing next line\n");
	}
	// printf("[ParsePage] mag=%d page=%X, subpage=%X\n",page->mag,page->page,page->subpage);
	// delay(1000);

	fclose(file);
	// printf("[Parse page]Ended\n");	
	
	return 0;
}
开发者ID:gregmedd,项目名称:vbit-pi,代码行数:49,代码来源:page.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ParseName函数代码示例发布时间:2022-05-30
下一篇:
C++ ParseInt函数代码示例发布时间: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