⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qmap.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 4 页
字号:
    Two maps are considered equal if they contain the same (key,    value) pairs.    This function requires the value type to implement \c    operator==().    \sa operator!=()*//*! \fn bool QMap::operator!=(const QMap<Key, T> &other) const    Returns true if \a other is not equal to this map; otherwise    returns false.    Two maps are considered equal if they contain the same (key,    value) pairs.    This function requires the value type to implement \c    operator==().    \sa operator==()*//*! \fn int QMap::size() const    Returns the number of (key, value) pairs in the map.    \sa isEmpty(), count()*//*!     \fn bool QMap::isEmpty() const    Returns true if the map contains no items; otherwise returns    false.    \sa size()*//*! \fn void QMap::detach()    \internal    Detaches this map from any other maps with which it may share    data.    \sa isDetached()*//*! \fn bool QMap::isDetached() const    \internal    Returns true if the map's internal data isn't shared with any    other map object; otherwise returns false.    \sa detach()*//*! \fn void QMap::setSharable(bool sharable)    \internal*//*! \fn void QMap::setInsertInOrder(bool sharable)    \internal*//*! \fn void QMap::clear()    Removes all items from the map.    \sa remove()*//*! \fn int QMap::remove(const Key &key)    Removes all the items that have the key \a key from the map.    Returns the number of items removed which is usually 1 but will be    0 if the key isn't in the map, or \> 1 if insertMulti() has been    used with the \a key.    \sa clear(), take(), QMultiMap::remove()*//*! \fn T QMap::take(const Key &key)    Removes the item with the key \a key from the map and returns    the value associated with it.    If the item does not exist in the map, the function simply    returns a \l{default-constructed value}. If there are multiple    items for \a key in the map, only the most recently inserted one    is removed and returned.    If you don't use the return value, remove() is more efficient.    \sa remove()*//*! \fn bool QMap::contains(const Key &key) const    Returns true if the map contains an item with key \a key;    otherwise returns false.    \sa count(), QMultiMap::contains()*//*! \fn const T QMap::value(const Key &key) const    Returns the value associated with the key \a key.    If the map contains no item with key \a key, the function    returns a \l{default-constructed value}. If there are multiple    items for \a key in the map, the value of the most recently    inserted one is returned.    \sa key(), values(), contains(), operator[]()*//*! \fn const T QMap::value(const Key &key, const T &defaultValue) const    \overload    If the map contains no item with key \a key, the function returns    \a defaultValue.*//*! \fn T &QMap::operator[](const Key &key)    Returns the value associated with the key \a key as a modifiable    reference.    If the map contains no item with key \a key, the function inserts    a \l{default-constructed value} into the map with key \a key, and    returns a reference to it. If the map contains multiple items    with key \a key, this function returns a reference to the most    recently inserted value.    \sa insert(), value()*//*! \fn const T QMap::operator[](const Key &key) const    \overload    Same as value().*//*! \fn QList<Key> QMap::uniqueKeys() const    \since 4.2    Returns a list containing all the keys in the map in ascending    order. Keys that occur multiple times in the map (because items    were inserted with insertMulti(), or unite() was used) occur only    once in the returned list.    \sa keys(), values()*//*! \fn QList<Key> QMap::keys() const    Returns a list containing all the keys in the map in ascending    order. Keys that occur multiple times in the map (because items    were inserted with insertMulti(), or unite() was used) also    occur multiple times in the list.    To obtain a list of unique keys, where each key from the map only    occurs once, use uniqueKeys().    The order is guaranteed to be the same as that used by values().    \sa uniqueKeys(), values(), key()*//*! \fn QList<Key> QMap::keys(const T &value) const    \overload    Returns a list containing all the keys associated with value \a    value in ascending order.    This function can be slow (\l{linear time}), because QMap's    internal data structure is optimized for fast lookup by key, not    by value.*//*! \fn Key QMap::key(const T &value) const    Returns the first key with value \a value.    If the map contains no item with value \a value, the function    returns a \link {default-constructed value} default-constructed    key \endlink.    This function can be slow (\l{linear time}), because QMap's    internal data structure is optimized for fast lookup by key, not    by value.    \sa value(), keys()*//*!     \fn Key QMap::key(const T &value, const Key &defaultKey) const    \since 4.3    \overload    Returns the first key with value \a value, or \a defaultKey if    the map contains no item with value \a value.    This function can be slow (\l{linear time}), because QMap's    internal data structure is optimized for fast lookup by key, not    by value.*//*! \fn QList<T> QMap::values() const    Returns a list containing all the values in the map, in ascending    order of their keys. If a key is associated with multiple values,    all of its values will be in the list, and not just the most    recently inserted one.    \sa keys(), value()*//*! \fn QList<T> QMap::values(const Key &key) const    \overload    Returns a list containing all the values associated with key    \a key, from the most recently inserted to the least recently    inserted one.    \sa count(), insertMulti()*//*! \fn int QMap::count(const Key &key) const    Returns the number of items associated with key \a key.    \sa contains(), insertMulti(), QMultiMap::count()*//*! \fn int QMap::count() const    \overload    Same as size().*//*! \fn QMap::iterator QMap::begin()    Returns an \l{STL-style iterator} pointing to the first item in    the map.    \sa constBegin(), end()*//*! \fn QMap::const_iterator QMap::begin() const    \overload*//*! \fn QMap::const_iterator QMap::constBegin() const    Returns a const \l{STL-style iterator} pointing to the first item    in the map.    \sa begin(), constEnd()*//*! \fn QMap::iterator QMap::end()    Returns an \l{STL-style iterator} pointing to the imaginary item    after the last item in the map.    \sa begin(), constEnd()*//*! \fn QMap::const_iterator QMap::end() const    \overload*//*! \fn QMap::const_iterator QMap::constEnd() const    Returns a const \l{STL-style iterator} pointing to the imaginary    item after the last item in the map.    \sa constBegin(), end()*//*! \fn QMap::iterator QMap::erase(iterator pos)    Removes the (key, value) pair pointed to by the iterator \a pos    from the map, and returns an iterator to the next item in the    map.    \sa remove()*//*! \fn QMap::iterator QMap::find(const Key &key)    Returns an iterator pointing to the item with key \a key in the    map.    If the map contains no item with key \a key, the function    returns end().    If the map contains multiple items with key \a key, this    function returns an iterator that points to the most recently    inserted value. The other values are accessible by incrementing    the iterator. For example, here's some code that iterates over all    the items with the same key:    \code        QMap<QString, int> map;        ...        QMap<QString, int>::const_iterator i = map.find("HDR");        while (i != map.end() && i.key() == "HDR") {            cout << i.value() << endl;            ++i;        }    \endcode    \sa constFind(), value(), values(), lowerBound(), upperBound(), QMultiMap::find()*//*! \fn QMap::const_iterator QMap::find(const Key &key) const    \overload*//*! \fn QMap::iterator QMap::constFind(const Key &key) const    \since 4.1    Returns an const iterator pointing to the item with key \a key in the    map.    If the map contains no item with key \a key, the function    returns constEnd().    \sa find(), QMultiMap::constFind()*//*! \fn QMap::iterator QMap::lowerBound(const Key &key)    Returns an iterator pointing to the first item with key \a key in    the map. If the map contains no item with key \a key, the    function returns an iterator to the nearest item with a greater    key.    Example:    \code        QMap<int, QString> map;        map.insert(1, "one");        map.insert(5, "five");        map.insert(10, "ten");        map.lowerBound(0);      // returns iterator to (1, "one")        map.lowerBound(1);      // returns iterator to (1, "one")        map.lowerBound(2);      // returns iterator to (5, "five")        map.lowerBound(10);     // returns iterator to (10, "ten")        map.lowerBound(999);    // returns end()    \endcode    If the map contains multiple items with key \a key, this    function returns an iterator that points to the most recently    inserted value. The other values are accessible by incrementing    the iterator. For example, here's some code that iterates over all    the items with the same key:    \code        QMap<QString, int> map;        ...        QMap<QString, int>::const_iterator i = map.lowerBound("HDR");        QMap<QString, int>::const_iterator upperBound = map.upperBound("HDR");        while (i != upperBound) {            cout << i.value() << endl;            ++i;        }    \endcode    \sa qLowerBound(), upperBound(), find()*//*! \fn QMap::const_iterator QMap::lowerBound(const Key &key) const    \overload*//*! \fn QMap::iterator QMap::upperBound(const Key &key)    Returns an iterator pointing to the item that immediately follows    the last item with key \a key in the map. If the map contains no    item with key \a key, the function returns an iterator to the    nearest item with a greater key.    Example:    \code        QMap<int, QString> map;        map.insert(1, "one");        map.insert(5, "five");        map.insert(10, "ten");        map.upperBound(0);      // returns iterator to (1, "one")        map.upperBound(1);      // returns iterator to (5, "five")        map.upperBound(2);      // returns iterator to (5, "five")        map.upperBound(10);     // returns end()        map.upperBound(999);    // returns end()    \endcode    \sa qUpperBound(), lowerBound(), find()*//*! \fn QMap::const_iterator QMap::upperBound(const Key &key) const    \overload*//*! \fn QMap::iterator QMap::insert(const Key &key, const T &value)    Inserts a new item with the key \a key and a value of \a value.    If there is already an item with the key \a key, that item's value    is replaced with \a value.    If there are multiple items with the key \a key, the most    recently inserted item's value is replaced with \a value.    \sa insertMulti()*//*! \fn QMap::iterator QMap::insertMulti(const Key &key, const T &value)    Inserts a new item with the key \a key and a value of \a value.    If there is already an item with the same key in the map, this    function will simply create a new one. (This behavior is    different from insert(), which overwrites the value of an

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -