• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TypeInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TypeInfo的典型用法代码示例。如果您正苦于以下问题:C++ TypeInfo类的具体用法?C++ TypeInfo怎么用?C++ TypeInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TypeInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: NewActor

Actor NewActor( const Property::Map& map )
{
  BaseHandle handle;

  // First find type and create Actor
  Property::Value* typeValue = map.Find( "type" );
  if ( typeValue )
  {
    TypeInfo type = TypeRegistry::Get().GetTypeInfo( typeValue->Get< std::string >() );
    if ( type )
    {
      handle = type.CreateInstance();
    }
  }

  if ( !handle )
  {
    DALI_LOG_ERROR( "Actor type not provided\n" );
    return Actor();
  }

  Actor actor( Actor::DownCast( handle ) );

  if ( actor )
  {
    // Now set the properties, or create children
    for ( unsigned int i = 0, mapCount = map.Count(); i < mapCount; ++i )
    {
      const StringValuePair& pair( map.GetPair( i ) );
      const std::string& key( pair.first );
      if ( key == "type" )
      {
        continue;
      }

      const Property::Value& value( pair.second );

      if ( key == "actors" )
      {
        // Create children
        Property::Array actorArray = value.Get< Property::Array >();
        for ( Property::Array::SizeType i = 0; i < actorArray.Size(); ++i)
        {
          actor.Add( NewActor( actorArray[i].Get< Property::Map >() ) );
        }
      }
      else
      {
        Property::Index index( actor.GetPropertyIndex( key ) );

        if ( index != Property::INVALID_INDEX )
        {
          actor.SetProperty( index, value );
        }
      }
    }
  }

  return actor;
}
开发者ID:tizenorg,项目名称:platform.core.uifw.dali-core,代码行数:60,代码来源:scripting.cpp


示例2: NewType

// allocate a object given the classname by string
RTRoot* NewType(const char *typeName)
{
TypeInfo *t = FindType(typeName);
if (!t) return(NULL);
if (t->New == 0) return(NULL);		// abstract type
return t->New();
}
开发者ID:deepmatrix,项目名称:blaxxun-cc3d,代码行数:8,代码来源:rt.cpp


示例3: if

/*Type* DeclarationNode::buildType(DeclarationSpecifiersNode::TypeInfo tInfo) const
{
	Type* type = NULL;

	bool unsignedSpecified = tInfo.unsignedSpecified;
	int  integral = tInfo.integral;
	bool longSpecified = tInfo.longLongSpecified;
	bool longLongSpecified = tInfo.longLongSpecified;

	if (unsignedSpecified) {
		if (integral==Char) 
			type = new BuiltinType<char>(Type::uChar);
		else if (integral==Short)
			type = new BuiltinType<short>(Type::uShort);
		else if (integral==Int)
			type = new BuiltinType<int>(Type::uInt);
		else if (longLongSpecified)
			type = new BuiltinType<unsigned long long>(Type::uLongLong);
		else if (longSpecified)
			type = new BuiltinType<unsigned long>(Type::uLong);
	}
	else {
		if (integral==Int) {
			if (longLongSpecified)
				type = new BuiltinType<long long>(Type::Long);
			else if (longSpecified)
				type = new BuiltinType<long>(Type::Long);
			else
				type = new BuiltinType<int>(Type::Int);
		}
		else {
			if (integral==Char)
				type = new BuiltinType<char>(Type::Char);
			else if (Short)
				type = new BuiltinType<short>(Type::Short);
			else if (integral==Float)
				type = new BuiltinType<float>(Type::Float);
			else if (integral==Double)
				type = new BuiltinType<double>(Type::Double);
		}
	}

	return type;
}
*/
std::string DeclarationNode::toString() const
{
	std::string s="DeclarationNode: \n" ;
	TypeInfo t = declSpecifier->getTypeInfo();
	s+= "\t" + t.toString() + "\n";
	return s;
}
开发者ID:YutaMatsumoto,项目名称:MIPSc,代码行数:52,代码来源:DeclarationNode.cpp


示例4: ObjectArray

  /* Understands how to read the inside of an object and find all references
   * located within. It copies the objects pointed to, but does not follow into
   * those further (ie, not recursive) */
  void GarbageCollector::scan_object(Object* obj) {
    Object* slot;

    // If this object's refs are weak, then add it to the weak_refs
    // vector and don't look at it otherwise.
    if(obj->RefsAreWeak) {
      if(!weak_refs) {
        weak_refs = new ObjectArray(0);
      }

      weak_refs->push_back(obj);
      return;
    }

    if(obj->klass() && obj->klass()->reference_p()) {
      slot = saw_object(obj->klass());
      if(slot) object_memory->set_class(obj, slot);
    }

    if(obj->ivars() && obj->ivars()->reference_p()) {
      slot = saw_object(obj->ivars());
      if(slot) obj->ivars(object_memory->state, slot);
    }

    TypeInfo* ti = object_memory->type_info[obj->obj_type];
    assert(ti);

    ObjectMark mark(this);
    ti->mark(obj, mark);
  }
开发者ID:soaexpert,项目名称:rubinius,代码行数:33,代码来源:gc.cpp


示例5: lock

    bool TypeInfoRepository::addType(TypeInfoGenerator* t)
    {
        if (!t)
            return false;
        std::string tname = t->getTypeName();
        TypeInfo* ti = t->getTypeInfoObject();

        {
            MutexLock lock(type_lock);
            if (ti && data.count(tname) && data[tname] != ti ) {
              cout << "Refusing to add type information for '" << tname << "': the name is already in use by another type."<<endl;
                return false;
            }
        }
        // Check for first registration, or alias:
        if ( ti == 0 )
            ti = new TypeInfo(tname);
        else
            ti->addAlias(tname);

        if ( t->installTypeInfoObject( ti ) ) {
            delete t;
        }
        MutexLock lock(type_lock);
        // keep track of this type:
        data[ tname ] = ti;

        /* cout << "Registered Type '"<<tname <<"' to the Orocos Type System."<< endl;
        for(Transports::iterator it = transports.begin(); it != transports.end(); ++it)
            if ( (*it)->registerTransport( tname, ti) )
            log(Info) << "Registered new '"<< (*it)->getTransportName()<<"' transport for " << tname <<endlog();*/
        return true;
    }
开发者ID:chenkunxiao,项目名称:OrocosThread,代码行数:33,代码来源:TypeInfoRepository.cpp


示例6: UtcDaliConfirmationPopupTypeRegistryCreation

int UtcDaliConfirmationPopupTypeRegistryCreation(void)
{
  ToolkitTestApplication application;
  tet_infoline( " UtcDaliConfirmationPopupTypeRegistryCreation" );

  TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "ConfirmationPopup" );
  DALI_TEST_CHECK( typeInfo )

  BaseHandle baseHandle = typeInfo.CreateInstance();
  DALI_TEST_CHECK( baseHandle )

  Toolkit::Popup popup = Toolkit::Popup::DownCast( baseHandle );
  popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f );

  Stage::GetCurrent().Add( popup );
  popup.SetDisplayState( Toolkit::Popup::SHOWN );

  application.SendNotification();
  application.Render();

  // Check the popup is shown.
  DALI_TEST_EQUALS( popup.GetDisplayState(), Popup::SHOWN, TEST_LOCATION );

  END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:25,代码来源:utc-Dali-ConfirmationPopup.cpp


示例7: JSCell

Structure::Structure(VM& vm)
    : JSCell(CreatingEarlyCell)
    , m_prototype(vm, this, jsNull())
    , m_classInfo(info())
    , m_transitionWatchpointSet(IsWatched)
    , m_offset(invalidOffset)
    , m_inlineCapacity(0)
    , m_bitField(0)
{
    setDictionaryKind(NoneDictionaryKind);
    setIsPinnedPropertyTable(false);
    setHasGetterSetterProperties(m_classInfo->hasStaticSetterOrReadonlyProperties());
    setHasCustomGetterSetterProperties(false);
    setHasReadOnlyOrGetterSetterPropertiesExcludingProto(m_classInfo->hasStaticSetterOrReadonlyProperties());
    setHasNonEnumerableProperties(false);
    setAttributesInPrevious(0);
    setPreventExtensions(false);
    setDidTransition(false);
    setStaticFunctionsReified(false);
    setHasRareData(false);
 
    TypeInfo typeInfo = TypeInfo(CellType, StructureIsImmortal);
    m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), 0, typeInfo);
    m_outOfLineTypeFlags = typeInfo.outOfLineTypeFlags();

    ASSERT(hasReadOnlyOrGetterSetterPropertiesExcludingProto() || !m_classInfo->hasStaticSetterOrReadonlyProperties());
    ASSERT(hasGetterSetterProperties() || !m_classInfo->hasStaticSetterOrReadonlyProperties());
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:28,代码来源:Structure.cpp


示例8: QString

QVector<TypeInfo> Process::getCompletions(const QString &filename, const QByteArray& ustart, const QByteArray& uend)
{
    QStringList args;
    args << "-f=csv" << "autocomplete" << filename << QString("c") + QString::number(ustart.length());

    QProcess p;
    p.start("gocode", args);

    if(!p.waitForStarted(TIMEOUT))
        return QVector<TypeInfo>();

    p.write(ustart);
    p.write(uend);
    p.closeWriteChannel();

    if(!p.waitForFinished(TIMEOUT))
        return QVector<TypeInfo>();

    QStringList lines = QString(p.readAllStandardOutput()).split("\n");
    QVector<TypeInfo> out;
    out.reserve(lines.size());

    TypeInfo info;

    for(int i = 0, e = lines.size(); i < e; ++i)
        if(info.parseString(lines[i]))
            out.push_back(info);

    return out;
}
开发者ID:nkovacs,项目名称:kgocode,代码行数:30,代码来源:process.cpp


示例9: UtcDaliStyleManagerGet

int UtcDaliStyleManagerGet(void)
{
  ToolkitTestApplication application;

  tet_infoline(" UtcDaliStyleManagerGet");

  // Register Type
  TypeInfo type;
  type = TypeRegistry::Get().GetTypeInfo( "StyleManager" );
  DALI_TEST_CHECK( type );
  BaseHandle handle = type.CreateInstance();
  DALI_TEST_CHECK( handle );

  StyleManager manager;

  manager = StyleManager::Get();
  DALI_TEST_CHECK(manager);

  StyleManager newManager = StyleManager::Get();
  DALI_TEST_CHECK(newManager);

  // Check that focus manager is a singleton
  DALI_TEST_CHECK(manager == newManager);
  END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:25,代码来源:utc-Dali-StyleManager.cpp


示例10: emitCallToOutlinedCopy

void OutliningMetadataCollector::emitCallToOutlinedCopy(
                            Address dest, Address src,
                            SILType T, const TypeInfo &ti, 
                            IsInitialization_t isInit, IsTake_t isTake) const {
  llvm::SmallVector<llvm::Value *, 4> args;
  args.push_back(IGF.Builder.CreateElementBitCast(src, ti.getStorageType())
                            .getAddress());
  args.push_back(IGF.Builder.CreateElementBitCast(dest, ti.getStorageType())
                            .getAddress());
  addMetadataArguments(args);

  llvm::Constant *outlinedFn;
  if (isInit && isTake) {
    outlinedFn =
      IGF.IGM.getOrCreateOutlinedInitializeWithTakeFunction(T, ti, *this);
  } else if (isInit) {
    outlinedFn =
      IGF.IGM.getOrCreateOutlinedInitializeWithCopyFunction(T, ti, *this);
  } else if (isTake) {
    outlinedFn =
      IGF.IGM.getOrCreateOutlinedAssignWithTakeFunction(T, ti, *this);
  } else {
    outlinedFn =
      IGF.IGM.getOrCreateOutlinedAssignWithCopyFunction(T, ti, *this);
  }

  llvm::CallInst *call = IGF.Builder.CreateCall(outlinedFn, args);
  call->setCallingConv(IGF.IGM.DefaultCC);
}
开发者ID:XLsn0wKit,项目名称:swift,代码行数:29,代码来源:Outlining.cpp


示例11: rDebug

      /*!
        Est capable de reconnaitre les templates préfixés par des 
        namespaces, ainsi que ceux déjà identifiés comme des templates par 
        opencxx.
      */
      TypeTemplate* TypeTemplate::IdentifierTypeTemplate
                    (TypeInfo informationType, 
                     Environment* environement)
      {


        rDebug("TypeTemplate::IdentifierTypeTemplate") ;
        
      
        switch(informationType.WhatIs())
        {
        case TemplateType:  
          
        { 
         
          rDebug("whatis dit que c'ets un template") ;

          
               
          TemplateClass* classeTemplate 
            =  informationType.TemplateClassMetaobject() ;


          Base::Composition<TypeTemplate>
            resultat(new TypeTemplate(classeTemplate)) ;


          // arguments
          int nombreArguments = 0 ;
          TypeInfo typeArgument ;
      
          while(informationType.NthTemplateArgument(nombreArguments++,typeArgument))
          {
            
            if (typeArgument.WhatIs() == UndefType)
            {
              rDebug("parametre n'a pas de type") ;
              
              
            }
            else
            
              resultat->_parametres.AjouterEnQueue(Type::Construire(typeArgument, environement)) ;
          }

      
          return resultat.Liberer() ;
          break ;
        }
          
        default:
        
          rDebug("whatis dit que c'ets autre chose") ;
        
          return NULL ;
        
        }
        
      }
开发者ID:BackupTheBerlios,项目名称:projet-univers-svn,代码行数:64,代码来源:type_template.cpp


示例12: ASSERT

TypeInfo *Interpreter::type_info( const Expr &type ) {
    auto iter = type_info_map.find( type );
    ASSERT( iter != type_info_map.end(), "not a registered type var" );

    TypeInfo *res = iter->second;
    res->parse_if_necessary();
    return res;
}
开发者ID:hleclerc,项目名称:Stela,代码行数:8,代码来源:Interpreter.cpp


示例13: DynamicNew

Owned<void> DynamicNew(const TypeInfo& type, DynamicInitializer)
{
	if (!type.is_dynamically_constructible())
	{
		return nullptr;
	}

	// Construct object
	return AllocateDynamicNew(type, type.get_dynamic_constructor());
}
开发者ID:willcassella,项目名称:WillowEngine,代码行数:10,代码来源:New.cpp


示例14: Helper

 // Properly working breakpoints on windows with msvc10 and cdb inside static-function-inside-class-inside-function?
 // Qt-Creator: "No, not heard."
 static void* Helper(rapidjson::Document::ValueType* document, char *nextName)
 {
     bool isObject = document->IsObject();
     TypeInfo *typeInfo = TypeInfo::GetTypeInfo(nextName);
     void *next = typeInfo->New();
     for (rapidjson::Document::ValueType::MemberIterator i = document->MemberBegin(); i != document->MemberEnd(); ++i)
     {
         std::string propertyName = i->name.GetString();
         PropertyInfo *prop = typeInfo->FindProperty(propertyName);
         if (i->value.IsObject())
         {
             prop->SetValue(next, Helper(&(i->value), prop->TypeName()));
         }
         else if( i->value.IsArray())
         {
             for (int j = 0; j < i->value.Size(); j++)
             {
                 TypeInfo *tempTypeInfo = TypeInfo::GetTypeInfo(prop->TypeName());
                 void *temp = tempTypeInfo->New();
                 tempTypeInfo->SetString(temp, i->value[j].GetString());
                 prop->PushValue(next, temp);
                 delete temp;
             }
         }
         else
         {
             TypeInfo *tempTypeInfo = TypeInfo::GetTypeInfo(prop->TypeName());
             void *temp = tempTypeInfo->New();
             tempTypeInfo->SetString(temp, i->value.GetString());
             prop->SetValue(next, temp);
             delete temp;
         }
     }
     return next;
 }
开发者ID:rotanov,项目名称:way-station,代码行数:37,代码来源:main.cpp


示例15: getTypeInfo

	bool Object::inherits(const char* cls) const {
		TypeInfo* typeinfo = getTypeInfo();

		for (; typeinfo; typeinfo=typeinfo->getBaseTypeInfo()) {
			if (Strequ(cls, typeinfo->getTypeName())) {
				return true;
			}
		}

		return false;
	}
开发者ID:CharlieCraft,项目名称:axonengine,代码行数:11,代码来源:scriptsystem.cpp


示例16: combine

// ---------------------------------------------------------------------------
TypeInfo TypeInfo::combine(const TypeInfo &__lhs, const TypeInfo &__rhs) {
    TypeInfo __result = __lhs;

    __result.setConstant(__result.isConstant() || __rhs.isConstant());
    __result.setVolatile(__result.isVolatile() || __rhs.isVolatile());
    __result.setReference(__result.isReference() || __rhs.isReference());
    __result.setIndirections(__result.indirections() + __rhs.indirections());
    __result.setArrayElements(__result.arrayElements() + __rhs.arrayElements());

    return __result;
}
开发者ID:OmixVisualization,项目名称:qtjambi5,代码行数:12,代码来源:codemodel.cpp


示例17: flatten_tree

    void
    flatten_tree (TypeInfo const& ti, TypeInfoSet& set)
    {
      set.insert (ti);

      for (TypeInfo::BaseIterator i = ti.begin_base ();
           i != ti.end_base ();
           i++)
      {
        flatten_tree (i->type_info (), set);
      }
    }
开发者ID:jwillemsen,项目名称:XSC,代码行数:12,代码来源:Traversal.cpp


示例18:

Object *ObjectTypeDB::instance(const String &p_type) {
	
	TypeInfo *ti;
	{
		OBJTYPE_LOCK;
		ti=types.getptr(p_type);
		ERR_FAIL_COND_V(!ti,NULL);
		ERR_FAIL_COND_V(ti->disabled,NULL);
		ERR_FAIL_COND_V(!ti->creation_func,NULL);
	}

	return ti->creation_func();
}
开发者ID:3miu,项目名称:godot,代码行数:13,代码来源:object_type_db.cpp


示例19: Size

DebugTypeInfo DebugTypeInfo::getFromTypeInfo(DeclContext *DC, swift::Type Ty,
                                             const TypeInfo &Info) {
  Size size;
  if (Info.isFixedSize()) {
    const FixedTypeInfo &FixTy = *cast<const FixedTypeInfo>(&Info);
    size = FixTy.getFixedSize();
  } else {
    // FIXME: Handle NonFixedTypeInfo here or assert that we won't
    // encounter one.
    size = Size(0);
  }
  return DebugTypeInfo(DC, Ty.getPointer(), Info.getStorageType(), size,
                       Info.getBestKnownAlignment());
}
开发者ID:KoKumagai,项目名称:swift,代码行数:14,代码来源:DebugTypeInfo.cpp


示例20: visit_object

    /* Understands how to read the inside of an object and find all references
     * located within. It copies the objects pointed to, but does not follow into
     * those further (ie, not recursive) */
    void visit_object(Object* obj) {
      if(obj->klass() && obj->klass()->reference_p()) {
        call(obj->klass());
      }

      if(obj->ivars() && obj->ivars()->reference_p()) {
        call(obj->ivars());
      }

      TypeInfo* ti = object_memory_->type_info[obj->type_id()];
      assert(ti);

      ti->visit(obj, *this);
    }
开发者ID:,项目名称:,代码行数:17,代码来源:



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TypeInfoSet类代码示例发布时间:2022-05-31
下一篇:
C++ TypeIndex类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap