当前位置: 首页>>代码示例>>C++>>正文


C++ OverlayComp::GetPathName方法代码示例

本文整理汇总了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;
    }
}
开发者ID:barak,项目名称:ivtools-cvs,代码行数:31,代码来源:framefile.c

示例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;
    }
}
开发者ID:jmzaleski,项目名称:ivtools-1.2,代码行数:56,代码来源:ovfile.c


注:本文中的OverlayComp::GetPathName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。