本文整理汇总了C++中BaseEngine::FileName方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseEngine::FileName方法的具体用法?C++ BaseEngine::FileName怎么用?C++ BaseEngine::FileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseEngine
的用法示例。
在下文中一共展示了BaseEngine::FileName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
setlocale(LC_ALL, "C");
DisableDataExecution();
WStrVec argList;
ParseCmdLine(GetCommandLine(), argList);
if (argList.Count() < 2) {
Usage:
ErrOut("%s <filename> [-pwd <password>][-full][-render <path-%%d.tga>]\n",
path::GetBaseName(argList.At(0)));
return 2;
}
ScopedMem<WCHAR> filePath;
WIN32_FIND_DATA fdata;
HANDLE hfind = FindFirstFile(argList.At(1), &fdata);
if (INVALID_HANDLE_VALUE != hfind) {
ScopedMem<WCHAR> dir(path::GetDir(argList.At(1)));
filePath.Set(path::Join(dir, fdata.cFileName));
FindClose(hfind);
}
else {
// embedded documents are referred to by an invalid path
// containing more information after a colon (e.g. "C:\file.pdf:3:0")
filePath.Set(str::Dup(argList.At(1)));
}
bool fullDump = false;
WCHAR *password = NULL;
WCHAR *renderPath = NULL;
float renderZoom = 1.f;
bool useAlternateHandlers = false;
bool loadOnly = false, silent = false;
int breakAlloc = 0;
for (size_t i = 2; i < argList.Count(); i++) {
if (str::Eq(argList.At(i), L"-full"))
fullDump = true;
else if (str::Eq(argList.At(i), L"-pwd") && i + 1 < argList.Count())
password = argList.At(++i);
else if (str::Eq(argList.At(i), L"-render") && i + 1 < argList.Count()) {
// optional zoom argument (e.g. -render 50% file.pdf)
float zoom;
if (i + 2 < argList.Count() && str::Parse(argList.At(i + 1), L"%f%%%$", &zoom) && zoom > 0.f) {
renderZoom = zoom / 100.f;
i++;
}
renderPath = argList.At(++i);
}
// -alt is for debugging alternate rendering methods
else if (str::Eq(argList.At(i), L"-alt"))
useAlternateHandlers = true;
// -loadonly and -silent are only meant for profiling
else if (str::Eq(argList.At(i), L"-loadonly"))
loadOnly = true;
else if (str::Eq(argList.At(i), L"-silent"))
silent = true;
#ifdef DEBUG
else if (str::Eq(argList.At(i), L"-breakalloc") && i + 1 < argList.Count())
breakAlloc = _wtoi(argList.At(++i));
#endif
else
goto Usage;
}
#ifdef DEBUG
if (breakAlloc) {
_CrtSetBreakAlloc(breakAlloc);
if (!IsDebuggerPresent())
MessageBox(NULL, L"Keep your debugger ready for the allocation breakpoint...", L"EngineDump", MB_ICONINFORMATION);
}
#endif
if (silent) {
FILE *nul;
freopen_s(&nul, "NUL", "w", stdout);
freopen_s(&nul, "NUL", "w", stderr);
}
// optionally use GDI+ rendering for PDF/XPS and the original ChmEngine for CHM
DebugGdiPlusDevice(useAlternateHandlers);
bool useChm2Engine = !useAlternateHandlers;
ScopedGdiPlus gdiPlus;
DocType engineType;
PasswordHolder pwdUI(password);
BaseEngine *engine = EngineManager::CreateEngine(filePath, &pwdUI, &engineType, useChm2Engine);
if (!engine) {
ErrOut("Error: Couldn't create an engine for %s!\n", path::GetBaseName(filePath));
return 1;
}
Vec<PageAnnotation> *userAnnots = LoadFileModifications(engine->FileName());
engine->UpdateUserAnnotations(userAnnots);
delete userAnnots;
if (!loadOnly)
DumpData(engine, fullDump);
if (renderPath)
RenderDocument(engine, renderPath, renderZoom, silent);
delete engine;
//.........这里部分代码省略.........