Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | List of all members
skia_private::THashMap< K, V, HashK > Class Template Reference

#include <SkTHash.h>

Classes

struct  Pair
 

Public Types

using Iter = typename THashTable< Pair, K >::template Iter< std::pair< K, V > >
 

Public Member Functions

 THashMap ()=default
 
 THashMap (THashMap< K, V, HashK > &&that)=default
 
 THashMap (const THashMap< K, V, HashK > &that)=default
 
THashMap< K, V, HashK > & operator= (THashMap< K, V, HashK > &&that)=default
 
THashMap< K, V, HashK > & operator= (const THashMap< K, V, HashK > &that)=default
 
 THashMap (std::initializer_list< Pair > pairs)
 
void reset ()
 
int count () const
 
bool empty () const
 
size_t approxBytesUsed () const
 
void swap (THashMap &that)
 
void swap (THashMap &&that)
 
Vset (K key, V val)
 
Vfind (const K &key) const
 
Voperator[] (const K &key)
 
void remove (const K &key)
 
bool removeIfExists (const K &key)
 
template<typename Fn , std::enable_if_t< std::is_invocable_v< Fn, K, V * > > * = nullptr>
void foreach (Fn &&fn)
 
template<typename Fn , std::enable_if_t< std::is_invocable_v< Fn, K, V > > * = nullptr>
void foreach (Fn &&fn) const
 
template<typename Fn , std::enable_if_t< std::is_invocable_v< Fn, Pair > > * = nullptr>
void foreach (Fn &&fn) const
 
Iter begin () const
 
Iter end () const
 

Detailed Description

template<typename K, typename V, typename HashK = SkGoodHash>
class skia_private::THashMap< K, V, HashK >

Definition at line 442 of file SkTHash.h.

Member Typedef Documentation

◆ Iter

template<typename K , typename V , typename HashK = SkGoodHash>
using skia_private::THashMap< K, V, HashK >::Iter = typename THashTable<Pair, K>::template Iter<std::pair<K, V> >

Definition at line 540 of file SkTHash.h.

Constructor & Destructor Documentation

◆ THashMap() [1/4]

template<typename K , typename V , typename HashK = SkGoodHash>
skia_private::THashMap< K, V, HashK >::THashMap ( )
default

◆ THashMap() [2/4]

template<typename K , typename V , typename HashK = SkGoodHash>
skia_private::THashMap< K, V, HashK >::THashMap ( THashMap< K, V, HashK > &&  that)
default

◆ THashMap() [3/4]

template<typename K , typename V , typename HashK = SkGoodHash>
skia_private::THashMap< K, V, HashK >::THashMap ( const THashMap< K, V, HashK > &  that)
default

◆ THashMap() [4/4]

template<typename K , typename V , typename HashK = SkGoodHash>
skia_private::THashMap< K, V, HashK >::THashMap ( std::initializer_list< Pair pairs)
inline

Definition at line 460 of file SkTHash.h.

460 {
461 fTable.resize(pairs.size() * 5 / 3);
462 for (const Pair& p : pairs) {
463 fTable.set(p);
464 }
465 }

Member Function Documentation

◆ approxBytesUsed()

template<typename K , typename V , typename HashK = SkGoodHash>
size_t skia_private::THashMap< K, V, HashK >::approxBytesUsed ( ) const
inline

Definition at line 477 of file SkTHash.h.

477{ return fTable.approxBytesUsed(); }

◆ begin()

template<typename K , typename V , typename HashK = SkGoodHash>
Iter skia_private::THashMap< K, V, HashK >::begin ( ) const
inline

Definition at line 542 of file SkTHash.h.

542 {
543 return Iter::MakeBegin(&fTable);
544 }

◆ count()

template<typename K , typename V , typename HashK = SkGoodHash>
int skia_private::THashMap< K, V, HashK >::count ( ) const
inline

Definition at line 471 of file SkTHash.h.

471{ return fTable.count(); }

◆ empty()

template<typename K , typename V , typename HashK = SkGoodHash>
bool skia_private::THashMap< K, V, HashK >::empty ( ) const
inline

Definition at line 474 of file SkTHash.h.

474{ return fTable.count() == 0; }

◆ end()

template<typename K , typename V , typename HashK = SkGoodHash>
Iter skia_private::THashMap< K, V, HashK >::end ( ) const
inline

Definition at line 546 of file SkTHash.h.

546 {
547 return Iter::MakeEnd(&fTable);
548 }

◆ find()

template<typename K , typename V , typename HashK = SkGoodHash>
V * skia_private::THashMap< K, V, HashK >::find ( const K key) const
inline

Definition at line 494 of file SkTHash.h.

494 {
495 if (Pair* p = fTable.find(key)) {
496 return &p->second;
497 }
498 return nullptr;
499 }

◆ foreach() [1/3]

template<typename K , typename V , typename HashK = SkGoodHash>
template<typename Fn , std::enable_if_t< std::is_invocable_v< Fn, K, V * > > * = nullptr>
void skia_private::THashMap< K, V, HashK >::foreach ( Fn &&  fn)
inline

Definition at line 521 of file SkTHash.h.

521 {
522 fTable.foreach([&fn](Pair* p) { fn(p->first, &p->second); });
523 }

◆ foreach() [2/3]

template<typename K , typename V , typename HashK = SkGoodHash>
template<typename Fn , std::enable_if_t< std::is_invocable_v< Fn, K, V > > * = nullptr>
void skia_private::THashMap< K, V, HashK >::foreach ( Fn &&  fn) const
inline

Definition at line 528 of file SkTHash.h.

528 {
529 fTable.foreach([&fn](const Pair& p) { fn(p.first, p.second); });
530 }

◆ foreach() [3/3]

template<typename K , typename V , typename HashK = SkGoodHash>
template<typename Fn , std::enable_if_t< std::is_invocable_v< Fn, Pair > > * = nullptr>
void skia_private::THashMap< K, V, HashK >::foreach ( Fn &&  fn) const
inline

Definition at line 535 of file SkTHash.h.

535 {
536 fTable.foreach([&fn](const Pair& p) { fn(p); });
537 }

◆ operator=() [1/2]

template<typename K , typename V , typename HashK = SkGoodHash>
THashMap< K, V, HashK > & skia_private::THashMap< K, V, HashK >::operator= ( const THashMap< K, V, HashK > &  that)
default

◆ operator=() [2/2]

template<typename K , typename V , typename HashK = SkGoodHash>
THashMap< K, V, HashK > & skia_private::THashMap< K, V, HashK >::operator= ( THashMap< K, V, HashK > &&  that)
default

◆ operator[]()

template<typename K , typename V , typename HashK = SkGoodHash>
V & skia_private::THashMap< K, V, HashK >::operator[] ( const K key)
inline

Definition at line 501 of file SkTHash.h.

501 {
502 if (V* val = this->find(key)) {
503 return *val;
504 }
505 return *this->set(key, V{});
506 }
V * find(const K &key) const
Definition: SkTHash.h:494
V * set(K key, V val)
Definition: SkTHash.h:487
T __attribute__((ext_vector_type(N))) V

◆ remove()

template<typename K , typename V , typename HashK = SkGoodHash>
void skia_private::THashMap< K, V, HashK >::remove ( const K key)
inline

Definition at line 509 of file SkTHash.h.

509 {
510 fTable.remove(key);
511 }

◆ removeIfExists()

template<typename K , typename V , typename HashK = SkGoodHash>
bool skia_private::THashMap< K, V, HashK >::removeIfExists ( const K key)
inline

Definition at line 514 of file SkTHash.h.

514 {
515 return fTable.removeIfExists(key);
516 }

◆ reset()

template<typename K , typename V , typename HashK = SkGoodHash>
void skia_private::THashMap< K, V, HashK >::reset ( )
inline

Definition at line 468 of file SkTHash.h.

468{ fTable.reset(); }

◆ set()

template<typename K , typename V , typename HashK = SkGoodHash>
V * skia_private::THashMap< K, V, HashK >::set ( K  key,
V  val 
)
inline

Definition at line 487 of file SkTHash.h.

487 {
488 Pair* out = fTable.set({std::move(key), std::move(val)});
489 return &out->second;
490 }

◆ swap() [1/2]

template<typename K , typename V , typename HashK = SkGoodHash>
void skia_private::THashMap< K, V, HashK >::swap ( THashMap< K, V, HashK > &&  that)
inline

Definition at line 481 of file SkTHash.h.

481{ fTable.swap(std::move(that.fTable)); }

◆ swap() [2/2]

template<typename K , typename V , typename HashK = SkGoodHash>
void skia_private::THashMap< K, V, HashK >::swap ( THashMap< K, V, HashK > &  that)
inline

Definition at line 480 of file SkTHash.h.

480{ fTable.swap(that.fTable); }

The documentation for this class was generated from the following file: