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

📄 qmap.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 4 页
字号:
    \sa value()*//*! \fn const T &QMap::const_iterator::value() const    Returns the current item's value.    \sa key(), operator*()*//*! \fn const T &QMap::const_iterator::operator*() const    Returns the current item's value.    Same as value().    \sa key()*//*! \fn const T *QMap::const_iterator::operator->() const    Returns a pointer to the current item's value.    \sa value()*//*! \fn bool QMap::const_iterator::operator==(const const_iterator &other) const    Returns true if \a other points to the same item as this    iterator; otherwise returns false.    \sa operator!=()*//*! \fn bool QMap::const_iterator::operator!=(const const_iterator &other) const    Returns true if \a other points to a different item than this    iterator; otherwise returns false.    \sa operator==()*//*! \fn QMap::const_iterator QMap::const_iterator::operator++()    The prefix ++ operator (\c{++i}) advances the iterator to the    next item in the map and returns an iterator to the new current    item.    Calling this function on QMap::end() leads to undefined results.    \sa operator--()*//*! \fn QMap::const_iterator QMap::const_iterator::operator++(int)    \overload    The postfix ++ operator (\c{i++}) advances the iterator to the    next item in the map and returns an iterator to the previously    current item.*//*! \fn QMap::const_iterator &QMap::const_iterator::operator--()    The prefix -- operator (\c{--i}) makes the preceding item    current and returns an iterator pointing to the new current item.    Calling this function on QMap::begin() leads to undefined    results.    \sa operator++()*//*! \fn QMap::const_iterator QMap::const_iterator::operator--(int)    \overload    The postfix -- operator (\c{i--}) makes the preceding item    current and returns an iterator pointing to the previously    current item.*//*! \fn QMap::const_iterator QMap::const_iterator::operator+(int j) const    Returns an iterator to the item at \a j positions forward from    this iterator. (If \a j is negative, the iterator goes backward.)    This operation can be slow for large \a j values.    \sa operator-()*//*! \fn QMap::const_iterator QMap::const_iterator::operator-(int j) const    Returns an iterator to the item at \a j positions backward from    this iterator. (If \a j is negative, the iterator goes forward.)    This operation can be slow for large \a j values.    \sa operator+()*//*! \fn QMap::const_iterator &QMap::const_iterator::operator+=(int j)    Advances the iterator by \a j items. (If \a j is negative, the    iterator goes backward.)    This operation can be slow for large \a j values.    \sa operator-=(), operator+()*//*! \fn QMap::const_iterator &QMap::const_iterator::operator-=(int j)    Makes the iterator go back by \a j items. (If \a j is negative,    the iterator goes forward.)    This operation can be slow for large \a j values.    \sa operator+=(), operator-()*//*! \fn QDataStream &operator<<(QDataStream &out, const QMap<Key, T> &map)    \relates QMap    Writes the map \a map to stream \a out.    This function requires the key and value types to implement \c    operator<<().    \sa \link datastreamformat.html Format of the QDataStream operators \endlink*//*! \fn QDataStream &operator>>(QDataStream &in, QMap<Key, T> &map)    \relates QMap    Reads a map from stream \a in into \a map.    This function requires the key and value types to implement \c    operator>>().    \sa \link datastreamformat.html Format of the QDataStream operators \endlink*//*! \class QMultiMap    \brief The QMultiMap class is a convenience QMap subclass that provides multi-valued maps.    \ingroup tools    \ingroup shared    \mainclass    \reentrant    QMultiMap\<Key, T\> is one of Qt's generic \l{container classes}.    It inherits QMap and extends it with a few convenience functions    that make it more suitable than QMap for storing multi-valued    maps. A multi-valued map is a map that allows multiple values    with the same key; QMap normally doesn't allow that, unless you    call QMap::insertMulti().    Because QMultiMap inherits QMap, all of QMap's functionality also    applies to QMultiMap. For example, you can use isEmpty() to test    whether the map is empty, and you can traverse a QMultiMap using    QMap's iterator classes (for example, QMapIterator). But in    addition, it provides an insert() function that corresponds to    QMap::insertMulti(), and a replace() function that corresponds to    QMap::insert(). It also provides convenient operator+() and    operator+=().    Example:    \code        QMultiMap<QString, int> map1, map2, map3;        map1.insert("plenty", 100);        map1.insert("plenty", 2000);        // map1.size() == 2        map2.insert("plenty", 5000);        // map2.size() == 1        map3 = map1 + map2;        // map3.size() == 3    \endcode    Unlike QMap, QMultiMap provides no operator[]. Use value() or    replace() if you want to access the most recently inserted item    with a certain key.    If you want to retrieve all the values for a single key, you can    use values(const Key &key), which returns a QList<T>:    \code        QList<int> values = map.values("plenty");        for (int i = 0; i < values.size(); ++i)            cout << values.at(i) << endl;    \endcode    The items that share the same key are available from most    recently to least recently inserted.    If you prefer the STL-style iterators, you can call find() to get    the iterator for the first item with a key and iterate from    there:    \code        QMultiMap<QString, int>::iterator i = map.find("plenty");        while (i != map.end() && i.key() == "plenty") {            cout << i.value() << endl;            ++i;        }    \endcode    QMultiMap's key and value data types must be \l{assignable data    types}. This covers most data types you are likely to encounter,    but the compiler won't let you, for example, store a QWidget as a    value; instead, store a QWidget *. In addition, QMultiMap's key type    must provide operator<(). See the QMap documentation for details.    \sa QMap, QMapIterator, QMutableMapIterator, QMultiHash*//*! \fn QMultiMap::QMultiMap()    Constructs an empty map.*//*! \fn QMultiMap::QMultiMap(const QMap<Key, T> &other)    Constructs a copy of \a other (which can be a QMap or a    QMultiMap).    \sa operator=()*//*! \fn QMultiMap::iterator QMultiMap::replace(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 insert()*//*! \fn QMultiMap::iterator QMultiMap::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 same key in the map, this    function will simply create a new one. (This behavior is    different from replace(), which overwrites the value of an    existing item.)    \sa replace()*//*! \fn QMultiMap &QMultiMap::operator+=(const QMultiMap &other)    Inserts all the items in the \a other map into this map and    returns a reference to this map.    \sa insert(), operator+()*//*! \fn QMultiMap QMultiMap::operator+(const QMultiMap &other) const    Returns a map that contains all the items in this map in    addition to all the items in \a other. If a key is common to both    maps, the resulting map will contain the key multiple times.    \sa operator+=()*//*!    \fn bool QMultiMap::contains(const Key &key, const T &value) const    \since 4.3    Returns true if the map contains an item with key \a key and    value \a value; otherwise returns false.    \sa QMap::contains()*//*!    \fn bool QMultiMap::contains(const Key &key) const    \overload    \sa QMap::contains()*//*!    \fn int QMultiMap::remove(const Key &key, const T &value)    \since 4.3    Removes all the items that have the key \a key and the value \a    value from the map. Returns the number of items removed.    \sa QMap::remove()*//*!    \fn int QMultiMap::remove(const Key &key)    \overload    \sa QMap::remove()*//*!    \fn int QMultiMap::count(const Key &key, const T &value) const    \since 4.3    Returns the number of items with key \a key and value \a value.    \sa QMap::count()*//*!    \fn int QMultiMap::count(const Key &key) const    \overload    \sa QMap::count()*//*!    \fn int QMultiMap::count() const    \overload    \sa QMap::count()*//*!    \fn typename QMap<Key, T>::iterator QMultiMap::find(const Key &key, const T &value)    \since 4.3    Returns an iterator pointing to the item with key \a key and    value \a value in the map.    If the map contains no such item, 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.    \sa QMap::find()*//*!    \fn typename QMap<Key, T>::iterator QMultiMap::find(const Key &key)    \overload    \sa QMap::find()*//*!    \fn typename QMap<Key, T>::const_iterator QMultiMap::find(const Key &key, const T &value) const    \since 4.3    \overload    Returns a const iterator pointing to the item with the given \a key and    \a value in the map.    If the map contains no such item, the function returns end().    If the map contains multiple items with the specified \a key, this    function returns a const iterator that points to the most recently    inserted value.    \sa QMap::find()*//*!    \fn typename QMap<Key, T>::const_iterator QMultiMap::find(const Key &key) const    \since 4.3    \overload    \sa QMap::find()*//*!    \fn typename QMap<Key, T>::const_iterator QMultiMap::constFind(const Key &key, const T &value) const    \since 4.3    Returns an iterator pointing to the item with key \a key and the    value \a value in the map.    If the map contains no such item, the function returns    constEnd().    \sa QMap::constFind()*//*!    \fn typename QMap<Key, T>::const_iterator QMultiMap::constFind(const Key &key) const    \overload    \sa QMap::constFind()*//*!    \fn T &QMap::iterator::data() const    Use value() instead.*//*!    \fn const T &QMap::const_iterator::data() const    Use value() instead.*//*!    \fn iterator QMap::remove(iterator it)    Use erase(\a it) instead.*//*!    \fn void QMap::erase(const Key &key)    Use remove(\a key) instead.*//*!    \fn iterator QMap::insert(const Key &key, const T &value, bool overwrite);    Use the two-argument insert() overload instead. If you don't want    to overwrite, call contains() beforehand.    \oldcode        QMap<QString, int> map;        ...        map.insert("delay", 30000, false);    \newcode        QMap<QString, int> map;        ...        if (!map.contains("delay"))            map.insert("delay", 30000);    \endcode*//*!    \fn iterator QMap::replace(const Key &key, const T &value)    Use remove() then insert().*/

⌨️ 快捷键说明

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