本文整理汇总了C++中ParseFile函数的典型用法代码示例。如果您正苦于以下问题:C++ ParseFile函数的具体用法?C++ ParseFile怎么用?C++ ParseFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddLog
/**
* \brief Start parsing.
* \param LogProc A Pointer to the logging procedure.
*/
void CAuxParser::Parse(PFNLOGPROC LogProc)
{
m_LogProc = LogProc;
m_Errors = 0;
m_BibData.Empty();
m_BibStyle.Empty();
CString str;
if (!m_AuxFile.IsEmpty()) {
CFile f;
CFileException ex;
if (f.Open(m_AuxFile, CFile::modeRead | CFile::shareDenyWrite, &ex)) {
str.Format(AfxLoadString(IDS_STRING_PARSING), m_AuxFile);
AddLog(str);
CBibReader reader(&f);
ParseFile(&reader);
f.Close();
} else {
m_Errors++;
TCHAR msg[MAX_PATH];
ex.GetErrorMessage(msg, MAX_PATH);
str.Format(AfxLoadString(IDS_STRING_ERROR), msg);
AddLog(str);
}
}
}
示例2: CoreException
void ParseStack::DoInclude(ConfigTag* tag, int flags)
{
if (flags & FLAG_NO_INC)
throw CoreException("Invalid <include> tag in file included with noinclude=\"yes\"");
std::string mandatorytag;
tag->readString("mandatorytag", mandatorytag);
std::string name;
if (tag->readString("file", name))
{
if (tag->getBool("noinclude", false))
flags |= FLAG_NO_INC;
if (tag->getBool("noexec", false))
flags |= FLAG_NO_EXEC;
if (!ParseFile(ServerInstance->Config->Paths.PrependConfig(name), flags, mandatorytag))
throw CoreException("Included");
}
else if (tag->readString("executable", name))
{
if (flags & FLAG_NO_EXEC)
throw CoreException("Invalid <include:executable> tag in file included with noexec=\"yes\"");
if (tag->getBool("noinclude", false))
flags |= FLAG_NO_INC;
if (tag->getBool("noexec", true))
flags |= FLAG_NO_EXEC;
if (!ParseFile(name, flags, mandatorytag, true))
throw CoreException("Included");
}
}
示例3: main
// main program
int main(int argc, char *argv[]) {
Options options;
vector<string> filenames;
// Process command-line arguments
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "--ncores")) options.nCores = atoi(argv[++i]);
else if (!strcmp(argv[i], "--outfile")) options.imageFile = argv[++i];
else if (!strcmp(argv[i], "--quick")) options.quickRender = true;
else if (!strcmp(argv[i], "--topng")){ options.topng = true;
options.pngFile = argv[++i];
}
else if (!strcmp(argv[i], "--background")){ options.withBackground = true;
options.backgroundImage = argv[++i];
//This is neccesary to prevent exceptions caused by Magick++
//@TODO: Mail the Magick++ list about this.
options.nCores = 1;
}
else if (!strcmp(argv[i], "--quiet")) options.quiet = false;
else if (!strcmp(argv[i], "--verbose")) options.verbose = true;
else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
printf("usage: pbrt [--ncores n] [--outfile filename] [--quick] [--quiet] "
"[--verbose] [--topng png_filename] [--help] <filename.pbrt> ...\n");
return 0;
}
else filenames.push_back(argv[i]);
}
// Print welcome banner
// Disabled, enable later.
if (!options.quiet) {
printf("pbrt version %s of %s at %s [Detected %d core(s)]\n",
PBRT_VERSION, __DATE__, __TIME__, NumSystemCores());
printf("Relativistic Rendering, Alex, Allwin, Sanchit\n");
/*
printf("Copyright (c)1998-2010 Matt Pharr and Greg Humphreys.\n");
printf("The source code to pbrt (but *not* the book contents) is covered by the GNU GPL.\n");
printf("See the file COPYING.txt for the conditions of the license.\n");
*/
fflush(stdout);
}
pbrtInit(options);
//extern Background bground;
// Process scene description
PBRT_STARTED_PARSING();
if (filenames.size() == 0) {
// Parse scene from standard input
ParseFile("-");
} else {
// Parse scene from input files
for (u_int i = 0; i < filenames.size(); i++)
if (!ParseFile(filenames[i]))
Error("Couldn't open scene file \"%s\"", filenames[i].c_str());
}
pbrtCleanup();
return 0;
}
示例4: ParseConfig
/** Parse the JWM configuration. */
void ParseConfig(const char *fileName)
{
if(!ParseFile(fileName, 0)) {
if(JUNLIKELY(!ParseFile(SYSTEM_CONFIG, 0))) {
ParseError(NULL, "could not open %s or %s", fileName, SYSTEM_CONFIG);
}
}
ValidateTrayButtons();
ValidateKeys();
}
示例5: ParseFile
bool pawsNpcDialogWindow::LoadSetting()
{
csRef<iDocument> doc;
csRef<iDocumentNode> root,npcDialogNode, npcDialogOptionsNode;
csString option;
doc = ParseFile(psengine->GetObjectRegistry(), CONFIG_NPCDIALOG_FILE_NAME);
if(doc == NULL)
{
//load the default configuration file in case the user one fails (missing or damaged)
doc = ParseFile(psengine->GetObjectRegistry(), CONFIG_NPCDIALOG_FILE_NAME_DEF);
if(doc == NULL)
{
Error2("Failed to parse file %s", CONFIG_NPCDIALOG_FILE_NAME_DEF);
return false;
}
}
root = doc->GetRoot();
if(root == NULL)
{
Error1("npcdialog_def.xml or npcdialog.xml has no XML root");
return false;
}
npcDialogNode = root->GetNode("npcdialog");
if(npcDialogNode == NULL)
{
Error1("npcdialog_def.xml or npcdialog.xml has no <npcdialog> tag");
return false;
}
// Load options for the npc dialog
npcDialogOptionsNode = npcDialogNode->GetNode("npcdialogoptions");
if(npcDialogOptionsNode != NULL)
{
csRef<iDocumentNodeIterator> oNodes = npcDialogOptionsNode->GetNodes();
while(oNodes->HasNext())
{
csRef<iDocumentNode> option = oNodes->Next();
csString nodeName(option->GetValue());
if(nodeName == "usenpcdialog")
{
//showWindow->SetState(!option->GetAttributeValueAsBool("value"));
useBubbles = option->GetAttributeValueAsBool("value");
}
}
}
return true;
}
示例6: main
// main program
int main(int argc, char *argv[]) {
Options options;
std::vector<std::string> filenames;
// Process command-line arguments
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "--ncores") || !strcmp(argv[i], "--nthreads"))
options.nThreads = atoi(argv[++i]);
else if (!strcmp(argv[i], "--outfile"))
options.imageFile = argv[++i];
else if (!strcmp(argv[i], "--quick"))
options.quickRender = true;
else if (!strcmp(argv[i], "--quiet"))
options.quiet = true;
else if (!strcmp(argv[i], "--verbose"))
options.verbose = true;
else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
printf(
"usage: pbrt [--nthreads n] [--outfile filename] [--quick] "
"[--quiet] "
"[--verbose] [--help] <filename.pbrt> ...\n");
return 0;
} else
filenames.push_back(argv[i]);
}
// Print welcome banner
if (!options.quiet) {
printf("pbrt version 3 (built %s at %s) [Detected %d cores]\n",
__DATE__, __TIME__, NumSystemCores());
printf(
"Copyright (c)1998-2015 Matt Pharr, Greg Humphreys, and Wenzel "
"Jakob.\n");
printf(
"The source code to pbrt (but *not* the book contents) is covered "
"by the BSD License.\n");
printf("See the file LICENSE.txt for the conditions of the license.\n");
fflush(stdout);
}
pbrtInit(options);
// Process scene description
if (filenames.size() == 0) {
// Parse scene from standard input
ParseFile("-");
} else {
// Parse scene from input files
for (const std::string &f : filenames)
if (!ParseFile(f))
Error("Couldn't open scene file \"%s\"", f.c_str());
}
pbrtCleanup();
return 0;
}
示例7: ParseFile
int GModel::readGEO(const std::string &name)
{
ParseFile(name, true);
int imported = GModel::current()->importGEOInternals();
return imported;
}
示例8: ParseFile
QHash<QImage, QString> BaseEmoticonsSource::GetReprImages (const QString& pack) const
{
QHash<QImage, QString> result;
const auto& hash = ParseFile (pack);
const auto& uniqueImgs = hash.values ().toSet ();
for (const auto& imgPath : uniqueImgs)
{
const auto& fullPath = EmoLoader_->GetIconPath (pack + "/" + imgPath);
const auto& img = QImage { fullPath };
if (img.isNull ())
{
qWarning () << Q_FUNC_INFO
<< imgPath
<< "in pack"
<< pack
<< "is null, got path:"
<< fullPath;
continue;
}
result [img] = hash.key (imgPath);
}
return result;
}
示例9: ParseInclude
/** Parse an include. */
void ParseInclude(const TokenNode *tp, int depth) {
char *temp;
Assert(tp);
if(JUNLIKELY(!tp->value)) {
ParseError(tp, "no include file specified");
} else {
temp = CopyString(tp->value);
ExpandPath(&temp);
if(JUNLIKELY(!ParseFile(temp, depth))) {
ParseError(tp, "could not open included file %s", temp);
}
Release(temp);
}
}
示例10: ParseFile
SyncLogEntry SyncLogger::ReadFirstEntry(const char* pszHash)
{
ParseFile(pszHash);
// Assures the correct parsing of the file.
assert(m_pCFG != NULL);
// cfg_t* pEntryCFG = cfg_getnsec(m_pCFG, MOD_NUMBER_VARNAME, 0);
return ReadEntry(cfg_getnsec(m_pCFG, MOD_NUMBER_VARNAME, 0));
/*
// Assures that the section has been found, which means there is at least one section.
assert(pEntryCFG != NULL);
// TODO: Copy values
SyncLogEntry sle;
sle.m_strFilePath = cfg_getstr(pEntryCFG, FILE_PATH_VARNAME);
sle.m_strModTime = cfg_getstr(pEntryCFG, MOD_TIME_VARNAME);
string strModType = cfg_getstr(pEntryCFG, MOD_TYPE_VARNAME);
if (strModType.length() != 1)
{
// The log entry does not meet the standard.
return NULL;
}
sle.m_chModType = strModType.c_str()[0];
return sle;
*/
}
示例11: assert
void CFormulaParser::ParseOpenPPLLibraryIfNeeded() {
assert(p_function_collection != NULL);
if (p_function_collection->OpenPPLLibraryCorrectlyParsed()) {
write_log(preferences.debug_parser(),
"[FormulaParser] OpenPPL-library already correctly loaded. Nothing to do.\n");
return;
}
assert(p_filenames != NULL);
CString openPPL_path = p_filenames->OpenPPLLibraryPath();
if (_access(openPPL_path, F_OK) != 0) {
// Using a message-box instead of silent logging, as OpenPPL is mandatory
// and we expect the user to supervise at least the first test.
CString message;
message.Format("Can not load \"%s\".\nFile not found.\n", openPPL_path);
OH_MessageBox_Error_Warning(message);
p_function_collection->SetOpenPPLLibraryLoadingState(false);
return;
}
CFile openPPL_file(openPPL_path,
CFile::modeRead | CFile::shareDenyWrite);
write_log(preferences.debug_parser(),
"[FormulaParser] Going to load and parse OpenPPL-library\n");
CArchive openPPL_archive(&openPPL_file, CArchive::load);
ParseFile(openPPL_archive);
p_function_collection->SetOpenPPLLibraryLoadingState(CParseErrors::AnyError() == false);
}
示例12: runScriptFile
boolean
runScriptFile(char* pszScript, int fdCmdPipe, char* pszLogFile)
{
int fd;
boolean bReturn = bReturn = (fd = FileOpen(pszScript, OF_READ)) >= 0;
if (bReturn)
{
/* setup file to send commands back to the parent process. */
FILE* fpPipe = fdopen(fdCmdPipe, "wb");
setlinebuf(fpPipe);
/* setup file for logging. */
FILE* fpLog = fopen(pszLogFile, "a");
// Run the script
UpdaterInfo ui;
initUpdaterInfo(&ui, fpPipe, fpLog);
bReturn = ParseFile(fd, NULL, TokenTable, FormatTable,
parseCallback, FALSE, TRUE, TRUE, (void*) &ui);
}
return bReturn;
}
示例13: ParseFile
//-------------------------------------------------------------------------
bool CVCRControl::CVCRDevice::Stop()
{
deviceState = CMD_VCR_STOP;
// leave scart mode
g_RCInput->postMsg( NeutrinoMessages::VCR_OFF, 0 );
return ParseFile(LIRCDIR "stop.lirc");
}
示例14: MoveToAndReadSome
BOOL CIVPlaybackDataBuf::ChannelTarget::Open(
const char* pPath,
const FILETIME& time)
{
if ( !isValidString(pPath) )
{
return FALSE;
}
if ( m_Reader.is_open() )
{
m_Reader.close();
}
m_Reader.clear();
string strPath = pPath;
strPath += c_szIVFileExt;
m_Reader.open(
strPath.c_str(),
ios::binary |ios::in | ios::_Nocreate );
if ( !m_Reader.is_open() )
{
return FALSE;
}
if ( !ParseFile() )
{
m_Reader.close();
return FALSE;
}
return MoveToAndReadSome(time);
}
示例15: _
EffectNyquist::EffectNyquist(wxString fName)
{
mAction = _("Applying Nyquist Effect...");
mInputCmd = wxEmptyString;
mCmd = wxEmptyString;
SetEffectFlags(HIDDEN_EFFECT);
mInteractive = false;
mExternal = false;
mCompiler = false;
mDebug = false;
mIsSal = false;
mOK = false;
mStop = false;
mBreak = false;
mCont = false;
if (fName == wxT("")) {
// Interactive Nyquist
mOK = true;
mInteractive = true;
mName = _("Nyquist Prompt...");
SetEffectFlags(PROCESS_EFFECT | BUILTIN_EFFECT | ADVANCED_EFFECT);
return;
}
// wxLogNull dontLog; // Vaughan, 2010-08-27: Why turn off logging? Logging is good!
mName = wxFileName(fName).GetName();
mFileName = wxFileName(fName);
mFileModified = mFileName.GetModificationTime();
ParseFile();
}