本文整理汇总了C++中ParseFile函数的典型用法代码示例。如果您正苦于以下问题:C++ ParseFile函数的具体用法?C++ ParseFile怎么用?C++ ParseFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
}
开发者ID:stievie,项目名称:bibedt,代码行数:29,代码来源:AuxParser.cpp
示例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");
}
}
开发者ID:KeiroD,项目名称:inspircd,代码行数:30,代码来源:configparser.cpp
示例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;
}
开发者ID:Archeleus,项目名称:relativistic-render,代码行数:59,代码来源:pbrt.cpp
示例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();
}
开发者ID:Nehamkin,项目名称:jwm,代码行数:11,代码来源:parse.c
示例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;
}
开发者ID:Mixone-FinallyHere,项目名称:planeshift,代码行数:52,代码来源:pawsnpcdialog.cpp
示例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;
}
开发者ID:tdapper,项目名称:pbrt-v3,代码行数:53,代码来源:pbrt.cpp
示例7: ParseFile
int GModel::readGEO(const std::string &name)
{
ParseFile(name, true);
int imported = GModel::current()->importGEOInternals();
return imported;
}
开发者ID:cycheung,项目名称:gmsh,代码行数:7,代码来源:GModelIO_GEO.cpp
示例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;
}
开发者ID:MellonQ,项目名称:leechcraft,代码行数:26,代码来源:baseemoticonssource.cpp
示例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);
}
}
开发者ID:Nehamkin,项目名称:jwm,代码行数:26,代码来源:parse.c
示例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;
*/
}
开发者ID:se-bi,项目名称:offlinefs,代码行数:28,代码来源:synclogger.cpp
示例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);
}
开发者ID:sushiomsky,项目名称:openholdembot,代码行数:26,代码来源:CFormulaParser.cpp
示例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;
}
开发者ID:XClouded,项目名称:DnsQache,代码行数:25,代码来源:main.c
示例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");
}
开发者ID:GWARDAR,项目名称:OpenPLi-1,代码行数:8,代码来源:vcrcontrol.cpp
示例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);
}
开发者ID:fatrar,项目名称:yiqiulib,代码行数:33,代码来源:PlaybackChannelTarget.cpp
示例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();
}
开发者ID:Rubelislam9950,项目名称:Audacity,代码行数:33,代码来源:Nyquist.cpp
示例16: OpenWaveFile
WAVERESULT CWaves::OpenWaveFile(const char *szFilename, WAVEID *pWaveID)
{
WAVERESULT wr = WR_OUTOFMEMORY;
LPWAVEFILEINFO pWaveInfo;
pWaveInfo = new WAVEFILEINFO;
if (pWaveInfo)
{
if (SUCCEEDED(wr = ParseFile(szFilename, pWaveInfo)))
{
long lLoop = 0;
for (lLoop = 0; lLoop < MAX_NUM_WAVEID; lLoop++)
{
if (!m_WaveIDs[lLoop])
{
m_WaveIDs[lLoop] = pWaveInfo;
*pWaveID = lLoop;
wr = WR_OK;
break;
}
}
if (lLoop == MAX_NUM_WAVEID)
wr = WR_OUTOFMEMORY;
}
if (wr != WR_OK)
delete pWaveInfo;
}
return wr;
}
开发者ID:christianboutin,项目名称:Shmoulette,代码行数:32,代码来源:CWaves.cpp
示例17: fprintf
// thread
Web::ExitCode Web::Entry()
{
#ifdef DEBUG
fprintf(stdout, "Start Web\n");
#endif
wxHTTP get;
get.SetHeader(_T("Content-type"), _T("text/html; charset=utf-8"));
get.SetTimeout(30);
while (!get.Connect(_T("www.workinprogress.ca"))) {
if(TestDestroy()) {
return (wxThread::ExitCode)0;
} else {
wxSleep(5);
}
}
wxInputStream *in_stream = get.GetInputStream(whaturl);
if (get.GetError() == wxPROTO_NOERR)
{
bool shutdownRequest = false;
unsigned char buffer[DLBUFSIZE+1];
do {
Sleep(0); //http://trac.wxwidgets.org/ticket/10720
in_stream->Read(buffer, DLBUFSIZE);
size_t bytes_read = in_stream->LastRead();
if (bytes_read > 0) {
buffer[bytes_read] = 0;
wxString buffRead((const char*)buffer, wxConvUTF8);
m_dataRead.Append(buffRead);
}
// Check termination request from time to time
if(TestDestroy()) {
shutdownRequest = true;
break;
}
} while ( !in_stream->Eof() );
wxDELETE(in_stream);
get.Close();
if(shutdownRequest == false) {
delete in_stream;
ParseFile(whaturl);
}
} else {
return (wxThread::ExitCode)0;
}
#ifdef DEBUG
fprintf(stdout, "Done Web\n");
#endif
return (wxThread::ExitCode)0; // success
}
开发者ID:hihihippp,项目名称:kiku,代码行数:61,代码来源:web.cpp
示例18: GetFileTitle
/*---------------------------------------------------------------------------
* GetFileTitle
* Purpose: API to outside world to obtain the title of a file given the
* file name. Useful if file name received via some method
* other that GetOpenFileName (e.g. command line, drag drop).
* Assumes: lpszFile points to NULL terminated DOS filename (may have path)
* lpszTitle points to buffer to receive NULL terminated file title
* wBufSize is the size of buffer pointed to by lpszTitle
* Returns: 0 on success
* < 0, Parsing failure (invalid file name)
* > 0, buffer too small, size needed (including NULL terminator)
*--------------------------------------------------------------------------*/
short FAR PASCAL
GetFileTitle(LPCSTR lpszFile, LPSTR lpszTitle, WORD wBufSize)
{
short nNeeded;
LPSTR lpszPtr;
nNeeded = (WORD) ParseFile((ULPSTR)lpszFile);
if (nNeeded >= 0) /* Is the filename valid? */
{
if ((nNeeded = lstrlen(lpszPtr = lpszFile + nNeeded) + 1)
<= (short) wBufSize)
{
/* ParseFile() fails if wildcards in directory, but OK if in name */
/* Since they aren't OK here, the check needed here */
if (mystrchr(lpszPtr, chMatchAny) || mystrchr(lpszPtr, chMatchOne))
{
nNeeded = PARSE_WILDCARDINFILE; /* Failure */
}
else
{
lstrcpy(lpszTitle, lpszPtr);
nNeeded = 0; /* Success */
}
}
}
return(nNeeded);
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:39,代码来源:parse.c
示例19: FipidForBank
QStringList FipidForBank(const QString& bank)
{
QMap<QString, QString> result;
ParseFile(result, directory + kBankFilename, bank);
#if MSN
ParseFile(result, directory + kCcFilename, bank);
ParseFile(result, directory + kInvFilename, bank);
#endif
// the fipid for Innovision is 1.
if (bank == "Innovision")
result["1"].clear();
return QStringList() << result.keys();
}
开发者ID:KDE,项目名称:kmymoney,代码行数:16,代码来源:ofxpartner.cpp
示例20:
QHash<QImage, QString> BaseEmoticonsSource::GetReprImages (const QString& pack) const
{
QHash<QImage, QString> result;
QSet<QString> knownPaths;
for (const auto& pair : Util::Stlize (ParseFile (pack)))
{
const auto& path = pair.second;
if (knownPaths.contains (path))
continue;
knownPaths << path;
const auto& fullPath = EmoLoader_->GetIconPath (pack + "/" + path);
const QImage img { fullPath };
if (img.isNull ())
{
qWarning () << Q_FUNC_INFO
<< path
<< "in pack"
<< pack
<< "is null, got path:"
<< fullPath;
continue;
}
result [img] = pair.first;
}
return result;
}
开发者ID:ForNeVeR,项目名称:leechcraft,代码行数:31,代码来源:baseemoticonssource.cpp
注:本文中的ParseFile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论