本文整理汇总了C++中OverlayComp::GetPathName方法的典型用法代码示例。如果您正苦于以下问题:C++ OverlayComp::GetPathName方法的具体用法?C++ OverlayComp::GetPathName怎么用?C++ OverlayComp::GetPathName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OverlayComp
的用法示例。
在下文中一共展示了OverlayComp::GetPathName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadPathName
int FrameFileScript::ReadPathName (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
FrameFileComp* filecomp = (FrameFileComp*)addr1;
char pathname[BUFSIZ];
if (ParamList::parse_pathname(in, pathname, BUFSIZ, filecomp->GetBaseDir()) != 0)
return -1;
/* check pathname for recursion */
OverlayComp* parent = (OverlayComp*) filecomp->GetParent();
while (parent != nil) {
if (parent->GetPathName() && strcmp(parent->GetPathName(), pathname) == 0) {
cerr << "framefile recursion not allowed (" << pathname << ")\n";
return -1;
}
parent = (OverlayComp*) parent->GetParent();
}
filecomp->SetPathName(pathname);
FrameIdrawComp* child = nil;
FrameCatalog* catalog = (FrameCatalog*)unidraw->GetCatalog();
catalog->SetParent(filecomp);
if( catalog->FrameCatalog::Retrieve(pathname, (Component*&)child)) {
catalog->SetParent(nil);
catalog->Forget(child);
filecomp->Append(child);
return 0;
} else {
catalog->SetParent(nil);
return -1;
}
}
示例2: ReadPathName
int OverlayFileScript::ReadPathName (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
OverlayFileComp* filecomp = (OverlayFileComp*)addr1;
const char* paramname = ParamList::CurrParamStruct()->name();
filecomp->SetPopenFlag(strcmp(paramname, "popen")==0);
char pathname[BUFSIZ];
if (filecomp->GetPopenFlag()) {
if (ParamList::parse_string(in, pathname, BUFSIZ) != 0)
return -1;
} else {
if (ParamList::parse_pathname(in, pathname, BUFSIZ, filecomp->GetBaseDir()) != 0)
return -1;
}
/* check pathname for recursion */
OverlayComp* parent = (OverlayComp*) filecomp->GetParent();
while (!filecomp->GetPopenFlag() && parent != nil) {
if (parent->GetPathName() && strcmp(parent->GetPathName(), pathname) == 0) {
cerr << "pathname recursion not allowed (" << pathname << ")\n";
return -1;
}
parent = (OverlayComp*) parent->GetParent();
}
filecomp->SetPathName(pathname);
if (!filecomp->GetPopenFlag()) {
OverlayIdrawComp* child = nil;
OverlayCatalog* catalog = (OverlayCatalog*) unidraw->GetCatalog();
catalog->SetParent(filecomp);
if( catalog->OverlayCatalog::Retrieve(pathname, (Component*&)child)) {
catalog->SetParent(nil);
catalog->Forget(child);
filecomp->Append(child);
return 0;
} else {
catalog->SetParent(nil);
return -1;
}
} else {
OvImportCmd impcmd((Editor*)nil);
FILE* fptr = popen(pathname, "r");
if (fptr) {
FILEBUF(fbuf, fptr, ios_base::in);
istream ifs(&fbuf);
OverlayComp* child = (OverlayComp*) impcmd.Import(ifs);
if (child) {
filecomp->Append(child);
return 0;
}
fclose(fptr);
}
return -1;
}
}