ReactOS 0.4.16-dev-205-g7b2bb7e
CMruShortList Class Reference
Inheritance diagram for CMruShortList:
Collaboration diagram for CMruShortList:

Public Member Functions

 CMruShortList ()
 
 ~CMruShortList () override
 
- Public Member Functions inherited from CMruBase
 CMruBase ()
 
virtual ~CMruBase ()
 
STDMETHODIMP QueryInterface (REFIID riid, void **ppvObj) override
 
 STDMETHODIMP_ (ULONG) AddRef() override
 
 STDMETHODIMP_ (ULONG) Release() override
 
STDMETHODIMP InitData (UINT cCapacity, UINT flags, HKEY hKey, LPCWSTR pszSubKey OPTIONAL, SLOTCOMPARE fnCompare OPTIONAL) override
 
STDMETHODIMP AddData (LPCVOID pvData, DWORD cbData, UINT *piSlot) override
 
STDMETHODIMP FindData (LPCVOID pvData, DWORD cbData, UINT *piSlot) override
 
STDMETHODIMP GetData (UINT iSlot, LPVOID pvData, DWORD cbData) override
 
STDMETHODIMP QueryInfo (UINT iSlot, UINT *piGotSlot, DWORD *pcbData) override
 
STDMETHODIMP Delete (UINT iSlot) override
 
virtual BOOL _IsEqual (const SLOTITEMDATA *pItem, LPCVOID pvData, UINT cbData) const
 
virtual DWORD _DeleteValue (LPCWSTR pszValue)
 
virtual HRESULT _InitSlots ()=0
 
virtual void _SaveSlots ()=0
 
virtual UINT _UpdateSlots (UINT iSlot)=0
 
virtual void _SlotString (UINT iSlot, LPWSTR psz, DWORD cch)=0
 
virtual HRESULT _GetSlot (UINT iSlot, UINT *puSlot)=0
 
virtual HRESULT _RemoveSlot (UINT iSlot, UINT *puSlot)=0
 

Protected Member Functions

HRESULT _InitSlots () override
 
void _SaveSlots () override
 
UINT _UpdateSlots (UINT iSlot) override
 
void _SlotString (UINT iSlot, LPWSTR psz, DWORD cch) override
 
HRESULT _GetSlot (UINT iSlot, UINT *puSlot) override
 
HRESULT _RemoveSlot (UINT iSlot, UINT *puSlot) override
 
- Protected Member Functions inherited from CMruBase
HRESULT _LoadItem (UINT iSlot)
 
HRESULT _AddItem (UINT iSlot, LPCVOID pvData, DWORD cbData)
 
HRESULT _GetItem (UINT iSlot, SLOTITEMDATA **ppItem)
 
void _DeleteItem (UINT iSlot)
 
HRESULT _GetSlotItem (UINT iSlot, SLOTITEMDATA **ppItem)
 
void _CheckUsedSlots ()
 
HRESULT _UseEmptySlot (UINT *piSlot)
 

Protected Attributes

LPWSTR m_pszSlotData = NULL
 
- Protected Attributes inherited from CMruBase
LONG m_cRefs = 1
 
DWORD m_dwFlags = 0
 
BOOL m_bNeedSave = FALSE
 
BOOL m_bChecked = FALSE
 
HKEY m_hKey = NULL
 
DWORD m_cSlotRooms = 0
 
DWORD m_cSlots = 0
 
SLOTCOMPARE m_fnCompare = NULL
 
SLOTITEMDATAm_pSlots = NULL
 

Friends

class CMruLongList
 

Additional Inherited Members

- Static Public Member Functions inherited from CMruBase
static voidoperator new (size_t size)
 
static void operator delete (void *ptr)
 

Detailed Description

Definition at line 440 of file mrulist.cpp.

Constructor & Destructor Documentation

◆ CMruShortList()

CMruShortList::CMruShortList ( )
inline

Definition at line 455 of file mrulist.cpp.

456 {
457 }

◆ ~CMruShortList()

CMruShortList::~CMruShortList ( )
inlineoverride

Definition at line 459 of file mrulist.cpp.

460 {
462 }
LPWSTR m_pszSlotData
Definition: mrulist.cpp:444
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Member Function Documentation

◆ _GetSlot()

HRESULT CMruShortList::_GetSlot ( UINT  iSlot,
UINT puSlot 
)
overrideprotectedvirtual

Implements CMruBase.

Definition at line 531 of file mrulist.cpp.

532{
533 if (iSlot >= m_cSlots)
534 return E_FAIL;
535
536 UINT iData = m_pszSlotData[iSlot] - L'a';
537 if (iData >= m_cSlotRooms)
538 return E_FAIL;
539
540 *puSlot = iData;
541 m_pSlots[iData].dwFlags |= SLOT_SET;
542 return S_OK;
543}
DWORD m_cSlots
Definition: mrulist.cpp:75
SLOTITEMDATA * m_pSlots
Definition: mrulist.cpp:77
DWORD m_cSlotRooms
Definition: mrulist.cpp:74
#define E_FAIL
Definition: ddrawi.h:102
#define S_OK
Definition: intsafe.h:52
#define SLOT_SET
Definition: mrulist.cpp:27
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50

Referenced by CMruLongList::_ImportShortList(), and _RemoveSlot().

◆ _InitSlots()

HRESULT CMruShortList::_InitSlots ( )
overrideprotectedvirtual

Implements CMruBase.

Definition at line 465 of file mrulist.cpp.

466{
467 DWORD cbData = (m_cSlotRooms + 1) * sizeof(WCHAR);
469 if (!m_pszSlotData)
470 return E_OUTOFMEMORY;
471
472 if (SHGetValueW(m_hKey, NULL, L"MRUList", NULL, m_pszSlotData, &cbData) == ERROR_SUCCESS)
473 m_cSlots = (cbData / sizeof(WCHAR)) - 1;
474
476 return S_OK;
477}
HKEY m_hKey
Definition: mrulist.cpp:73
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
#define UNICODE_NULL
#define LPTR
Definition: winbase.h:406
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ _RemoveSlot()

HRESULT CMruShortList::_RemoveSlot ( UINT  iSlot,
UINT puSlot 
)
overrideprotectedvirtual

Implements CMruBase.

Definition at line 545 of file mrulist.cpp.

546{
547 HRESULT hr = _GetSlot(iSlot, puSlot);
548 if (FAILED(hr))
549 return hr;
550
551 MoveMemory(&m_pszSlotData[iSlot], &m_pszSlotData[iSlot + 1], (m_cSlots - iSlot) * sizeof(WCHAR));
552 --m_cSlots;
553 m_pSlots->dwFlags &= ~SLOT_SET;
555
556 return hr;
557}
BOOL m_bNeedSave
Definition: mrulist.cpp:71
HRESULT _GetSlot(UINT iSlot, UINT *puSlot) override
Definition: mrulist.cpp:531
#define TRUE
Definition: types.h:120
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
#define MoveMemory
Definition: winbase.h:1733

◆ _SaveSlots()

void CMruShortList::_SaveSlots ( )
overrideprotectedvirtual

Implements CMruBase.

Definition at line 479 of file mrulist.cpp.

480{
481 if (m_bNeedSave)
482 {
483 DWORD cbData = (m_cSlots + 1) * sizeof(WCHAR);
484 SHSetValueW(m_hKey, NULL, L"MRUList", REG_SZ, m_pszSlotData, cbData);
486 }
487}
#define FALSE
Definition: types.h:117
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
#define REG_SZ
Definition: layer.c:22

◆ _SlotString()

void CMruShortList::_SlotString ( UINT  iSlot,
LPWSTR  psz,
DWORD  cch 
)
overrideprotectedvirtual

Implements CMruBase.

Definition at line 522 of file mrulist.cpp.

523{
524 if (cch >= 2)
525 {
526 psz[0] = (WCHAR)(L'a' + iSlot);
527 psz[1] = UNICODE_NULL;
528 }
529}
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202

◆ _UpdateSlots()

UINT CMruShortList::_UpdateSlots ( UINT  iSlot)
overrideprotectedvirtual

Implements CMruBase.

Definition at line 490 of file mrulist.cpp.

491{
492 UINT iData, cDataToMove = iSlot;
493
494 if (iSlot == m_cSlots)
495 {
496 if (SUCCEEDED(_UseEmptySlot(&iData)))
497 {
498 ++cDataToMove;
499 }
500 else
501 {
502 // This code is getting the item index from a lowercase letter.
503 iData = m_pszSlotData[m_cSlots - 1] - L'a';
504 --cDataToMove;
505 }
506 }
507 else
508 {
509 iData = m_pszSlotData[iSlot] - L'a';
510 }
511
512 if (cDataToMove)
513 {
514 MoveMemory(m_pszSlotData + 1, m_pszSlotData, cDataToMove * sizeof(WCHAR));
515 m_pszSlotData[0] = (WCHAR)(L'a' + iData);
517 }
518
519 return iData;
520}
HRESULT _UseEmptySlot(UINT *piSlot)
Definition: mrulist.cpp:418
#define SUCCEEDED(hr)
Definition: intsafe.h:50

Friends And Related Function Documentation

◆ CMruLongList

friend class CMruLongList
friend

Definition at line 452 of file mrulist.cpp.

Member Data Documentation

◆ m_pszSlotData

LPWSTR CMruShortList::m_pszSlotData = NULL
protected

Definition at line 444 of file mrulist.cpp.

Referenced by _GetSlot(), _InitSlots(), _RemoveSlot(), _SaveSlots(), _UpdateSlots(), and ~CMruShortList().


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