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


C++ ParseLine函数代码示例

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


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


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