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


C++ Sequence::count方法代码示例

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


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

示例1: tst_serviceClassUuids

void tst_QBluetoothServiceInfo::tst_serviceClassUuids()
{
    QBluetoothServiceInfo info;
    QCOMPARE(info.serviceClassUuids().count(), 0);

    QBluetoothServiceInfo::Sequence classIds;
    classIds << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
    QCOMPARE(classIds.count(), 1);

    QBluetoothUuid uuid(QString("e8e10f95-1a70-4b27-9ccf-02010264e9c8"));
    classIds.prepend(QVariant::fromValue(uuid));
    QCOMPARE(classIds.count(), 2);
    QCOMPARE(classIds.at(0).value<QBluetoothUuid>(), uuid);

    info.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classIds);
    QList<QBluetoothUuid> svclids = info.serviceClassUuids();
    QCOMPARE(svclids.count(), 2);
    QCOMPARE(svclids.at(0), uuid);
    QCOMPARE(svclids.at(1), QBluetoothUuid(QBluetoothUuid::SerialPort));
}
开发者ID:OniLink,项目名称:Qt5-Rehost,代码行数:20,代码来源:tst_qbluetoothserviceinfo.cpp

示例2: protocolServiceMultiplexer

/*!
    This is a convenience function. Returns the protocol/service multiplexer for services which
    support the L2CAP protocol, otherwise returns -1.

    This function is equivalent to extracting the information from
    QBluetoothServiceInfo::Sequence returned by
    QBluetoothServiceInfo::attribute(QBluetoothServiceInfo::ProtocolDescriptorList).
*/
int QBluetoothServiceInfo::protocolServiceMultiplexer() const
{
    QBluetoothServiceInfo::Sequence parameters = protocolDescriptor(QBluetoothUuid::L2cap);

    if (parameters.isEmpty())
        return -1;
    else if (parameters.count() == 1)
        return 0;
    else
        return parameters.at(1).toUInt();
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例3: attribute

/*!
    Returns a list of UUIDs describing the service classes that this service conforms to.

    This is a convenience function. It is equivalent to calling
    attribute(QBluetoothServiceInfo::ServiceClassIds).value<QBluetoothServiceInfo::Sequence>()
    and subsequently iterating over its QBluetoothUuid entries.

    \sa attribute()
*/
QList<QBluetoothUuid> QBluetoothServiceInfo::serviceClassUuids() const
{
    QList<QBluetoothUuid> results;

    const QVariant var = attribute(QBluetoothServiceInfo::ServiceClassIds);
    if (!var.isValid())
        return results;

    const QBluetoothServiceInfo::Sequence seq = var.value<QBluetoothServiceInfo::Sequence>();
    for (int i = 0; i < seq.count(); i++)
        results.append(seq.at(i).value<QBluetoothUuid>());

    return results;
}
开发者ID:,项目名称:,代码行数:23,代码来源:


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