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


C++ AttributeMap::contains方法代码示例

本文整理汇总了C++中AttributeMap::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeMap::contains方法的具体用法?C++ AttributeMap::contains怎么用?C++ AttributeMap::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AttributeMap的用法示例。


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

示例1: writePreserving

	void writePreserving(QFile& inFile, QTextStream& out, const AttributeMap& data)
	{
		FNTRACE("ini", "", "writePreserving", QString("in, out, %1 rows of data").arg(data.size()));

		int i, j;
		QChar c;
		QString name;
		size_t lineNumber = 0;
		QString line;
		typedef QSet<AttributeMap::key_type> KeySet;
		KeySet unwrittenKeys = KeySet::fromList(data.keys());

		if (!inFile.open(QIODevice::ReadOnly | QIODevice::Text))
			ETHROW(Exception(QString("Unable to open %1 for reading.").arg(inFile.fileName())));
		QTextStream in(&inFile);

		while (!(line = in.readLine()).isNull())
		{
			++lineNumber;
			//std::cout << lineNumber << ": " << line.toStdString() << ":\n";

			for (i = 0; line[i].isSpace(); ++i) { out << line[i]; }

			if (line[i].isNull()) { out << '\n'; continue; }
			else if (line[i] == COMMENT_BEGIN) { out << line.mid(i) << '\n'; continue; }

			for (j = i; !(c = line[i]).isNull() && c!=COMMENT_BEGIN && c!=ASSIGNER; ++i) ;
			//std::cout << "non-empty, ";
			if (c != ASSIGNER) // non-empty line that isn't assignment -> invalid
				ETHROW(ParseError(inFile.fileName(), lineNumber, "Unknown non-empty line."));
			for (--i; line[i].isSpace(); --i) ; // last character of name
			name = line.mid(j, i - j + 1);
			//std::cout << "name: " << name.toStdString() << ' ';

			for ( ; line[j]!=ASSIGNER; ++j) out << line[j];
			out << ASSIGNER;
			i = j + 1;

			for ( ; line[i].isSpace(); ++i) out << line[i];

			if (data.contains(name))
			{
				//std::cout << "known ";
				out << data.value(name);
				unwrittenKeys.remove(name);
				for (j = i; !line[i].isNull() && line[i]!=COMMENT_BEGIN; ++i) ; // EOL || comment
				for (--i; line[i].isSpace(); --i) ; // last character of value
				++i; // first character after value
			}

			out << line.mid(i) << '\n';
			//std::cout << '\n';
		}

		if (unwrittenKeys.size())
		{
			out << '\n' << COMMENT_BEGIN << "Following lines were generated by Ds1edit Loader:\n";
			for (KeySet::iterator key = unwrittenKeys.begin();
				key != unwrittenKeys.end(); ++key)
				out << (*key) << ' ' << ASSIGNER << ' ' << data.value(*key) << '\n';
		}

		//in.resize(in.pos()+1);
		inFile.close();
	}
开发者ID:devnev,项目名称:ds1edit-loader,代码行数:65,代码来源:iniparser.cpp

示例2: ValidateCreateImageKHR


//.........这里部分代码省略.........

        case EGL_GL_TEXTURE_3D_KHR:
        {
            if (!displayExtensions.glTexture3DImage)
            {
                return Error(EGL_BAD_PARAMETER, "KHR_gl_texture_3D_image not supported.");
            }

            if (buffer == 0)
            {
                return Error(EGL_BAD_PARAMETER,
                             "buffer cannot reference a 3D texture with the name 0.");
            }

            const gl::Texture *texture =
                context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
            if (texture == nullptr || texture->getTarget() != GL_TEXTURE_3D)
            {
                return Error(EGL_BAD_PARAMETER, "target is not a 3D texture.");
            }

            if (texture->getBoundSurface() != nullptr)
            {
                return Error(EGL_BAD_ACCESS, "texture has a surface bound to it.");
            }

            EGLint level   = attributes.get(EGL_GL_TEXTURE_LEVEL_KHR, 0);
            EGLint zOffset = attributes.get(EGL_GL_TEXTURE_ZOFFSET_KHR, 0);
            if (texture->getWidth(GL_TEXTURE_3D, static_cast<size_t>(level)) == 0 ||
                texture->getHeight(GL_TEXTURE_3D, static_cast<size_t>(level)) == 0 ||
                texture->getDepth(GL_TEXTURE_3D, static_cast<size_t>(level)) == 0)
            {
                return Error(EGL_BAD_PARAMETER,
                             "target 3D texture does not have a valid size at specified level.");
            }

            if (static_cast<size_t>(zOffset) >=
                texture->getDepth(GL_TEXTURE_3D, static_cast<size_t>(level)))
            {
                return Error(EGL_BAD_PARAMETER,
                             "target 3D texture does not have enough layers for the specified Z "
                             "offset at the specified level.");
            }

            if (level > 0 && (!texture->isMipmapComplete() ||
                              static_cast<size_t>(level) >= texture->getMipCompleteLevels()))
            {
                return Error(EGL_BAD_PARAMETER, "texture must be complete if level is non-zero.");
            }

            if (level == 0 && !texture->isMipmapComplete() &&
                TextureHasNonZeroMipLevelsSpecified(context, texture))
            {
                return Error(EGL_BAD_PARAMETER,
                             "if level is zero and the texture is incomplete, it must have no mip "
                             "levels specified except zero.");
            }
        }
        break;

        case EGL_GL_RENDERBUFFER_KHR:
        {
            if (!displayExtensions.glRenderbufferImage)
            {
                return Error(EGL_BAD_PARAMETER, "KHR_gl_renderbuffer_image not supported.");
            }

            if (attributes.contains(EGL_GL_TEXTURE_LEVEL_KHR))
            {
                return Error(EGL_BAD_PARAMETER,
                             "EGL_GL_TEXTURE_LEVEL_KHR cannot be used in conjunction with a "
                             "renderbuffer target.");
            }

            if (buffer == 0)
            {
                return Error(EGL_BAD_PARAMETER,
                             "buffer cannot reference a renderbuffer with the name 0.");
            }

            const gl::Renderbuffer *renderbuffer =
                context->getRenderbuffer(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
            if (renderbuffer == nullptr)
            {
                return Error(EGL_BAD_PARAMETER, "target is not a renderbuffer.");
            }

            if (renderbuffer->getSamples() > 0)
            {
                return Error(EGL_BAD_PARAMETER, "target renderbuffer cannot be multisampled.");
            }
        }
        break;

        default:
            return Error(EGL_BAD_PARAMETER, "invalid target: 0x%X", target);
    }

    return Error(EGL_SUCCESS);
}
开发者ID:bsergean,项目名称:angle,代码行数:101,代码来源:validationEGL.cpp

示例3: basePathSymbian

bool WidgetRegistrationS60::registerAppL(const QString& appId,
                                         const QString& appTitle,
                                         const QString& appPath,
                                         const QString& dataPath,
                                         const QString& iconPath,
                                         const AttributeMap& attr,
                                         const QString& type,
                                         unsigned long size,
                                         const QString& startPath,
                                         int& widgetUid,
                                         QString& convertedIconPath,
                                         bool hideIcon)
{
    LOG("WidgetRegistrationS60::registerAppL()" << " appId : " << appId << " appTitle : " << 
            appTitle << " appPath : " << appPath << " iconPath : " << iconPath << " startPath : " << 
            startPath);

    if (appId.isEmpty() || appTitle.isEmpty() || appPath.isEmpty())
        return false;

    // S60 requires widgetProps as CWidgetPropertyValue
    RPointerArray<CWidgetPropertyValue> propertyValues(EWidgetPropertyIdCount);
    CleanupStack::PushL(TCleanupItem(PointerArrayCleanup, &propertyValues)); // pushed 1

    RWidgetRegistryClientSession registryClient;
    User::LeaveIfError(registryClient.Connect());
    CleanupClosePushL( registryClient ); // pushed 2

    RFs rfs;
    User::LeaveIfError(rfs.Connect());
    CleanupClosePushL(rfs); // pushed 3
    User::LeaveIfError(rfs.ShareProtected());

    // empty values
    for (TInt i = 0; i < EWidgetPropertyIdCount; ++i) {
        CWidgetPropertyValue* value = CWidgetPropertyValue::NewL();
        CleanupStack::PushL(value); // pushed 4
        propertyValues.AppendL(value);
        CleanupStack::Pop(value); // pushed 3
    }

    *(propertyValues[EWidgetPropertyListVersion]) = KWidgetPropertyListVersion71CWRT;
    *(propertyValues[EFileSize]) = size;

    SwiUI::CWidgetRegistrationS60Apparc* appArc = SwiUI::CWidgetRegistrationS60Apparc::NewL(rfs);
    CleanupStack::PushL(appArc); // pushed 4

    // get drive letter from appPath
    TUint driveLetter = appPath[0].unicode();

    // Generate our UID based on UIDs in the Qt WidgetRegistry
    int iUid = WebAppRegistry::instance()->nextAvailableUid();
    widgetUid = iUid;

    if (iUid == 0) {
        LOG("WidgetRegistrationS60::registerAppL() - registryClient.GetAvailableUidL() failed");
        CleanupStack::PopAndDestroy( 4, &propertyValues );
        return false;
    }

    // convert icon to required format and sizes
    QString newIconPath = "";
    if (!processIconL(iUid, newIconPath, iconPath, QDir::toNativeSeparators(dataPath))) {
        LOG("WidgetRegistrationS60::registerAppL() - processIconL() failed");
        CleanupStack::PopAndDestroy( 4, &propertyValues );
        return false;
        }

    // FIXME this translation doesn't cover all cases, if generalized
    // must cover S60 WRT names and W3C names
    QString appPathNative = QDir::toNativeSeparators(appPath);
    // FIXME enforce canonicalization in caller
    // must end in QDir::separator()
    if (QDir::separator() != appPathNative.at(appPathNative.count()-1)) {
        appPathNative.append(QDir::separator());
    }
    TPtrC16 basePathSymbian(reinterpret_cast<const TUint16*>
                            (appPathNative.constData()));
    *(propertyValues[EBasePath]) = basePathSymbian;

    QString driveName = appPathNative.left(2);
    TPtrC16 driveNameSymbian(reinterpret_cast<const TUint16*>
                             (driveName.constData()));
    *(propertyValues[EDriveName]) = driveNameSymbian;

    TPtrC16 mainHtmlSymbian(reinterpret_cast<const TUint16*>
                            (startPath.constData()));
    *(propertyValues[EMainHTML]) = mainHtmlSymbian;

    TPtrC16 identifierSymbian(reinterpret_cast<const TUint16*>
                              (appId.constData()));
    *(propertyValues[EBundleIdentifier]) = identifierSymbian;

    if (attr.contains(W3CSettingsKey::WIDGET_VERSION)) {
        QString ver = attr.value(W3CSettingsKey::WIDGET_VERSION).toString();
        if(!(ver.isEmpty())) {
            TPtrC16 version(reinterpret_cast<const TUint16*>
                            (attr.value(W3CSettingsKey::WIDGET_VERSION).toString().constData()));
            *(propertyValues[EBundleVersion]) = version;
        }
//.........这里部分代码省略.........
开发者ID:vivekgalatage,项目名称:widgetmanager,代码行数:101,代码来源:WidgetRegistrationS60.cpp


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