コード例 #1
0
ファイル: type.cpp プロジェクト: Yermo/hhvm
TEST(Type, Top) {
  for (auto t : allTypes()) {
    EXPECT_TRUE(t.subtypeOf(Type::Top));
  }
  for (auto t : allTypes()) {
    if (t.equals(Type::Top)) continue;
    EXPECT_FALSE(Type::Top.subtypeOf(t));
  }
}
コード例 #2
0
ファイル: type.cpp プロジェクト: hariharanravi/hhvm
TEST(Type, Top) {
  for (auto t : allTypes()) {
    EXPECT_TRUE(t <= TTop);
  }
  for (auto t : allTypes()) {
    if (t == TTop) continue;
    EXPECT_FALSE(TTop <= t);
  }
}
コード例 #3
0
void PoleView::choose()
{
  QString form("%1 (%2)" );
  QString allTypes( "*.doc *.xls *.xla *.ppt *.dot *.xlt *.pps" );
  QString filter1 = QString(form).arg( tr("Microsoft Office Files") ).arg( allTypes );
  QString filter2a = QString(form).arg( tr("Microsoft Word Document") ).arg( "*.doc" );
  QString filter2b = QString(form).arg( tr("Microsoft Word Template") ).arg( "*.dot" );
  QString filter3a = QString(form).arg( tr("Microsoft Excel Workbook") ).arg( "*.xls" );
  QString filter3b = QString(form).arg( tr("Microsoft Excel Template") ).arg( "*.xlt" );
  QString filter3c = QString(form).arg( tr("Microsoft Excel Add-In") ).arg( "*.xla" );
  QString filter4a = QString(form).arg( tr("Microsoft PowerPoint Presentation") ).arg( "*.ppt" );
  QString filter4b = QString(form).arg( tr("Microsoft PowerPoint Template") ).arg( "*.pps" );
  QString filter5 = QString(form).arg( tr("All Files") ).arg( "*" );
  
  QString filter = filter1.append( ";;" ).append( filter2a );
  filter = filter.append( ";;" ).append( filter2b );
  filter = filter.append( ";;" ).append( filter3a );
  filter = filter.append( ";;" ).append( filter3b );
  filter = filter.append( ";;" ).append( filter3c );
  filter = filter.append( ";;" ).append( filter4a );
  filter = filter.append( ";;" ).append( filter4b );
  filter = filter.append( ";;" ).append( filter5 );
  
  QString fn = QFileDialog::getOpenFileName( QString::null, filter, this );
  
  if ( !fn.isEmpty() ) openFile( fn );
  else
    statusBar()->message( tr("Loading aborted"), 2000 );
}
コード例 #4
0
ファイル: type.cpp プロジェクト: Bharat1992/hiphop-php
TEST(Type, CanRunDtor) {
  TypeSet types = allTypes();
  auto expectTrue = [&](Type t) {
    EXPECT_TRUE(t.canRunDtor()) << t.toString() << ".canRunDtor() == true";
    types.erase(t);
  };
  expectTrue(Type::Arr);
  expectTrue(Type::CountedArr);
  expectTrue(Type::Obj);
  expectTrue(Type::Res);
  expectTrue(Type::Counted);
  expectTrue(Type::BoxedArr);
  expectTrue(Type::BoxedCountedArr);
  expectTrue(Type::BoxedObj);
  expectTrue(Type::BoxedRes);
  expectTrue(Type::BoxedCell);
  expectTrue(Type::Cell);
  expectTrue(Type::Gen);
  expectTrue(Type::Ctx);
  expectTrue(Type::Obj | Type::Func);
  expectTrue(Type::Init);
  expectTrue(Type::Top);
  expectTrue(Type::StackElem);
  expectTrue(Type::AnyObj);
  expectTrue(Type::AnyRes);
  expectTrue(Type::AnyArr);
  expectTrue(Type::AnyCountedArr);
  expectTrue(Type::AnyCell);

  for (Type t : types) {
    EXPECT_FALSE(t.canRunDtor()) << t.toString() << ".canRunDtor == false";
  }
}
コード例 #5
0
ファイル: gxType.cpp プロジェクト: marcpage/gx
/** 
	@todo Still to setup
		Dispatch table methods
		Interface prototypes
		
*/
void Type::init() {
	static bool	inited= false;
	
	if(!inited) {
		Type	placeHolderType;
		
		inited= true;
		// create the types
		for(size_t type= 0; type < sizeof(gTypeBootStrapTable)/sizeof(gTypeBootStrapTable[0]); ++type) {
			const_cast<Type*>(gTypeBootStrapTable[type].type)->assign(new Extrinsic(placeHolderType, Type::kCountOfMembers), Pointer::DoNotRetain);
		}
		// create the interfaces
		for(size_t interface= 0; interface < sizeof(gInterfaceBootStrapTable)/sizeof(gInterfaceBootStrapTable[0]); ++interface) {
			gInterfaceBootStrapTable[interface].assign(new Extrinsic(Interface::type, Interface::kCountOfMembers), Pointer::DoNotRetain);
		}
		// assign interface of all interfaces
		for(size_t interface= 0; interface < sizeof(gInterfaceBootStrapTable)/sizeof(gInterfaceBootStrapTable[0]); ++interface) {
			gInterfaceBootStrapTable[interface]._interface= &gInterfaceBootStrapTable[iInterface].ref<GenericInstance>();
			Pointer::_retain(gInterfaceBootStrapTable[interface]._interface);
		}
		// initialize all Pointer types and interfaces
		for(size_t type= 0; type < sizeof(gTypeBootStrapTable)/sizeof(gTypeBootStrapTable[0]); ++type) {
			size_t	index= gTypeBootStrapTable[type].interfaceIndex;

			*const_cast<Type*>(gTypeBootStrapTable[type].type)= const_cast<GenericInstance*>(&Type::type.ref<GenericInstance>());
			*const_cast<Interface*>(gTypeBootStrapTable[type].interface)= gInterfaceBootStrapTable[index];
		}
		// set the name, parent and dispatches (and fill in interface of the dispatch)
		for(size_t type= 0; type < sizeof(gTypeBootStrapTable)/sizeof(gTypeBootStrapTable[0]); ++type) {
			size_t	index= gTypeBootStrapTable[type].interfaceIndex;
			List	dispatches(1);
			List	members(gTypeBootStrapTable[type].memberCount);
			List	constants(gTypeBootStrapTable[type].constantCount);
			
			dispatches.set(0, Dispatch(gInterfaceBootStrapTable[index]));
			const_cast<Type*>(gTypeBootStrapTable[type].type)->ref<Extrinsic>()[Name]= ASCIIText(gTypeBootStrapTable[type].name);
			const_cast<Type*>(gTypeBootStrapTable[type].type)->ref<Extrinsic>()[Parent]= Instance::type;
			const_cast<Type*>(gTypeBootStrapTable[type].type)->ref<Extrinsic>()[Dispatches]= dispatches;
			const_cast<Type*>(gTypeBootStrapTable[type].type)->ref<Extrinsic>()[Constants]= constants;
			const_cast<Type*>(gTypeBootStrapTable[type].type)->ref<Extrinsic>()[Members]= members;
		}
		
		// Fill in a list of all the known types so far
		List		typeList(sizeof(gTypeBootStrapTable)/sizeof(gTypeBootStrapTable[0]));
		
		for(size_t type= 0; type < sizeof(gTypeBootStrapTable)/sizeof(gTypeBootStrapTable[0]); ++type) {
			typeList.set(type, *gTypeBootStrapTable[type].type);
		}
		
		Type		*typeType= const_cast<Type*>(&Type::type); ///< Get Type's type to fix up
		List		&members= typeType->ref<Extrinsic>()[Members].ref<List>();
		List		&constants= typeType->ref<Extrinsic>()[Constants].ref<List>();
		Reference	allTypes(typeList);
		
		members.set(Name,		gInterfaceBootStrapTable[iText]);
		members.set(Parent,		gInterfaceBootStrapTable[iType]);
		members.set(Dispatches,	gInterfaceBootStrapTable[iList]);
		members.set(Constants,	gInterfaceBootStrapTable[iList]);
		members.set(Members,	gInterfaceBootStrapTable[iList]);
		constants.set(AllTypes,	allTypes);
		
		// call the init for every type
		for(size_t type= 0; type < sizeof(gTypeBootStrapTable)/sizeof(gTypeBootStrapTable[0]); ++type) {
			gTypeBootStrapTable[type].init();
		}
	}
}