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

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

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

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

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

示例1: ScriptErrorConversion

int          ScriptValue::itemCount()                       const { throw ScriptErrorConversion(typeName(), _TYPE_("collection")); }
开发者ID:Ehnonymoose,项目名称:MSE,代码行数:1,


示例2: typeName

QString Piece::typeName() const { return typeName(m_type); }
开发者ID:Axure,项目名称:tagua,代码行数:1,


示例3: bsonCheckOnlyHasFields

Status ReplSetHeartbeatResponseV1::initialize(const BSONObj& doc) {    Status status = bsonCheckOnlyHasFields("ReplSetHeartbeatResponse",                                           doc,                                           kLegalHeartbeatFieldNames);    if (!status.isOK())        return status;    status = bsonExtractBooleanField(doc, kIsReplSetFieldName, &_isReplSet);    if (!status.isOK())        return status;    status = bsonExtractStringField(doc, kReplSetFieldName, &_setName);    if (!status.isOK())        return status;    long long stateInt;    status = bsonExtractIntegerField(doc, kMemberStateFieldName, &stateInt);    if (!status.isOK())        return status;    if (stateInt < 0 || stateInt > MemberState::RS_MAX) {        return Status(ErrorCodes::BadValue, str::stream() << "Value for /"" <<                      kMemberStateFieldName << "/" in response to replSetHeartbeat is "                      "out of range; legal values are non-negative and no more than " <<                      MemberState::RS_MAX);    }    _state = MemberState(static_cast<int>(stateInt));    // extracting the lastCommittedOp is a bit of a process    BSONObj lastOpTime = doc[kLastOpTimeFieldName].Obj();    Timestamp ts;    status = bsonExtractTimestampField(lastOpTime, kOpTimeFieldName, &ts);    if (!status.isOK())        return status;    long long term;    status = bsonExtractIntegerField(lastOpTime, kTermFieldName, &term);    if (!status.isOK())        return status;    _lastOpTime = OpTime(lastOpTime[kOpTimeFieldName].timestamp(),                         lastOpTime[kTermFieldName].Long());    status = bsonExtractStringField(doc, kSyncSourceFieldName, &_syncingTo);    if (!status.isOK())        return status;    status = bsonExtractIntegerField(doc, kConfigVersionFieldName, &_configVersion);    if (!status.isOK())        return status;    status = bsonExtractIntegerField(doc, kPrimaryIdFieldName, &_primaryId);    if (!status.isOK())        return status;    status = bsonExtractIntegerField(doc, kTermFieldName, &_term);    if (!status.isOK())        return status;    const BSONElement hasDataElement = doc[kHasDataFieldName];    _hasDataSet = !hasDataElement.eoo();    _hasData = hasDataElement.trueValue();    const BSONElement rsConfigElement = doc[kConfigFieldName];    if (rsConfigElement.eoo()) {        _configSet = false;        _config = ReplicaSetConfig();        return Status::OK();    }    else if (rsConfigElement.type() != Object) {        return Status(ErrorCodes::TypeMismatch, str::stream() << "Expected /"" <<                      kConfigFieldName << "/" in response to replSetHeartbeat to have type "                      "Object, but found " << typeName(rsConfigElement.type()));    }    _configSet = true;    return _config.initialize(rsConfigElement.Obj());}
开发者ID:hptabster,项目名称:mongo,代码行数:75,


示例4: op_add

 void Opcode8039::_run() {     auto& debug = Logger::debug("SCRIPT");     debug << "[8039] [*] op_add(aValue, bValue)" << std::endl;     auto bValue = _script->dataStack()->pop();     auto aValue = _script->dataStack()->pop();     debug << "    types: " << aValue.typeName() << " + " << bValue.typeName() << std::endl;     switch (bValue.type())     {         case StackValue::Type::INTEGER: // INTEGER         {             int arg2 = bValue.integerValue();             switch (aValue.type())             {                 case StackValue::Type::INTEGER: // INTEGER + INTEGER                 {                     _script->dataStack()->push(aValue.integerValue() + arg2);                     break;                 }                 case StackValue::Type::FLOAT: // FLOAT + INTEGER                 {                     _script->dataStack()->push(aValue.floatValue() + (float)arg2);                     break;                 }                 case StackValue::Type::STRING: // STRING + INTEGER                 {                     std::string arg1 = aValue.stringValue();                     _script->dataStack()->push(arg1 + bValue.toString());                     break;                 }                 default:                 {                     _error(std::string("op_add - invalid left argument type: ") + aValue.typeName());                 }             }             break;         }         case StackValue::Type::STRING:         {             auto arg2 = bValue.stringValue();             switch (aValue.type())             {                 case StackValue::Type::STRING: // STRING + STRING                 {                     _script->dataStack()->push(aValue.stringValue() + arg2);                     break;                 }                 case StackValue::Type::FLOAT: // FLOAT + STRING                 {                     _error("op_add - FLOAT+STRING not allowed");                 }                 case StackValue::Type::INTEGER: // INTEGER + STRING                 {                     _error("op_add - INTEGER+STRING not allowed");                 }                 default:                 {                     _error(std::string("op_add - invalid left argument type: ") + aValue.typeName());                 }             }             break;         }         case StackValue::Type::FLOAT: // FLOAT         {             auto arg2 = bValue.floatValue();             switch (aValue.type())             {                 case StackValue::Type::INTEGER: // INTEGER + FLOAT                 {                     _script->dataStack()->push((float)aValue.integerValue() + arg2);                     break;                 }                 case StackValue::Type::FLOAT: // FLOAT + FLOAT                 {                     _script->dataStack()->push(aValue.floatValue() + arg2);                     break;                 }                 case StackValue::Type::STRING: // STRING + FLOAT                 {                     auto arg1 = aValue.stringValue();                     _script->dataStack()->push(arg1 + bValue.toString());                     break;                 }                 default:                 {                     _error(std::string("op_add - invalid left argument type: ") + aValue.typeName());                 }             }             break;         }         default:         {             _error(std::string("op_add - invalid right argument type: ") + bValue.typeName());         }     } }
开发者ID:CynicRus,项目名称:falltergeist,代码行数:96,


示例5: dummyPtr

voidtestServiceRegistry::externalServiceTest(){   art::AssertHandler ah;   {      std::unique_ptr<DummyService> dummyPtr(new DummyService);      dummyPtr->value_ = 2;      art::ServiceToken token(art::ServiceRegistry::createContaining(dummyPtr));      {         art::ServiceRegistry::Operate operate(token);         art::ServiceHandle<DummyService> dummy;         CPPUNIT_ASSERT(dummy);         CPPUNIT_ASSERT(dummy.isAvailable());         CPPUNIT_ASSERT(dummy->value_ == 2);      }      {         std::vector<fhicl::ParameterSet> pss;         fhicl::ParameterSet ps;         std::string typeName("DummyService");         ps.addParameter("service_type", typeName);         int value = 2;         ps.addParameter("value", value);         pss.push_back(ps);         art::ServiceToken token(art::ServiceRegistry::createSet(pss));         art::ServiceToken token2(art::ServiceRegistry::createContaining(dummyPtr,                                                                         token,                                                                         art::serviceregistry::kOverlapIsError));         art::ServiceRegistry::Operate operate(token2);         art::ServiceHandle<testserviceregistry::DummyService> dummy;         CPPUNIT_ASSERT(dummy);         CPPUNIT_ASSERT(dummy.isAvailable());         CPPUNIT_ASSERT(dummy->value() == 2);      }   }   {      std::unique_ptr<DummyService> dummyPtr(new DummyService);      std::shared_ptr<art::serviceregistry::ServiceWrapper<DummyService> >          wrapper(new art::serviceregistry::ServiceWrapper<DummyService>(dummyPtr));      art::ServiceToken token(art::ServiceRegistry::createContaining(wrapper));      wrapper->get().value_ = 2;      {         art::ServiceRegistry::Operate operate(token);         art::ServiceHandle<DummyService> dummy;         CPPUNIT_ASSERT(dummy);         CPPUNIT_ASSERT(dummy.isAvailable());         CPPUNIT_ASSERT(dummy->value_ == 2);      }      {         std::vector<fhicl::ParameterSet> pss;         fhicl::ParameterSet ps;         std::string typeName("DummyService");         ps.addParameter("service_type", typeName);         int value = 2;         ps.addParameter("value", value);         pss.push_back(ps);         art::ServiceToken token(art::ServiceRegistry::createSet(pss));         art::ServiceToken token2(art::ServiceRegistry::createContaining(dummyPtr,                                                                         token,                                                                         art::serviceregistry::kOverlapIsError));         art::ServiceRegistry::Operate operate(token2);         art::ServiceHandle<testserviceregistry::DummyService> dummy;         CPPUNIT_ASSERT(dummy);         CPPUNIT_ASSERT(dummy.isAvailable());         CPPUNIT_ASSERT(dummy->value() == 2);      }   }}
开发者ID:gartung,项目名称:fnal-art,代码行数:78,


示例6: bsonExtractIntegerFieldWithDefault

Status ReplicaSetConfig::_parseSettingsSubdocument(const BSONObj& settings) {    //    // Parse heartbeatIntervalMillis    //    long long heartbeatIntervalMillis;    Status hbIntervalStatus =        bsonExtractIntegerFieldWithDefault(settings,                                           kHeartbeatIntervalFieldName,                                           durationCount<Milliseconds>(kDefaultHeartbeatInterval),                                           &heartbeatIntervalMillis);    if (!hbIntervalStatus.isOK()) {        return hbIntervalStatus;    }    _heartbeatInterval = Milliseconds(heartbeatIntervalMillis);    // Parse electionTimeoutMillis    //    BSONElement electionTimeoutMillisElement = settings[kElectionTimeoutFieldName];    if (electionTimeoutMillisElement.eoo()) {        _electionTimeoutPeriod = Milliseconds(kDefaultElectionTimeoutPeriod);    } else if (electionTimeoutMillisElement.isNumber()) {        _electionTimeoutPeriod = Milliseconds(electionTimeoutMillisElement.numberInt());    } else {        return Status(ErrorCodes::TypeMismatch,                      str::stream() << "Expected type of " << kSettingsFieldName << "."                                    << kElectionTimeoutFieldName                                    << " to be a number, but found a value of type "                                    << typeName(electionTimeoutMillisElement.type()));    }    //    // Parse heartbeatTimeoutSecs    //    BSONElement hbTimeoutSecsElement = settings[kHeartbeatTimeoutFieldName];    if (hbTimeoutSecsElement.eoo()) {        _heartbeatTimeoutPeriod = Seconds(kDefaultHeartbeatTimeoutPeriod);    } else if (hbTimeoutSecsElement.isNumber()) {        _heartbeatTimeoutPeriod = Seconds(hbTimeoutSecsElement.numberInt());    } else {        return Status(ErrorCodes::TypeMismatch,                      str::stream() << "Expected type of " << kSettingsFieldName << "."                                    << kHeartbeatTimeoutFieldName                                    << " to be a number, but found a value of type "                                    << typeName(hbTimeoutSecsElement.type()));    }    //    // Parse chainingAllowed    //    Status status = bsonExtractBooleanFieldWithDefault(        settings, kChainingAllowedFieldName, true, &_chainingAllowed);    if (!status.isOK())        return status;    //    // Parse getLastErrorDefaults    //    BSONElement gleDefaultsElement;    status = bsonExtractTypedField(        settings, kGetLastErrorDefaultsFieldName, Object, &gleDefaultsElement);    if (status.isOK()) {        status = _defaultWriteConcern.parse(gleDefaultsElement.Obj());        if (!status.isOK())            return status;    } else if (status == ErrorCodes::NoSuchKey) {        // Default write concern is w: 1.        _defaultWriteConcern.reset();        _defaultWriteConcern.wNumNodes = 1;    } else {        return status;    }    //    // Parse getLastErrorModes    //    BSONElement gleModesElement;    status = bsonExtractTypedField(settings, kGetLastErrorModesFieldName, Object, &gleModesElement);    BSONObj gleModes;    if (status.isOK()) {        gleModes = gleModesElement.Obj();    } else if (status != ErrorCodes::NoSuchKey) {        return status;    }    for (BSONObj::iterator gleModeIter(gleModes); gleModeIter.more();) {        const BSONElement modeElement = gleModeIter.next();        if (_customWriteConcernModes.find(modeElement.fieldNameStringData()) !=            _customWriteConcernModes.end()) {            return Status(ErrorCodes::DuplicateKey,                          str::stream() << kSettingsFieldName << '.' << kGetLastErrorModesFieldName                                        << " contains multiple fields named "                                        << modeElement.fieldName());        }        if (modeElement.type() != Object) {            return Status(ErrorCodes::TypeMismatch,                          str::stream() << "Expected " << kSettingsFieldName << '.'                                        << kGetLastErrorModesFieldName << '.'                                        << modeElement.fieldName() << " to be an Object, not "                                        << typeName(modeElement.type()));        }//.........这里部分代码省略.........
开发者ID:radik,项目名称:mongo,代码行数:101,


示例7: bsonCheckOnlyHasFields

Status ReplicaSetConfig::initialize(const BSONObj& cfg) {    _isInitialized = false;    _members.clear();    Status status =        bsonCheckOnlyHasFields("replica set configuration", cfg, kLegalConfigTopFieldNames);    if (!status.isOK())        return status;    //    // Parse replSetName    //    status = bsonExtractStringField(cfg, kIdFieldName, &_replSetName);    if (!status.isOK())        return status;    //    // Parse version    //    status = bsonExtractIntegerField(cfg, kVersionFieldName, &_version);    if (!status.isOK())        return status;    //    // Parse members    //    BSONElement membersElement;    status = bsonExtractTypedField(cfg, kMembersFieldName, Array, &membersElement);    if (!status.isOK())        return status;    for (BSONObj::iterator membersIterator(membersElement.Obj()); membersIterator.more();) {        BSONElement memberElement = membersIterator.next();        if (memberElement.type() != Object) {            return Status(ErrorCodes::TypeMismatch,                          str::stream() << "Expected type of " << kMembersFieldName << "."                                        << memberElement.fieldName() << " to be Object, but found "                                        << typeName(memberElement.type()));        }        _members.resize(_members.size() + 1);        const auto& memberBSON = memberElement.Obj();        status = _members.back().initialize(memberBSON, &_tagConfig);        if (!status.isOK())            return Status(ErrorCodes::InvalidReplicaSetConfig,                          str::stream() << status.toString() << " for member:" << memberBSON);    }    //    // Parse configServer    //    status = bsonExtractBooleanFieldWithDefault(cfg, kConfigServerFieldName, false, &_configServer);    if (!status.isOK()) {        return status;    }    //    // Parse protocol version    //    status = bsonExtractIntegerField(cfg, kProtocolVersionFieldName, &_protocolVersion);    if (!status.isOK() && status != ErrorCodes::NoSuchKey) {        return status;    }    //    // Parse settings    //    BSONElement settingsElement;    status = bsonExtractTypedField(cfg, kSettingsFieldName, Object, &settingsElement);    BSONObj settings;    if (status.isOK()) {        settings = settingsElement.Obj();    } else if (status != ErrorCodes::NoSuchKey) {        return status;    }    status = _parseSettingsSubdocument(settings);    if (!status.isOK())        return status;    _calculateMajorities();    _addInternalWriteConcernModes();    _isInitialized = true;    return Status::OK();}
开发者ID:radik,项目名称:mongo,代码行数:82,


示例8: PreparedState

    Status ModifierInc::prepare(mutablebson::Element root,                                const StringData& matchedField,                                ExecInfo* execInfo) {        _preparedState.reset(new PreparedState(root.getDocument()));        // If we have a $-positional field, it is time to bind it to an actual field part.        if (_posDollar) {            if (matchedField.empty()) {                return Status(ErrorCodes::BadValue,                              str::stream() << "The positional operator did not find the match "                                               "needed from the query. Unexpanded update: "                                            << _fieldRef.dottedField());            }            _fieldRef.setPart(_posDollar, matchedField);        }        // Locate the field name in 'root'. Note that we may not have all the parts in the path        // in the doc -- which is fine. Our goal now is merely to reason about whether this mod        // apply is a noOp or whether is can be in place. The remaining path, if missing, will        // be created during the apply.        Status status = pathsupport::findLongestPrefix(_fieldRef,                                                       root,                                                       &_preparedState->idxFound,                                                       &_preparedState->elemFound);        // FindLongestPrefix may say the path does not exist at all, which is fine here, or        // that the path was not viable or otherwise wrong, in which case, the mod cannot        // proceed.        if (status.code() == ErrorCodes::NonExistentPath) {            _preparedState->elemFound = root.getDocument().end();        }        else if (!status.isOK()) {            return status;        }        // We register interest in the field name. The driver needs this info to sort out if        // there is any conflict among mods.        execInfo->fieldRef[0] = &_fieldRef;        // Capture the value we are going to write. At this point, there may not be a value        // against which to operate, so the result will be simply _val.        _preparedState->newValue = _val;        //        // in-place and no-op logic        //        // If the field path is not fully present, then this mod cannot be in place, nor is a        // noOp.        if (!_preparedState->elemFound.ok() ||            _preparedState->idxFound < (_fieldRef.numParts() - 1)) {            // For multiplication, we treat ops against missing as yielding zero. We take            // advantage here of the promotion rules for SafeNum; the expression below will            // always yield a zero of the same type of operand that the user provided            // (e.g. double).            if (_mode == MODE_MUL)                _preparedState->newValue *= SafeNum(static_cast<int>(0));            return Status::OK();        }        // If the value being $inc'ed is the same as the one already in the doc, than this is a        // noOp.        if (!_preparedState->elemFound.isNumeric()) {            mb::Element idElem = mb::findFirstChildNamed(root, "_id");            return Status(                ErrorCodes::BadValue,                str::stream() << "Cannot apply $inc to a value of non-numeric type. {"                              << idElem.toString()                              << "} has the field '" <<  _preparedState->elemFound.getFieldName()                              << "' of non-numeric type "                              << typeName(_preparedState->elemFound.getType()));        }        const SafeNum currentValue = _preparedState->elemFound.getValueSafeNum();        // Update newValue w.r.t to the current value of the found element.        if (_mode == MODE_INC)            _preparedState->newValue += currentValue;        else            _preparedState->newValue *= currentValue;        // If the result of the addition is invalid, we must return an error.        if (!_preparedState->newValue.isValid()) {            mb::Element idElem = mb::findFirstChildNamed(root, "_id");            return Status(ErrorCodes::BadValue,                          str::stream() << "Failed to apply $inc operations to current value ("                                        << currentValue.debugString() << ") for document {"                                        << idElem.toString() << "}");        }        // If the values are identical (same type, same value), then this is a no-op.        if (_preparedState->newValue.isIdentical(currentValue)) {            _preparedState->noOp = execInfo->noOp = true;            return Status::OK();        }        return Status::OK();    }
开发者ID:ViDA-NYU,项目名称:mongodb-vls,代码行数:99,


示例9: analyze

// read a file with queries// parse the queries// and output to file as well as stdoutvoid analyze(Indexed* indexed, std::string queryFilename, std::string outputFilename){    std::string line;  std::ifstream queryfile(queryFilename.c_str());    std::ofstream outputfile(outputFilename.c_str());  if (!outputfile.is_open()){    std::cout << "could not open output file/n";    return;  };      const Rows* rows = indexed->rows;      if (queryfile.is_open()){        // read all the lines    while ( getline (queryfile, line) ) {            Tokens t = tokenize(line);            bool valid = true;      if (t.size() < 3){        valid = false;      };            int colNum1 = 0;      int colType1 = 0;      int colNum2 = 0;            if (valid){                ColsByName::const_iterator colIt = rows->header.find(t[1]);        if (colIt == rows->header.end()){          std::cout << "column: " << t[1] << " not found!/n";          valid = false;                  }else{                    colNum2 = colIt->second.pos;                    if (!typeCanAggregate(colIt->second.type)){            std::cout << "can not perform: " << t[0] << " over " << t[1] << " of type " <<  typeName(colIt->second.type)  << "/n";            valid = false;                      };        };                colIt = rows->header.find(t[2]);        if (colIt == rows->header.end()){          std::cout << "column: " << t[2] << " not found!/n";          valid = false;                  }else{          colNum1 = colIt->second.pos;          colType1 = colIt->second.type;        };              };            if (valid){        // output to file and std out        std::cout  << t[0] << " " << t[1] << " GROUPED BY " << t[2] << "/n";        outputfile << t[0] << " " << t[1] << " GROUPED BY " << t[2] << "/n";                  if (t[0] == "AVG"){          doAvg(indexed, colNum1, colNum2, colType1, outputfile);                  }else if (t[0] == "MIN"){          doMin(indexed, colNum1, colNum2, colType1, outputfile);                  }else if (t[0] == "MAX"){          doMax(indexed, colNum1, colNum2, colType1, outputfile);                  }else{          std::cout << "unknown aggregate function: " << t[0] << "/n";                  };                // new line        std::cout  << "/n";        outputfile << "/n";              };                      };      };        outputfile.close();  };
开发者ID:soliton4,项目名称:datateam-test-1,代码行数:98,


示例10: name

QByteArray DwarfDie::typeName() const{    const auto n = name();    if (!n.isEmpty())        return n;    const auto typeDie = attribute(DW_AT_type).value<DwarfDie*>();    QByteArray typeName;    if (!typeDie) {        switch (tag()) {            case DW_TAG_class_type:                return "<anon class>";            case DW_TAG_enumeration_type:                return "<anon enum>";            case DW_TAG_structure_type:                return "<anon struct>";            case DW_TAG_union_type:                return "<anon union>";            case DW_TAG_namespace:                return "(anonymous namespace)";            case DW_TAG_array_type:            case DW_TAG_base_type:            case DW_TAG_const_type:            case DW_TAG_pointer_type:            case DW_TAG_ptr_to_member_type:            case DW_TAG_reference_type:            case DW_TAG_restrict_type:            case DW_TAG_rvalue_reference_type:            case DW_TAG_subroutine_type:            case DW_TAG_typedef:                typeName = "void";                break;            default:                return {};        }    } else {        typeName = typeDie->typeName();    }    // TODO: function pointers and pointer to members    switch (tag()) {        case DW_TAG_pointer_type:            return typeName + '*';        case DW_TAG_reference_type:            return typeName + '&';        case DW_TAG_rvalue_reference_type:            return typeName + "&&";        case DW_TAG_const_type:            return typeName + " const";        case DW_TAG_array_type:        {            const auto dims = arrayDimensions(this);            QByteArray n = typeName;            for (int d : dims)                n += '[' + QByteArray::number(d) + ']';            return n;        }        case DW_TAG_restrict_type:            return typeName + " restrcit";        case DW_TAG_volatile_type:            return typeName + " volatile";        case DW_TAG_subroutine_type:            return typeName + " (*)(" + argumentList(this).join(", ") + ')';        case DW_TAG_ptr_to_member_type:        {            const auto classDie = attribute(DW_AT_containing_type).value<DwarfDie*>();            QByteArray className;            if (classDie)                className = classDie->typeName();            return typeName + " (" + className + "::*)(" + argumentList(this).join(", ") + ')';        }    }    return typeName;}
开发者ID:KDE,项目名称:elf-dissector,代码行数:74,


示例11: documentElement

//.........这里部分代码省略.........		{			QDomElement el = list.item( 0 ).toElement();			el.setTagName( "automationpattern" );		}		list = elementsByTagName( "bbtrack" );		for( int i = 0; !list.item( i ).isNull(); ++i )		{			QDomElement el = list.item( i ).toElement();			QString s = el.attribute( "name" );			s.replace( QRegExp( "^Beat/Baseline " ),							"Beat/Bassline " );			el.setAttribute( "name", s );		}	}	if( version < "0.4.0-beta1" )	{		// convert binary effect-key-blobs to XML		QDomNodeList list;		list = elementsByTagName( "effect" );		for( int i = 0; !list.item( i ).isNull(); ++i )		{			QDomElement el = list.item( i ).toElement();			QString k = el.attribute( "key" );			if( !k.isEmpty() )			{				const QList<QVariant> l =					base64::decode( k, QVariant::List ).toList();				if( !l.isEmpty() )				{					QString name = l[0].toString();					QVariant u = l[1];					EffectKey::AttributeMap m;					// VST-effect?					if( u.type() == QVariant::String )					{						m["file"] = u.toString();					}					// LADSPA-effect?					else if( u.type() == QVariant::StringList )					{						const QStringList sl = u.toStringList();						m["plugin"] = sl.value( 0 );						m["file"] = sl.value( 1 );					}					EffectKey key( NULL, name, m );					el.appendChild( key.saveXML( *this ) );				}			}		}	}	if( version < "0.4.0-rc2" )	{		QDomNodeList list = elementsByTagName( "audiofileprocessor" );		for( int i = 0; !list.item( i ).isNull(); ++i )		{			QDomElement el = list.item( i ).toElement();			QString s = el.attribute( "src" );			s.replace( "drumsynth/misc ", "drumsynth/misc_" );			s.replace( "drumsynth/r&b", "drumsynth/r_n_b" );			s.replace( "drumsynth/r_b", "drumsynth/r_n_b" );			el.setAttribute( "src", s );		}		list = elementsByTagName( "lb302" );		for( int i = 0; !list.item( i ).isNull(); ++i )		{			QDomElement el = list.item( i ).toElement();			int s = el.attribute( "shape" ).toInt();			if( s >= 1 )			{				s--;			}			el.setAttribute( "shape", QString("%1").arg(s) );		}	}	// update document meta data	documentElement().setAttribute( "version", LDF_VERSION_STRING );	documentElement().setAttribute( "type", typeName( type() ) );	documentElement().setAttribute( "creator", "LMMS" );	documentElement().setAttribute( "creatorversion", LMMS_VERSION );	if( type() == SongProject || type() == SongProjectTemplate )	{		// Time-signature		if ( !m_head.hasAttribute( "timesig_numerator" ) )		{			m_head.setAttribute( "timesig_numerator", 4 );			m_head.setAttribute( "timesig_denominator", 4 );		}		if( !m_head.hasAttribute( "mastervol" ) )		{			m_head.setAttribute( "mastervol", 100 );		}	}//printf("%s/n", toString( 2 ).toUtf8().constData());}
开发者ID:bhattigurjot,项目名称:lmms,代码行数:101,


示例12: delay_error

ScriptValueP ScriptValue::getIndex(int index) const {	return delay_error(ScriptErrorNoMember(typeName(), String()<<index));}
开发者ID:Ehnonymoose,项目名称:MSE,代码行数:3,


示例13: bsonExtractStringField

StatusWith<ShardType> ShardType::fromBSON(const BSONObj& source) {    ShardType shard;    {        std::string shardName;        Status status = bsonExtractStringField(source, name.name(), &shardName);        if (!status.isOK())            return status;        shard._name = shardName;    }    {        std::string shardHost;        Status status = bsonExtractStringField(source, host.name(), &shardHost);        if (!status.isOK())            return status;        shard._host = shardHost;    }    {        bool isShardDraining;        Status status = bsonExtractBooleanField(source, draining.name(), &isShardDraining);        if (status.isOK()) {            shard._draining = isShardDraining;        } else if (status == ErrorCodes::NoSuchKey) {            // draining field can be mssing in which case it is presumed false        } else {            return status;        }    }    {        long long shardMaxSizeMB;        // maxSizeMB == 0 means there's no limitation to space usage.        Status status = bsonExtractIntegerField(source, maxSizeMB.name(), &shardMaxSizeMB);        if (status.isOK()) {            shard._maxSizeMB = shardMaxSizeMB;        } else if (status == ErrorCodes::NoSuchKey) {            // maxSizeMB field can be missing in which case it is presumed false        } else {            return status;        }    }    if (source.hasField(tags.name())) {        shard._tags = std::vector<std::string>();        BSONElement tagsElement;        Status status = bsonExtractTypedField(source, tags.name(), Array, &tagsElement);        if (!status.isOK())            return status;        BSONObjIterator it(tagsElement.Obj());        while (it.more()) {            BSONElement tagElement = it.next();            if (tagElement.type() != String) {                return Status(ErrorCodes::TypeMismatch,                              str::stream() << "Elements in /"" << tags.name()                                            << "/" array must be strings but found "                                            << typeName(tagElement.type()));            }            shard._tags->push_back(tagElement.String());        }    }    {        long long shardState;        Status status = bsonExtractIntegerField(source, state.name(), &shardState);        if (status.isOK()) {            // Make sure the state field falls within the valid range of ShardState values.            if (!(shardState >= static_cast<std::underlying_type<ShardState>::type>(                                    ShardState::kNotShardAware) &&                  shardState <= static_cast<std::underlying_type<ShardState>::type>(                                    ShardState::kShardAware))) {                return Status(ErrorCodes::BadValue,                              str::stream() << "Invalid shard state value: " << shardState);            } else {                shard._state = static_cast<ShardState>(shardState);            }        } else if (status == ErrorCodes::NoSuchKey) {            // state field can be mssing in which case it is presumed kNotShardAware        } else {            return status;        }    }    return shard;}
开发者ID:hanumantmk,项目名称:mongo,代码行数:87,


示例14: ctx

StatusWith<ParsedDistinct> ParsedDistinct::parse(OperationContext* opCtx,                                                 const NamespaceString& nss,                                                 const BSONObj& cmdObj,                                                 const ExtensionsCallback& extensionsCallback,                                                 bool isExplain,                                                 const CollatorInterface* defaultCollator) {    IDLParserErrorContext ctx("distinct");    DistinctCommand parsedDistinct(nss);    try {        parsedDistinct = DistinctCommand::parse(ctx, cmdObj);    } catch (...) {        return exceptionToStatus();    }    auto qr = stdx::make_unique<QueryRequest>(nss);    if (parsedDistinct.getKey().find('/0') != std::string::npos) {        return Status(ErrorCodes::Error(31032), "Key field cannot contain an embedded null byte");    }    // Create a projection on the fields needed by the distinct command, so that the query planner    // will produce a covered plan if possible.    qr->setProj(getDistinctProjection(std::string(parsedDistinct.getKey())));    if (auto query = parsedDistinct.getQuery()) {        qr->setFilter(query.get());    }    if (auto collation = parsedDistinct.getCollation()) {        qr->setCollation(collation.get());    }    if (auto comment = parsedDistinct.getComment()) {        qr->setComment(comment.get().toString());    }    // The IDL parser above does not handle generic command arguments. Since the underlying query    // request requires the following options, manually parse and verify them here.    if (auto readConcernElt = cmdObj[repl::ReadConcernArgs::kReadConcernFieldName]) {        if (readConcernElt.type() != BSONType::Object) {            return Status(ErrorCodes::TypeMismatch,                          str::stream() << "/"" << repl::ReadConcernArgs::kReadConcernFieldName                                        << "/" had the wrong type. Expected "                                        << typeName(BSONType::Object)                                        << ", found "                                        << typeName(readConcernElt.type()));        }        qr->setReadConcern(readConcernElt.embeddedObject());    }    if (auto queryOptionsElt = cmdObj[QueryRequest::kUnwrappedReadPrefField]) {        if (queryOptionsElt.type() != BSONType::Object) {            return Status(ErrorCodes::TypeMismatch,                          str::stream() << "/"" << QueryRequest::kUnwrappedReadPrefField                                        << "/" had the wrong type. Expected "                                        << typeName(BSONType::Object)                                        << ", found "                                        << typeName(queryOptionsElt.type()));        }        qr->setUnwrappedReadPref(queryOptionsElt.embeddedObject());    }    if (auto maxTimeMSElt = cmdObj[QueryRequest::cmdOptionMaxTimeMS]) {        auto maxTimeMS = QueryRequest::parseMaxTimeMS(maxTimeMSElt);        if (!maxTimeMS.isOK()) {            return maxTimeMS.getStatus();        }        qr->setMaxTimeMS(static_cast<unsigned int>(maxTimeMS.getValue()));    }    qr->setExplain(isExplain);    const boost::intrusive_ptr<ExpressionContext> expCtx;    auto cq = CanonicalQuery::canonicalize(opCtx,                                           std::move(qr),                                           expCtx,                                           extensionsCallback,                                           MatchExpressionParser::kAllowAllSpecialFeatures);    if (!cq.isOK()) {        return cq.getStatus();    }    if (cq.getValue()->getQueryRequest().getCollation().isEmpty() && defaultCollator) {        cq.getValue()->setCollator(defaultCollator->clone());    }    return ParsedDistinct(std::move(cq.getValue()), parsedDistinct.getKey().toString());}
开发者ID:jameswahlin,项目名称:mongo,代码行数:89,


示例15: tr

bool EnumTypeResolver::tryQualifiedEnumAssignment(const QmlIR::Object *obj, const QQmlPropertyCache *propertyCache, const QQmlPropertyData *prop, QmlIR::Binding *binding){    bool isIntProp = (prop->propType == QMetaType::Int) && !prop->isEnum();    if (!prop->isEnum() && !isIntProp)        return true;    if (!prop->isWritable() && !(binding->flags & QV4::CompiledData::Binding::InitializerForReadOnlyDeclaration)) {        compiler->recordError(binding->location, tr("Invalid property assignment: /"%1/" is a read-only property").arg(compiler->stringAt(binding->propertyNameIndex)));        return false;    }    Q_ASSERT(binding->type = QV4::CompiledData::Binding::Type_Script);    const QString string = compiler->bindingAsString(obj, binding->value.compiledScriptIndex);    if (!string.constData()->isUpper())        return true;    int dot = string.indexOf(QLatin1Char('.'));    if (dot == -1 || dot == string.length()-1)        return true;    if (string.indexOf(QLatin1Char('.'), dot+1) != -1)        return true;    QHashedStringRef typeName(string.constData(), dot);    QString enumValue = string.mid(dot+1);    if (isIntProp) {        // Allow enum assignment to ints.        bool ok;        int enumval = evaluateEnum(typeName.toString(), enumValue.toUtf8(), &ok);        if (ok) {            binding->type = QV4::CompiledData::Binding::Type_Number;            binding->value.d = (double)enumval;            binding->flags |= QV4::CompiledData::Binding::IsResolvedEnum;        }        return true;    }    QQmlType *type = 0;    imports->resolveType(typeName, &type, 0, 0, 0);    if (!type && typeName != QLatin1String("Qt"))        return true;    if (type && type->isComposite()) //No enums on composite (or composite singleton) types        return true;    int value = 0;    bool ok = false;    QQmlCompiledData::TypeReference *tr = resolvedTypes->value(obj->inheritedTypeNameIndex);    if (type && tr && tr->type == type) {        QMetaProperty mprop = propertyCache->firstCppMetaObject()->property(prop->coreIndex);        // When these two match, we can short cut the search        if (mprop.isFlagType()) {            value = mprop.enumerator().keysToValue(enumValue.toUtf8().constData(), &ok);        } else {            value = mprop.enumerator().keyToValue(enumValue.toUtf8().constData(), &ok);        }    } else {        // Otherwise we have to search the whole type        if (type) {            value = type->enumValue(QHashedStringRef(enumValue), &ok);        } else {            QByteArray enumName = enumValue.toUtf8();            const QMetaObject *metaObject = StaticQtMetaObject::get();            for (int ii = metaObject->enumeratorCount() - 1; !ok && ii >= 0; --ii) {                QMetaEnum e = metaObject->enumerator(ii);                value = e.keyToValue(enumName.constData(), &ok);            }        }    }    if (!ok)        return true;    binding->type = QV4::CompiledData::Binding::Type_Number;    binding->value.d = (double)value;    binding->flags |= QV4::CompiledData::Binding::IsResolvedEnum;    return true;}
开发者ID:ElderOrb,项目名称:qmlc,代码行数:80,


示例16: QgsVectorDataProvider

QgsMemoryProvider::QgsMemoryProvider( const QString &uri, const ProviderOptions &options )  : QgsVectorDataProvider( uri, options ){  // Initialize the geometry with the uri to support old style uri's  // (ie, just 'point', 'line', 'polygon')  QUrl url = QUrl::fromEncoded( uri.toUtf8() );  QString geometry;  if ( url.hasQueryItem( QStringLiteral( "geometry" ) ) )  {    geometry = url.queryItemValue( QStringLiteral( "geometry" ) );  }  else  {    geometry = url.path();  }  if ( geometry.toLower() == QLatin1String( "none" ) )  {    mWkbType = QgsWkbTypes::NoGeometry;  }  else  {    mWkbType = QgsWkbTypes::parseType( geometry );  }  if ( url.hasQueryItem( QStringLiteral( "crs" ) ) )  {    QString crsDef = url.queryItemValue( QStringLiteral( "crs" ) );    mCrs.createFromString( crsDef );  }  mNextFeatureId = 1;  setNativeTypes( QList< NativeType >()                  << QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), QStringLiteral( "integer" ), QVariant::Int, 0, 10 )                  // Decimal number from OGR/Shapefile/dbf may come with length up to 32 and                  // precision up to length-2 = 30 (default, if width is not specified in dbf is length = 24 precision = 15)                  // We know that double (QVariant::Double) has only 15-16 significant numbers,                  // but setting that correct limits would disable the use of memory provider with                  // data from Shapefiles. In any case, the data are handled as doubles.                  // So the limits set here are not correct but enable use of data from Shapefiles.                  << QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), QStringLiteral( "double" ), QVariant::Double, 0, 32, 0, 30 )                  << QgsVectorDataProvider::NativeType( tr( "Text (string)" ), QStringLiteral( "string" ), QVariant::String, 0, 255 )                  // date type                  << QgsVectorDataProvider::NativeType( tr( "Date" ), QStringLiteral( "date" ), QVariant::Date, -1, -1, -1, -1 )                  << QgsVectorDataProvider::NativeType( tr( "Time" ), QStringLiteral( "time" ), QVariant::Time, -1, -1, -1, -1 )                  << QgsVectorDataProvider::NativeType( tr( "Date & Time" ), QStringLiteral( "datetime" ), QVariant::DateTime, -1, -1, -1, -1 )                  // integer types                  << QgsVectorDataProvider::NativeType( tr( "Whole number (smallint - 16bit)" ), QStringLiteral( "int2" ), QVariant::Int, -1, -1, 0, 0 )                  << QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 32bit)" ), QStringLiteral( "int4" ), QVariant::Int, -1, -1, 0, 0 )                  << QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 64bit)" ), QStringLiteral( "int8" ), QVariant::LongLong, -1, -1, 0, 0 )                  << QgsVectorDataProvider::NativeType( tr( "Decimal number (numeric)" ), QStringLiteral( "numeric" ), QVariant::Double, 1, 20, 0, 20 )                  << QgsVectorDataProvider::NativeType( tr( "Decimal number (decimal)" ), QStringLiteral( "decimal" ), QVariant::Double, 1, 20, 0, 20 )                  // floating point                  << QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), QStringLiteral( "real" ), QVariant::Double, -1, -1, -1, -1 )                  << QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), QStringLiteral( "double precision" ), QVariant::Double, -1, -1, -1, -1 )                  // string types                  << QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), QStringLiteral( "text" ), QVariant::String, -1, -1, -1, -1 )                );  if ( url.hasQueryItem( QStringLiteral( "field" ) ) )  {    QList<QgsField> attributes;    QRegExp reFieldDef( "//:"                        "(int|integer|long|int8|real|double|string|date|time|datetime)" // type                        "(?://((//-?//d+)"                // length                        "(?://,(//d+))?"                  // precision                        "//))?(//[//])?"                  // array                        "$", Qt::CaseInsensitive );    QStringList fields = url.allQueryItemValues( QStringLiteral( "field" ) );    for ( int i = 0; i < fields.size(); i++ )    {      QString name = QUrl::fromPercentEncoding( fields.at( i ).toUtf8() );      QVariant::Type type = QVariant::String;      QVariant::Type subType = QVariant::Invalid;      QString typeName( QStringLiteral( "string" ) );      int length = 255;      int precision = 0;      int pos = reFieldDef.indexIn( name );      if ( pos >= 0 )      {        name = name.mid( 0, pos );        typeName = reFieldDef.cap( 1 ).toLower();        if ( typeName == QLatin1String( "int" ) || typeName == QLatin1String( "integer" ) )        {          type = QVariant::Int;          typeName = QStringLiteral( "integer" );          length = -1;        }        else if ( typeName == QLatin1String( "int8" ) || typeName == QLatin1String( "long" ) )        {          type = QVariant::LongLong;          typeName = QStringLiteral( "int8" );          length = -1;        }//.........这里部分代码省略.........
开发者ID:lyhkop,项目名称:QGIS,代码行数:101,


示例17: YSON_THROW

 bool JsonValue::value(uint64_t& value) const {     YSON_THROW("Unsupported function for values of type " + typeName()); }
开发者ID:jebreimo,项目名称:Yson,代码行数:4,


示例18: typeName

GUCEF::GUI::CWidget*CFormBackendImp::CreateAndHookWrapperForWindow( CEGUI::Window* window ){GUCEF_TRACE;    GUCEF::GUI::CWidget* widgetWrapper = NULL;    CString typeName( CString( window->getType().c_str() ).SubstrToChar( '/', false ) );        //if ( "Button" == typeName )    //{    //    widgetWrapper = new CButtonImp();    //    static_cast< CButtonImp* >( widgetWrapper )->Hook( static_cast< CEGUI::PushButton* >( window ) );    //}    //else    //if ( "Editbox" == typeName )    //{    //    widgetWrapper = new CEditboxImp();    //    static_cast< CEditboxImp* >( widgetWrapper )->Hook( static_cast< CEGUI::Editbox* >( window ) );            //}    //else    //if ( "Listbox" == typeName )    //{    //    widgetWrapper = new CListboxImp();    //    static_cast< CListboxImp* >( widgetWrapper )->Hook( static_cast< CEGUI::Listbox* >( window ) );            //}    //else    //if ( "StaticImage" == typeName )    //{    //    CString widgetName( CString( window->getName().c_str() ).SubstrToChar( '/', false ) );    //        //    if ( widgetName == "RenderContext" )    //    {    //        widgetWrapper = new CRenderContextImp();    //        static_cast< CRenderContextImp* >( widgetWrapper )->Hook( window );    //    }    //    else    //    {    //        widgetWrapper = new CImageFrameImp();    //        static_cast< CImageFrameImp* >( widgetWrapper )->Hook( window );    //    }    //}    //else        //if ( "StaticText" == typeName )    //{    //    widgetWrapper = new CLabelImp();    //    static_cast< CLabelImp* >( widgetWrapper )->Hook( window );    //}        //else        //if ( "Checkbox" == typeName )    //{    //    widgetWrapper = new CCheckboxImp();    //    static_cast< CCheckboxImp* >( widgetWrapper )->Hook( static_cast< CEGUI::Checkbox* >( window ) );            //}    //else        //if ( "Combobox" == typeName )    //{    //    widgetWrapper = new CComboboxImp();    //    static_cast< CComboboxImp* >( widgetWrapper )->Hook( static_cast< CEGUI::Combobox* >( window ) );            //}    //if ( "TabControl" == typeName )    //{    //    widgetWrapper = new CTabControlImp();    //    static_cast< CTabControlImp* >( widgetWrapper )->Hook( static_cast< CEGUI::TabControl* >( window ) );            //}            //else    //if ( "TabContentPane" == typeName )    //{    //    widgetWrapper = new CTabContentPaneImp();    //    static_cast< CTabContentPaneImp* >( widgetWrapper )->Hook( window );            //}            //else            if ( "FrameWindow" == typeName )    {        widgetWrapper = new CWindowImp();        static_cast< CWindowImp* >( widgetWrapper )->Hook( static_cast< CEGUI::FrameWindow* >( window ) );            }    //else            //if ( "MultiColumnList" == typeName )    //{    //    widgetWrapper = new CGridViewImp();    //    static_cast< CGridViewImp* >( widgetWrapper )->Hook( static_cast< CEGUI::MultiColumnList* >( window ) );            //}    //else            //if ( "Spinner" == typeName )    //{    //    widgetWrapper = new CSpinnerImp();    //    static_cast< CSpinnerImp* >( widgetWrapper )->Hook( static_cast< CEGUI::Spinner* >( window ) );            //}            //else    //if ( "DefaultWindow" == typeName )    //{    //    widgetWrapper = new TBasicWidgetImp();    //    static_cast< TBasicWidgetImp* >( widgetWrapper )->Hook( window );    //}        GUCEF_DEBUG_LOG( 0, "Wrapped and hooked GUI widget for CEGUI widget of type " + typeName );    return widgetWrapper;}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:97,


示例19: colorName

QString Piece::name() const {  QString res = colorName() + '_';  if (m_promoted)    res += "p_";  return res + typeName();}
开发者ID:Axure,项目名称:tagua,代码行数:6,


示例20: QgsVectorDataProvider

QgsMemoryProvider::QgsMemoryProvider( const QString& uri )    : QgsVectorDataProvider( uri )    , mSpatialIndex( nullptr ){  // Initialize the geometry with the uri to support old style uri's  // (ie, just 'point', 'line', 'polygon')  QUrl url = QUrl::fromEncoded( uri.toUtf8() );  QString geometry;  if ( url.hasQueryItem( "geometry" ) )  {    geometry = url.queryItemValue( "geometry" );  }  else  {    geometry = url.path();  }  geometry = geometry.toLower();  if ( geometry == "point" )    mWkbType = QGis::WKBPoint;  else if ( geometry == "linestring" )    mWkbType = QGis::WKBLineString;  else if ( geometry == "polygon" )    mWkbType = QGis::WKBPolygon;  else if ( geometry == "multipoint" )    mWkbType = QGis::WKBMultiPoint;  else if ( geometry == "multilinestring" )    mWkbType = QGis::WKBMultiLineString;  else if ( geometry == "multipolygon" )    mWkbType = QGis::WKBMultiPolygon;  else if ( geometry == "none" )    mWkbType = QGis::WKBNoGeometry;  else    mWkbType = QGis::WKBUnknown;  if ( url.hasQueryItem( "crs" ) )  {    QString crsDef = url.queryItemValue( "crs" );    mCrs.createFromString( crsDef );  }  mNextFeatureId = 1;  mNativeTypes  << QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), "integer", QVariant::Int, 0, 10 )  // Decimal number from OGR/Shapefile/dbf may come with length up to 32 and  // precision up to length-2 = 30 (default, if width is not specified in dbf is length = 24 precision = 15)  // We know that double (QVariant::Double) has only 15-16 significant numbers,  // but setting that correct limits would disable the use of memory provider with  // data from Shapefiles. In any case, the data are handled as doubles.  // So the limits set here are not correct but enable use of data from Shapefiles.  << QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "double", QVariant::Double, 0, 32, 0, 30 )  << QgsVectorDataProvider::NativeType( tr( "Text (string)" ), "string", QVariant::String, 0, 255 )  // date type  << QgsVectorDataProvider::NativeType( tr( "Date" ), "date", QVariant::Date, -1, -1, -1, -1 )  << QgsVectorDataProvider::NativeType( tr( "Time" ), "time", QVariant::Time, -1, -1, -1, -1 )  << QgsVectorDataProvider::NativeType( tr( "Date & Time" ), "datetime", QVariant::DateTime, -1, -1, -1, -1 )  // integer types  << QgsVectorDataProvider::NativeType( tr( "Whole number (smallint - 16bit)" ), "int2", QVariant::Int, -1, -1, 0, 0 )  << QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 32bit)" ), "int4", QVariant::Int, -1, -1, 0, 0 )  << QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 64bit)" ), "int8", QVariant::LongLong, -1, -1, 0, 0 )  << QgsVectorDataProvider::NativeType( tr( "Decimal number (numeric)" ), "numeric", QVariant::Double, 1, 20, 0, 20 )  << QgsVectorDataProvider::NativeType( tr( "Decimal number (decimal)" ), "decimal", QVariant::Double, 1, 20, 0, 20 )  // floating point  << QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "real", QVariant::Double, -1, -1, -1, -1 )  << QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "double precision", QVariant::Double, -1, -1, -1, -1 )  // string types  << QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), "text", QVariant::String, -1, -1, -1, -1 )  ;  if ( url.hasQueryItem( "field" ) )  {    QList<QgsField> attributes;    QRegExp reFieldDef( "//:"                        "(int|integer|long|int8|real|double|string|date|time|datetime)" // type                        "(?://((//-?//d+)"                // length                        "(?://,(//d+))?"                // precision                        "//))?"                        "$", Qt::CaseInsensitive );    QStringList fields = url.allQueryItemValues( "field" );    for ( int i = 0; i < fields.size(); i++ )    {      QString name = fields.at( i );      QVariant::Type type = QVariant::String;      QString typeName( "string" );      int length = 255;      int precision = 0;      int pos = reFieldDef.indexIn( name );      if ( pos >= 0 )      {        name = name.mid( 0, pos );        typeName = reFieldDef.cap( 1 ).toLower();        if ( typeName == "int" || typeName == "integer" )        {          type = QVariant::Int;//.........这里部分代码省略.........
开发者ID:vfp1,项目名称:QGIS,代码行数:101,


示例21: bsonCheckOnlyHasFields

    Status MemberConfig::initialize(const BSONObj& mcfg, ReplicaSetTagConfig* tagConfig) {        Status status = bsonCheckOnlyHasFields(            "replica set member configuration", mcfg, kLegalMemberConfigFieldNames);        if (!status.isOK())            return status;        //        // Parse _id field.        //        BSONElement idElement = mcfg[kIdFieldName];        if (idElement.eoo()) {            return Status(ErrorCodes::NoSuchKey, str::stream() << kIdFieldName <<                          " field is missing");        }        if (!idElement.isNumber()) {            return Status(ErrorCodes::TypeMismatch, str::stream() << kIdFieldName <<                          " field has non-numeric type " << typeName(idElement.type()));        }        _id = idElement.numberInt();        //        // Parse h field.        //        std::string hostAndPortString;        status = bsonExtractStringField(mcfg, kHostFieldName, &hostAndPortString);        if (!status.isOK())            return status;        boost::trim(hostAndPortString);        status = _host.initialize(hostAndPortString);        if (!status.isOK())            return status;        if (!_host.hasPort()) {            // make port explicit even if default.            _host = HostAndPort(_host.host(), _host.port());        }        //        // Parse votes field.        //        BSONElement votesElement = mcfg[kVotesFieldName];        int votes;        if (votesElement.eoo()) {            votes = kVotesFieldDefault;        }        else if (votesElement.isNumber()) {            votes = votesElement.numberInt();        }        else {            return Status(ErrorCodes::TypeMismatch, str::stream() << kVotesFieldName <<                          " field value has non-numeric type " <<                          typeName(votesElement.type()));        }        if (votes != 0 && votes != 1) {            return Status(ErrorCodes::BadValue, str::stream() << kVotesFieldName <<                          " field value is " << votesElement.numberInt() << " but must be 0 or 1");        }        _isVoter = bool(votes);        //        // Parse priority field.        //        BSONElement priorityElement = mcfg[kPriorityFieldName];        if (priorityElement.eoo()) {            _priority = kPriorityFieldDefault;        }        else if (priorityElement.isNumber()) {            _priority = priorityElement.numberDouble();        }        else {            return Status(ErrorCodes::TypeMismatch, str::stream() << kPriorityFieldName <<                          " field has non-numeric type " << typeName(priorityElement.type()));        }        //        // Parse arbiterOnly field.        //        status = bsonExtractBooleanFieldWithDefault(mcfg,                                                    kArbiterOnlyFieldName,                                                    kArbiterOnlyFieldDefault,                                                    &_arbiterOnly);        if (!status.isOK())            return status;        //        // Parse slaveDelay field.        //        BSONElement slaveDelayElement = mcfg[kSlaveDelayFieldName];        if (slaveDelayElement.eoo()) {            _slaveDelay = kSlaveDelayFieldDefault;        }        else if (slaveDelayElement.isNumber()) {            _slaveDelay = Seconds(slaveDelayElement.numberInt());        }        else {            return Status(ErrorCodes::TypeMismatch, str::stream() << kSlaveDelayFieldName <<                          " field value has non-numeric type " <<                          typeName(slaveDelayElement.type()));        }        ////.........这里部分代码省略.........
开发者ID:ANTco,项目名称:mongo,代码行数:101,


示例22:

 void Opcode8032::_run() {     auto num = _script->dataStack()->popInteger();     auto value = _script->dataStack()->values()->at(_script->DVARbase() + num);     _script->dataStack()->push(value);     Logger::debug("SCRIPT") << "[8032] [*] op_fetch " << "var" << std::hex << num << " type = " << value.typeName() << std::endl; }
开发者ID:CynicRus,项目名称:falltergeist,代码行数:7,



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


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