您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ typeId函数代码示例

51自学网 2021-06-03 09:02:12
  C++
这篇教程C++ typeId函数代码示例写得很实用,希望能帮到您。

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

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

示例1: while

void QmlProfilerRangeModel::findBindingLoops(){    typedef QPair<int, int> CallStackEntry;    QStack<CallStackEntry> callStack;    for (int i = 0; i < count(); ++i) {        int potentialParent = callStack.isEmpty() ? -1 : callStack.top().second;        while (potentialParent != -1 && !(endTime(potentialParent) > startTime(i))) {            callStack.pop();            potentialParent = callStack.isEmpty() ? -1 : callStack.top().second;        }        // check whether event is already in stack        for (int ii = 0; ii < callStack.size(); ++ii) {            if (callStack.at(ii).first == typeId(i)) {                m_data[i].bindingLoopHead = callStack.at(ii).second;                break;            }        }        CallStackEntry newEntry(typeId(i), i);        callStack.push(newEntry);    }}
开发者ID:AgnosticPope,项目名称:qt-creator,代码行数:26,


示例2: save

	XMLNode Entity::save(XMLNode &parent) const {		XMLNode node = parent.addChild(toString(typeId()));		node.addAttrib("pos", m_pos);		if(m_dir_angle != 0.0f)			node.addAttrib("angle", m_dir_angle);		return node;	}
开发者ID:nadult,项目名称:FreeFT,代码行数:7,


示例3: volume

int item::volume(){ if (typeId() == itm_corpse) {  switch (corpse->size) {   case MS_TINY:   return   2;   case MS_SMALL:  return  40;   case MS_MEDIUM: return  75;   case MS_LARGE:  return 160;   case MS_HUGE:   return 600;  } } if( is_null() )  return 0; int ret = type->volume;  if (count_by_charges()) { ret *= charges; ret /= 100; }   if (is_gun()) {  for (int i = 0; i < contents.size(); i++)   ret += contents[i].volume(); }   return ret;}
开发者ID:ShadowZero,项目名称:Cataclysm-DDA,代码行数:28,


示例4: debugmsg

std::string item::save_info(){ if (type == NULL)  debugmsg("Tried to save an item with NULL type!"); int ammotmp = 0;/* TODO: This causes a segfault sometimes, even though we check to make sure * curammo isn't NULL.  The crashes seem to occur most frequently when saving an * NPC, or when saving map data containing an item an NPC has dropped. */ if (curammo != NULL)  ammotmp = curammo->id; if (ammotmp < 0 || ammotmp > num_items)  ammotmp = 0; // Saves us from some bugs std::stringstream dump;// (std::stringstream::in | std::stringstream::out); dump << " " << int(invlet) << " " << int(typeId()) << " " <<  int(charges) <<         " " << int(damage) << " " << int(burnt) << " " << poison << " " <<         ammotmp << " " << owned << " " << int(bday); if (active)  dump << " 1"; else  dump << " 0"; if (corpse != NULL)  dump << " " << corpse->id; else  dump << " -1"; dump << " " << mission_id << " " << player_id; size_t pos = name.find_first_of("/n"); while (pos != std::string::npos)  {  name.replace(pos, 1, "@@");  pos = name.find_first_of("/n"); } dump << " '" << name << "'"; return dump.str();}
开发者ID:ShadowZero,项目名称:Cataclysm-DDA,代码行数:34,


示例5:

 void ValueType<T>::read(const byte* buf, long len, ByteOrder byteOrder) {     value_.clear();     for (long i = 0; i < len; i += TypeInfo::typeSize(typeId())) {         value_.push_back(getValue<T>(buf + i, byteOrder));     } }
开发者ID:BlixLT,项目名称:vitaminsee,代码行数:7,


示例6: changed

void NotesModel::update(int index, const QString &text){    Note &note = m_data[index];    if (text != note.text) {        note.text = text;        emit changed(typeId(index), note.timelineModel, note.timelineIndex);    }}
开发者ID:OnlineCop,项目名称:qt-creator,代码行数:8,


示例7: typeId

bool ToolChain::operator == (const ToolChain &tc) const{    if (this == &tc)        return true;    // We ignore displayname    return typeId() == tc.typeId() && isAutoDetected() == tc.isAutoDetected();}
开发者ID:UIKit0,项目名称:qt-creator,代码行数:8,


示例8: color

nc_color item::color(){ if (typeId() == itm_corpse)  return corpse->color; if( is_null() )  return c_black; return type->color;}
开发者ID:ShadowZero,项目名称:Cataclysm-DDA,代码行数:8,


示例9: drain

void vehicle::turret_reload( vehicle_part &pt ){    item &gun = pt.base;    if( !gun.is_gun() || gun.ammo_type() == "NULL" ) {        return;    }    // try to reload using stored fuel from onboard vehicle tanks    for( const auto &e : fuels_left() ) {        const itype *fuel = item::find_type( e.first );        if( !fuel->ammo || e.second < gun.ammo_required() ) {            continue;        }        if( ( gun.ammo_current() == "null" && fuel->ammo->type == gun.ammo_type() ) ||            ( gun.ammo_current() == e.first ) ) {            int qty = gun.ammo_remaining();            gun.ammo_set( e.first, e.second );            drain( e.first, gun.ammo_remaining() - qty );            return;        }    }    // otherwise try to reload from turret cargo space    for( auto it = pt.items.begin(); it != pt.items.end(); ++it ) {        if( it->is_ammo() &&            ( ( gun.ammo_current() == "null" && it->ammo_type() == gun.ammo_type() ) ||              ( gun.ammo_current() == it->typeId() ) ) ) {            int qty = gun.ammo_remaining();            gun.ammo_set( it->typeId(), it->charges );            it->charges -= gun.ammo_remaining() - qty;            if( it->charges <= 0 ) {                pt.items.erase( it );            }            return;        }    }}
开发者ID:codemime,项目名称:Cataclysm-DDA,代码行数:45,


示例10: byTypeId

QVariantList NotesModel::byTypeId(int selectedType) const{    QVariantList ret;    for (int noteId = 0; noteId < count(); ++noteId) {        if (selectedType == typeId(noteId))            ret << noteId;    }    return ret;}
开发者ID:OnlineCop,项目名称:qt-creator,代码行数:9,


示例11: typeId

const MessageType *MessageTypePool::type(const std::string &typeName) const{    const Id id = typeId(typeName);    if (id == npos) {        return nullptr;    } else {        return type(id);    }}
开发者ID:sarum9in,项目名称:bunsan_binlogs,代码行数:9,


示例12: typeId

void NotesModel::remove(int index){    Note &note = m_data[index];    int noteType = typeId(index);    int timelineModel = note.timelineModel;    int timelineIndex = note.timelineIndex;    m_data.removeAt(index);    emit changed(noteType, timelineModel, timelineIndex);}
开发者ID:OnlineCop,项目名称:qt-creator,代码行数:9,


示例13: writeU16

void NodeMetadata::serialize(std::ostream &os){	u8 buf[2];	writeU16(buf, typeId());	os.write((char*)buf, 2);	std::ostringstream oss(std::ios_base::binary);	serializeBody(oss);	os<<serializeString(oss.str());}
开发者ID:Jobava,项目名称:Voxelands,代码行数:10,


示例14: made_of

bool item::made_of(material mat){ if( is_null() )  return false; if (typeId() == itm_corpse)  return (corpse->mat == mat); return (type->m1 == mat || type->m2 == mat);}
开发者ID:ShadowZero,项目名称:Cataclysm-DDA,代码行数:10,


示例15: LOG_Debug

    void CloudReconnectWorker::processNotification( AbsOptCloudClientWorker::TypeId tId, const AbsOptCloudClientWorker::BufferType& data )    {      LOG_Debug(core, "Process event message type notification ...");      IUccSessionListener::TypeId typeId(tId);      // Here we need to verify if the notification correspond to uccReconnectRequest.      if( typeId == gvr::communication::ucc::UccMessageCloudReconnect::GetTypeId() )      {        doReconnect(data);      }    }
开发者ID:marianovolker,项目名称:jmps-public,代码行数:11,


示例16: count

void QmlProfilerRangeModel::computeExpandedLevels(){    QHash<int, int> eventRow;    int eventCount = count();    for (int i = 0; i < eventCount; i++) {        int eventTypeId = typeId(i);        if (!eventRow.contains(eventTypeId)) {            eventRow[eventTypeId] = m_expandedRowTypes.size();            m_expandedRowTypes << eventTypeId;        }        m_data[i].displayRowExpanded = eventRow[eventTypeId];    }    setExpandedRowCount(m_expandedRowTypes.size());}
开发者ID:AgnosticPope,项目名称:qt-creator,代码行数:14,


示例17: weight

int item::weight(){ if (typeId() == itm_corpse) {  int ret;  switch (corpse->size) {   case MS_TINY:   ret =    5;	break;   case MS_SMALL:  ret =   60;	break;   case MS_MEDIUM: ret =  520;	break;   case MS_LARGE:  ret = 2000;	break;   case MS_HUGE:   ret = 4000;	break;  }  if (made_of(VEGGY))   ret /= 10;  else if (made_of(IRON) || made_of(STEEL) || made_of(STONE))   ret *= 5;  return ret; } if( is_null() )  return 0; int ret = type->weight; if (count_by_charges() && !made_of(LIQUID)) { ret *= charges; ret /= 100; } for (int i = 0; i < contents.size(); i++)  if (contents[i].made_of(LIQUID))  {    if (contents[i].type->is_food())       {        it_comest* tmp_comest = dynamic_cast<it_comest*>(contents[i].type);        ret += contents[i].weight() * (contents[i].charges / tmp_comest->charges);      }          else if (contents[i].type->is_ammo())      {        it_ammo* tmp_ammo = dynamic_cast<it_ammo*>(contents[i].type);        ret += contents[i].weight() * (contents[i].charges / tmp_ammo->count);          }      else        ret += contents[i].weight();  }  else  ret += contents[i].weight();   return ret;}
开发者ID:ShadowZero,项目名称:Cataclysm-DDA,代码行数:49,


示例18: NodeMetadata

FurnaceNodeMetadata::FurnaceNodeMetadata(IGameDef *gamedef):	NodeMetadata(gamedef){	NodeMetadata::registerType(typeId(), typeName(), create, create);		m_inventory = NULL;	m_infotext = "Furnace is inactive";	m_step_accumulator = 0;	m_fuel_totaltime = 0;	m_fuel_time = 0;	m_src_totaltime = 0;	m_src_time = 0;}
开发者ID:Anchakor,项目名称:minetest,代码行数:15,


示例19: getDefinition

//==============================================================================bool ContextDefinitionManager::deserializeDefinitions(ISerializer& serializer){	// load generic definitions	size_t count = 0;	serializer.deserialize(count);	for (size_t i = 0; i < count; i++)	{		std::string defName;		serializer.deserialize(defName);		std::string parentDefName;		serializer.deserialize(parentDefName);		auto pDef = getDefinition(defName.c_str());		IClassDefinitionModifier* modifier = nullptr;		if (!pDef)		{			auto definition = registerDefinition(createGenericDefinition(defName.c_str()));			modifier = definition->getDetails().getDefinitionModifier();		}		size_t size = 0;		serializer.deserialize(size);		std::string propName;		std::string typeName;		uint32_t flags;		for (size_t j = 0; j < size; j++)		{			propName.clear();			typeName.clear();			serializer.deserialize(propName);			serializer.deserialize(typeName);			serializer.deserialize(flags);			IBasePropertyPtr property = nullptr;			auto metaType = MetaType::find(typeName.c_str());			if (modifier)			{				bool isCollection = flags & ContextDefinitionManagerDetails::IS_COLLECTION;				auto property = modifier->addProperty(				propName.c_str(), metaType != nullptr ? metaType->typeId().getName() : typeName.c_str(), nullptr,				isCollection);				// TF_ASSERT( property );			}		}	}	return true;}
开发者ID:wgsyd,项目名称:wgtf,代码行数:47,


示例20: GenericNodeMetadata

	GenericNodeMetadata(IGameDef *gamedef):		NodeMetadata(gamedef),		m_inventory(NULL),		m_text(""),		m_owner(""),		m_infotext("GenericNodeMetadata"),		m_inventorydrawspec(""),		m_allow_text_input(false),		m_removal_disabled(false),		m_enforce_owner(false),		m_inventory_modified(false),		m_text_modified(false)	{		NodeMetadata::registerType(typeId(), typeName(), create, create);	}
开发者ID:Anchakor,项目名称:minetest,代码行数:18,


示例21: typeId

QVariantMap QmlProfilerTimelineModel::locationFromTypeId(int index) const{    QVariantMap result;    int id = typeId(index);    if (id < 0)        return result;    auto types = modelManager()->qmlModel()->eventTypes();    if (id >= types.length())        return result;    QmlEventLocation location = types.at(id).location();    result.insert(QStringLiteral("file"), location.filename());    result.insert(QStringLiteral("line"), location.line());    result.insert(QStringLiteral("column"), location.column());    return result;}
开发者ID:daodaoliang,项目名称:qt-creator,代码行数:19,


示例22: is_food

bool item::is_food(player *u) const{ if (!u)  return is_food(); if( is_null() )  return false; if (type->is_food())  return true; if (u->has_bionic("bio_batteries") && is_ammo() &&     (dynamic_cast<it_ammo*>(type))->type == AT_BATT)  return true; if (u->has_bionic("bio_furnace") && is_flammable(type->m1) &&     is_flammable(type->m2) && typeId() != "corpse")  return true; return false;}
开发者ID:RexWolf163ru,项目名称:Cataclysm-DDA,代码行数:19,


示例23: property

/** * Returns the value of the property /a name, taking into account that it may * be inherited from another object or from the type. * * - A Tile instance can inherit properties based on its type * - A MapObject instance can inherit properties based on: *      - Its template object *      - Its tile *      - Its type (or the type of its tile) */QVariant Object::inheritedProperty(const QString &name) const{    if (hasProperty(name))        return property(name);    QString objectType;    switch (typeId()) {    case MapObjectType: {        auto mapObject = static_cast<const MapObject*>(this);        objectType = mapObject->type();        if (const MapObject *templateObject = mapObject->templateObject())            if (templateObject->hasProperty(name))                return templateObject->property(name);        if (Tile *tile = mapObject->cell().tile()) {            if (tile->hasProperty(name))                return tile->property(name);            if (objectType.isEmpty())                objectType = tile->type();        }        break;    }    case TileType:        objectType = static_cast<const Tile*>(this)->type();        break;    default:        return QVariant();    }    if (!objectType.isEmpty()) {        for (const ObjectType &type : qAsConst(mObjectTypes)) {            if (type.name == objectType)                if (type.defaultProperties.contains(name))                    return type.defaultProperties.value(name);        }    }    return QVariant();}
开发者ID:bjorn,项目名称:tiled,代码行数:53,


示例24: is_food

bool item::is_food(player *u){ if (u == NULL)  return is_food(); if( is_null() )  return false; if (type->is_food())  return true; if (u->has_bionic(bio_batteries) && is_ammo() &&     (dynamic_cast<it_ammo*>(type))->type == AT_BATT)  return true; if (u->has_bionic(bio_furnace) && is_flammable(type->m1) &&     is_flammable(type->m2) && typeId() != itm_corpse)  return true; return false;}
开发者ID:ShadowZero,项目名称:Cataclysm-DDA,代码行数:19,


示例25: debugmsg

std::string item::save_info(){ if (type == NULL){  debugmsg("Tried to save an item with NULL type!"); } itype_id ammotmp = "null";/* TODO: This causes a segfault sometimes, even though we check to make sure * curammo isn't NULL.  The crashes seem to occur most frequently when saving an * NPC, or when saving map data containing an item an NPC has dropped. */ if (curammo != NULL){  ammotmp = curammo->id; } if( std::find(unreal_itype_ids.begin(), unreal_itype_ids.end(),     ammotmp) != unreal_itype_ids.end()  &&     std::find(artifact_itype_ids.begin(), artifact_itype_ids.end(),     ammotmp) != artifact_itype_ids.end()     ) {  ammotmp = "null"; //Saves us from some bugs, apparently? } std::stringstream dump; dump << " " << int(invlet) << " " << typeId() << " " <<  int(charges) <<         " " << int(damage) << " " << int(item_flags) << " " << int(burnt) <<         " " << poison << " " << ammotmp << " " << owned << " " << int(bday); if (active)  dump << " 1"; else  dump << " 0"; if (corpse != NULL)  dump << " " << corpse->id; else  dump << " -1"; dump << " " << mission_id << " " << player_id; size_t pos = name.find_first_of("/n"); while (pos != std::string::npos)  {  name.replace(pos, 1, "@@");  pos = name.find_first_of("/n"); } dump << " '" << name << "'"; return dump.str();}
开发者ID:RexWolf163ru,项目名称:Cataclysm-DDA,代码行数:41,


示例26: strlen

bool VariantStreamHandler::read(Variant& v, const NodePtr& node, const char* typeName){	// Check that we've been given a valid Variant	if (v.isVoid() || v.type() == nullptr)	{		return false;	}	auto variantTypeName = this->getReservedNames().variantInternalType;	std::string typeData = node->getChildNode(variantTypeName, strlen(variantTypeName))->getValueString();	TypeId typeId(typeData.c_str());	// Check that the types match	if (strcmp(v.type()->typeId().getName(), typeId.getName()) != 0)	{		return false;	}	ResizingMemoryStream rs(node->getValueString());	TextStream ts(rs);	ts >> v;	return true;}
开发者ID:wgsyd,项目名称:wgtf,代码行数:24,


示例27: typeSize

 //! Return the size in bytes of one component of this type long typeSize() const { return TypeInfo::typeSize(typeId()); }
开发者ID:BlixLT,项目名称:vitaminsee,代码行数:2,


示例28: typeName

 //! Return the name of the type const char* typeName() const { return TypeInfo::typeName(typeId()); }
开发者ID:BlixLT,项目名称:vitaminsee,代码行数:2,



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


C++ typeName函数代码示例
C++ typeChanged函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。