ReactOS  0.4.12-dev-36-g472787f
ATL::CSimpleMap< TKey, TVal, TEqual > Class Template Reference

#include <atlsimpcoll.h>

Collaboration diagram for ATL::CSimpleMap< TKey, TVal, TEqual >:

Classes

struct  Pair
 

Public Types

typedef TKey _ArrayKeyType
 
typedef TVal _ArrayElementType
 

Public Member Functions

 CSimpleMap ()
 
 ~CSimpleMap ()
 
BOOL Add (const TKey &key, const TVal &val)
 
int FindKey (const TKey &key) const
 
int FindVal (const TVal &val) const
 
TKey & GetKeyAt (int nIndex)
 
const TKey & GetKeyAt (int nIndex) const
 
int GetSize () const
 
TVal & GetValueAt (int nIndex)
 
const TVal & GetValueAt (int nIndex) const
 
TVal Lookup (const TKey &key) const
 
BOOL Remove (const TKey &key)
 
void RemoveAll ()
 
BOOL RemoveAt (int nIndex)
 
TKey ReverseLookup (const TVal &val) const
 
BOOL SetAt (const TKey &key, const TVal &val)
 
BOOL SetAtIndex (int nIndex, const TKey &key, const TVal &val)
 

Protected Attributes

CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
 

Detailed Description

template<typename TKey, typename TVal, typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
class ATL::CSimpleMap< TKey, TVal, TEqual >

Definition at line 295 of file atlsimpcoll.h.

Member Typedef Documentation

◆ _ArrayElementType

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
typedef TVal ATL::CSimpleMap< TKey, TVal, TEqual >::_ArrayElementType

Definition at line 299 of file atlsimpcoll.h.

◆ _ArrayKeyType

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
typedef TKey ATL::CSimpleMap< TKey, TVal, TEqual >::_ArrayKeyType

Definition at line 298 of file atlsimpcoll.h.

Constructor & Destructor Documentation

◆ CSimpleMap()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
ATL::CSimpleMap< TKey, TVal, TEqual >::CSimpleMap ( )
inline

Definition at line 301 of file atlsimpcoll.h.

302  {
303  }

◆ ~CSimpleMap()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
ATL::CSimpleMap< TKey, TVal, TEqual >::~CSimpleMap ( )
inline

Definition at line 305 of file atlsimpcoll.h.

306  {
307  }

Member Function Documentation

◆ Add()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
BOOL ATL::CSimpleMap< TKey, TVal, TEqual >::Add ( const TKey &  key,
const TVal &  val 
)
inline

Definition at line 309 of file atlsimpcoll.h.

310  {
311  Pair pair(key, val);
312  return m_Pairs.Add(pair);
313  }
GLuint GLfloat * val
Definition: glext.h:7180
struct _pair * pair
Definition: _pair.h:47
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449
Definition: path.c:42

◆ FindKey()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
int ATL::CSimpleMap< TKey, TVal, TEqual >::FindKey ( const TKey &  key) const
inline

Definition at line 315 of file atlsimpcoll.h.

316  {
317  const int nCount = GetSize();
318  for (int nIndex = 0; nIndex < nCount; ++nIndex)
319  {
320  if (TEqual::IsEqualKey(m_Pairs[nIndex].key, key))
321  {
322  return nIndex; // success
323  }
324  }
325  return -1; // failure
326  }
int GetSize() const
Definition: atlsimpcoll.h:353
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449
Definition: path.c:42

◆ FindVal()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
int ATL::CSimpleMap< TKey, TVal, TEqual >::FindVal ( const TVal &  val) const
inline

Definition at line 328 of file atlsimpcoll.h.

329  {
330  const int nCount = GetSize();
331  for (int nIndex = 0; nIndex < nCount; ++nIndex)
332  {
333  if (TEqual::IsEqualValue(m_Pairs[nIndex].val, val))
334  {
335  return nIndex; // success
336  }
337  }
338  return -1; // failure
339  }
int GetSize() const
Definition: atlsimpcoll.h:353
GLuint GLfloat * val
Definition: glext.h:7180
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449

◆ GetKeyAt() [1/2]

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
TKey& ATL::CSimpleMap< TKey, TVal, TEqual >::GetKeyAt ( int  nIndex)
inline

Definition at line 341 of file atlsimpcoll.h.

342  {
343  ATLASSERT(0 <= nIndex && nIndex < GetSize());
344  return m_Pairs[nIndex].key;
345  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
int GetSize() const
Definition: atlsimpcoll.h:353
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449

◆ GetKeyAt() [2/2]

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
const TKey& ATL::CSimpleMap< TKey, TVal, TEqual >::GetKeyAt ( int  nIndex) const
inline

Definition at line 347 of file atlsimpcoll.h.

348  {
349  ATLASSERT(0 <= nIndex && nIndex < GetSize());
350  return m_Pairs[nIndex].key;
351  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
int GetSize() const
Definition: atlsimpcoll.h:353
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449

◆ GetSize()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
int ATL::CSimpleMap< TKey, TVal, TEqual >::GetSize ( void  ) const
inline

Definition at line 353 of file atlsimpcoll.h.

354  {
355  return m_Pairs.GetSize();
356  }
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449

◆ GetValueAt() [1/2]

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
TVal& ATL::CSimpleMap< TKey, TVal, TEqual >::GetValueAt ( int  nIndex)
inline

Definition at line 358 of file atlsimpcoll.h.

359  {
360  ATLASSERT(0 <= nIndex && nIndex < GetSize());
361  return m_Pairs[nIndex].val;
362  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
int GetSize() const
Definition: atlsimpcoll.h:353
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449

◆ GetValueAt() [2/2]

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
const TVal& ATL::CSimpleMap< TKey, TVal, TEqual >::GetValueAt ( int  nIndex) const
inline

Definition at line 364 of file atlsimpcoll.h.

365  {
366  ATLASSERT(0 <= nIndex && nIndex < GetSize());
367  return m_Pairs[nIndex].val;
368  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
int GetSize() const
Definition: atlsimpcoll.h:353
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449

◆ Lookup()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
TVal ATL::CSimpleMap< TKey, TVal, TEqual >::Lookup ( const TKey &  key) const
inline

Definition at line 370 of file atlsimpcoll.h.

371  {
372  int nIndex = FindKey(key);
373  if (nIndex < 0)
374  return TVal();
375  return m_Pairs[nIndex].val;
376  }
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449
int FindKey(const TKey &key) const
Definition: atlsimpcoll.h:315
Definition: path.c:42

◆ Remove()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
BOOL ATL::CSimpleMap< TKey, TVal, TEqual >::Remove ( const TKey &  key)
inline

Definition at line 378 of file atlsimpcoll.h.

379  {
380  int nIndex = FindKey(key);
381  return RemoveAt(nIndex);
382  }
int nIndex
Definition: msvc.h:77
int FindKey(const TKey &key) const
Definition: atlsimpcoll.h:315
BOOL RemoveAt(int nIndex)
Definition: atlsimpcoll.h:389
Definition: path.c:42

◆ RemoveAll()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
void ATL::CSimpleMap< TKey, TVal, TEqual >::RemoveAll ( )
inline

Definition at line 384 of file atlsimpcoll.h.

385  {
386  m_Pairs.RemoveAll();
387  }
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449

◆ RemoveAt()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
BOOL ATL::CSimpleMap< TKey, TVal, TEqual >::RemoveAt ( int  nIndex)
inline

Definition at line 389 of file atlsimpcoll.h.

390  {
391  return m_Pairs.RemoveAt(nIndex);
392  }
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449

◆ ReverseLookup()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
TKey ATL::CSimpleMap< TKey, TVal, TEqual >::ReverseLookup ( const TVal &  val) const
inline

Definition at line 394 of file atlsimpcoll.h.

395  {
396  int nIndex = FindVal(val);
397  if (nIndex < 0)
398  return TKey();
399  return m_Pairs[nIndex].key;
400  }
int FindVal(const TVal &val) const
Definition: atlsimpcoll.h:328
GLuint GLfloat * val
Definition: glext.h:7180
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449

◆ SetAt()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
BOOL ATL::CSimpleMap< TKey, TVal, TEqual >::SetAt ( const TKey &  key,
const TVal &  val 
)
inline

Definition at line 402 of file atlsimpcoll.h.

403  {
404  int nIndex = FindKey(key);
405  if (nIndex < 0)
406  return Add(key, val);
407 
408  m_Pairs[nIndex].val = val;
409  return TRUE;
410  }
#define TRUE
Definition: types.h:120
GLuint GLfloat * val
Definition: glext.h:7180
BOOL Add(const TKey &key, const TVal &val)
Definition: atlsimpcoll.h:309
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449
int FindKey(const TKey &key) const
Definition: atlsimpcoll.h:315
Definition: path.c:42

◆ SetAtIndex()

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
BOOL ATL::CSimpleMap< TKey, TVal, TEqual >::SetAtIndex ( int  nIndex,
const TKey &  key,
const TVal &  val 
)
inline

Definition at line 412 of file atlsimpcoll.h.

413  {
414  // boundary check
415  if (nIndex < 0 || GetSize() <= nIndex)
416  return FALSE;
417 
418  m_Pairs[nIndex].key = key;
419  m_Pairs[nIndex].val = val;
420  return TRUE;
421  }
#define TRUE
Definition: types.h:120
int GetSize() const
Definition: atlsimpcoll.h:353
GLuint GLfloat * val
Definition: glext.h:7180
HKEY key
Definition: reg.c:42
int nIndex
Definition: msvc.h:77
CSimpleArray< Pair, CSimpleArrayEqualHelperFalse< Pair > > m_Pairs
Definition: atlsimpcoll.h:449

Member Data Documentation

◆ m_Pairs

template<typename TKey , typename TVal , typename TEqual = CSimpleMapEqualHelper<TKey, TVal>>
CSimpleArray<Pair, CSimpleArrayEqualHelperFalse<Pair> > ATL::CSimpleMap< TKey, TVal, TEqual >::m_Pairs
protected

Definition at line 449 of file atlsimpcoll.h.


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