本文整理汇总了C++中parseFile函数的典型用法代码示例。如果您正苦于以下问题:C++ parseFile函数的具体用法?C++ parseFile怎么用?C++ parseFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testParseFile
void testParseFile()
{
packets results;
//parseFile("c:\\Users\\David\\Documents\\packets.txt", -1, -1, results);
//parseFile("c:\\Users\\David\\Documents\\packets.txt", -1, 30, results);
parseFile("c:\\Users\\David\\Documents\\packets.txt", 2, 4, results);
}
示例2: lock
void KernelSourceParser::WorkerThread::run()
{
QString currentFile;
QMutexLocker lock(&_parser->_filesMutex);
_stopExecution = false;
while (!_stopExecution && !Console::interrupted() &&
_parser->_filesIndex < _parser->_fileNames.size())
{
currentFile = _parser->_fileNames[_parser->_filesIndex++];
_parser->_currentFile = currentFile;
if (_parser->_filesIndex <= 1)
_parser->operationProgress();
else
_parser->checkOperationProgress();
lock.unlock();
parseFile(currentFile);
lock.relock();
_parser->_bytesRead += QFileInfo(_parser->_srcDir, currentFile).size();
_parser->_durationLastFileFinished = _parser->_duration;
}
}
示例3: main
int main(int argc, char *argv[])
{
char * fileName;
fileName = NULL;
if(argc < 2)
{
printf("Error: Please enter a file name.\n");
return 1;
}
if(argv[1] == NULL)
{
printf("Error: No file name given.\n");
return 1;
}
fileName = argv[1];
printf("File = %s\n", fileName);
parseFile(fileName);
return 0;
}
示例4: parseFile
void QoreProgram::parseFileAndRun(const char* filename) {
ExceptionSink xsink;
parseFile(filename, &xsink);
if (!xsink.isEvent()) {
// get class name
if (priv->exec_class) {
if (!priv->exec_class_name.empty())
runClass(priv->exec_class_name.c_str(), &xsink);
else {
char* c, *bn = q_basenameptr(filename);
if (!(c = strrchr(bn, '.')))
runClass(filename, &xsink);
else {
QoreString qcn; // for possible class name
qcn.concat(bn, c - bn);
runClass(qcn.getBuffer(), &xsink);
}
}
}
else
run(&xsink);
}
}
示例5: parseFile
void UserController::onInit(InitEvent &evt)
{
robotName = "robot_000";
//m_kinect = connectToService("SIGKINECT");
//m_hmd = connectToService("SIGHMD");
parseFile("command.txt");
Mission_complete = false;
//printf("Reslutat %s", rooms[2]);
rooms.clear();
objects.clear();
m_message = 10 ;
cycle = 0;
m_state =20;
srand(time(NULL));
//初期位置の設定
SimObj *my = this->getObj(this->myname());
m_posx = my->x();
m_posy = my->y();
m_posz = my->z();
m_range = 0.1;
m_maxsize = 15;
}
示例6: initDefaults
ntlWorld::ntlWorld(string filename, bool commandlineMode)
{
#ifndef ELBEEM_PLUGIN
initDefaults();
# ifdef NOGUI
commandlineMode = true; // remove warning...
# endif // NOGUI
// load config
setPointers( getRenderGlobals() );
parseFile( filename.c_str() );
# ifndef NOGUI
// setup opengl display, save first animation step for start time
// init after parsing file...
if(!commandlineMode) {
mpOpenGLRenderer = new ntlOpenGLRenderer( mpGlob );
}
# endif // NOGUI
finishWorldInit();
#else // ELBEEM_PLUGIN
errFatal("ntlWorld::init","Cfg file parsing not supported for API version! "<<filename<<" "<<commandlineMode, SIMWORLD_INITERROR);
#endif // ELBEEM_PLUGIN
}
示例7: _tmain
int _tmain(int argc, char* argv[])
{
char *inFile = NULL;
outFormat format = NOTSET;
int rowStart = -1;
int rowEnd = -1;
packets parsedList;
#ifdef _DEBUG
testparseQueryString();
testParseFile();
#endif
printf("Content-Type: text/xml\n\n");
if (!checkArgs(argc, argv, &inFile, format, rowStart, rowEnd))
{
printUsage();
return -1;
}
parseFile(inFile, rowStart, rowEnd, parsedList);
outputInfo(parsedList, format);
return 0;
}
示例8: Vec3f
SceneParser::SceneParser(const char* filename) {
// initialize some reasonable default values
group = NULL;
camera = NULL;
background_color = Vec3f(0.5,0.5,0.5);
ambient_light = Vec3f(0,0,0);
num_lights = 0;
lights = NULL;
num_materials = 0;
materials = NULL;
current_material = NULL;
// parse the file
assert(filename != NULL);
const char *ext = &filename[strlen(filename)-4];
assert(!strcmp(ext,".txt"));
file = fopen(filename,"r");
assert (file != NULL);
parseFile();
fclose(file);
file = NULL;
// if no lights are specified, set ambient light to white
// (do solid color ray casting)
if (num_lights == 0) {
printf ("WARNING: No lights specified\n");
ambient_light = Vec3f(1,1,1);
}
}
示例9: main
int main(int argc,char* argv[])
{
// Use a try/catch block for parser exceptions
try
{
// if we have at least one command-line argument
if (argc > 1 )
{
cerr << "Parsing..." << endl;
// for each file specified on the command line
for(int i=1; i< argc;i++)
{
cerr << " " << argv[i] << endl;
parseFile(argv[i]);
}
}
else
cerr << "Usage: " << argv[0]
<< " <file name(s)>" << endl;
}
catch(exception& e) {
cerr << "exception: " << e.what() << endl;
}
}
示例10:
MeshModel *Loader_3DS::load( const string &filename,const Transform &t,int hint ){
conv_tform=t;
conv=flip_tris=false;
if( conv_tform!=Transform() ){
conv=true;
if( conv_tform.m.i.cross(conv_tform.m.j).dot(conv_tform.m.k)<0 ) flip_tris=true;
}
collapse=!!(hint&MeshLoader::HINT_COLLAPSE);
animonly=!!(hint&MeshLoader::HINT_ANIMONLY);
if( !in.open( filename.c_str(),ios_base::in|ios_base::binary ) ){
return 0;
}
MeshModel *root=parseFile();
in.close();
materials_map.clear();
name_map.clear();
id_map.clear();
return root;
}
示例11: main
int main(){
exception e;
VTDGen *vg = NULL;
VTDNav *vn = NULL;
AutoPilot *ap = NULL;
UCSChar *string = NULL;
int i;
Try{
ap = createAutoPilot2();
selectXPath(ap,L"/a/b/text()");
vg = createVTDGen();
if (parseFile(vg,FALSE,"d:/ximpleware_2.2_c/vtd-xml/codeGuru/2/input.xml")){
vn = getNav(vg);
bind(ap,vn);
while((i=evalXPath(ap))!=-1){
string = toString(vn,i);
wprintf(L"the text node value is %d ==> %s \n",i,string);
free(string);
}
free(vn->XMLDoc);
} else {
free(vg->XMLDoc);
}
}Catch(e){// handle various types of exceptions here
}
freeAutoPilot(ap);
freeVTDGen(vg);
freeVTDNav(vn);
return 0;
}
示例12: ossimRpcModel
//*****************************************************************************
// CONSTRUCTOR: ossimNitfRpcModel
//
// Constructs given filename for NITF file
//
//*****************************************************************************
ossimNitfRpcModel::ossimNitfRpcModel(const ossimFilename& nitfFile)
:
ossimRpcModel(),
theDecimation(1.0)
{
if (traceExec())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "DEBUG ossimNitfRpcModel::ossimNitfRpcModel(nitfFile): entering..."
<< std::endl;
}
if(!parseFile(nitfFile))
{
if (traceExec())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "DEBUG ossimNitfRpcModel::ossimNitfRpcModel(nitfFile): Unable to parse file " << nitfFile
<< std::endl;
}
++theErrorStatus;
}
if (traceExec())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "DEBUG ossimNitfRpcModel::ossimNitfRpcModel(nitfFile): returning..."
<< std::endl;
}
}
示例13: parseFile
bool parseFile(Game& game, const char* filename)
{
//bool value;
FILE* in = fopen(filename, "r");
//int size;
if(!in)
return false;
parseFile(in);
sexp_t* st = NULL;
while((st = parse()))
{
if( !parseSexp(game, st) )
{
while(parse()); //empty the file, keep Lex happy.
fclose(in);
return false;
}
destroy_sexp(st);
}
fclose(in);
return true;
}
示例14: parseFile
void HippoGridManager::loadFromFile()
{
mDefaultGridsVersion = 0;
// load user grid info
parseFile(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grid_info.xml"), false);
// merge default grid info, if newer. Force load, if list of grids is empty.
parseFile(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "default_grids.xml"), !mGridInfo.empty());
// merge grid info from web site, if newer. Force load, if list of grids is empty.
if (gSavedSettings.getBOOL("CheckForGridUpdates"))
parseUrl("http://imprudenceviewer.org/app/grids/", !mGridInfo.empty());
std::string last_grid = gSavedSettings.getString("LastSelectedGrid");
if (last_grid.empty()) last_grid = gSavedSettings.getString("DefaultGrid");
setDefaultGrid(last_grid);
setCurrentGrid(last_grid);
}
示例15: parseFile
ProjectSPtr ProjectParserMixin::parseProject(const ProjectParseContextSPtr& context)
{
TokenizerPtr& tokenizer = context->tokenizer;
context->mProject = boost::make_shared<Project>();
FileSPtr file = parseFile(context);
if (!file)
return ProjectSPtr();
if (!context->mProject->mainFile())
context->mProject << file;
CommentSPtr pStatementComment = lastComment(context);
while (tokenizer->current())
{
if (tokenizer->check(Token::TYPE_IDENTIFIER))
{
parseProjectStatement(context, pStatementComment);
}
else
{
tokenizer->shift();
}
pStatementComment = lastComment(context);
}
if (context->mMessageCollector->severity() > Message::SEVERITY_WARNING)
return ProjectSPtr();
return context->mProject;
}