ReactOS 0.4.15-dev-8227-g32d615f
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 466 of file mrulist.cpp.

Constructor & Destructor Documentation

◆ CMruShortList()

CMruShortList::CMruShortList ( )
inline

Definition at line 481 of file mrulist.cpp.

482 {
483 }

◆ ~CMruShortList()

CMruShortList::~CMruShortList ( )
inlineoverride

Definition at line 485 of file mrulist.cpp.

486 {
488 }
LPWSTR m_pszSlotData
Definition: mrulist.cpp:470
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 557 of file mrulist.cpp.

558{
559 if (iSlot >= m_cSlots)
560 return E_FAIL;
561
562 UINT iData = m_pszSlotData[iSlot] - L'a';
563 if (iData >= m_cSlotRooms)
564 return E_FAIL;
565
566 *puSlot = iData;
567 m_pSlots[iData].dwFlags |= SLOT_SET;
568 return S_OK;
569}
DWORD m_cSlots
Definition: mrulist.cpp:101
SLOTITEMDATA * m_pSlots
Definition: mrulist.cpp:103
DWORD m_cSlotRooms
Definition: mrulist.cpp:100
#define E_FAIL
Definition: ddrawi.h:102
#define S_OK
Definition: intsafe.h:52
#define SLOT_SET
Definition: mrulist.cpp:53
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 491 of file mrulist.cpp.

492{
493 DWORD cbData = (m_cSlotRooms + 1) * sizeof(WCHAR);
495 if (!m_pszSlotData)
496 return E_OUTOFMEMORY;
497
498 if (SHGetValueW(m_hKey, NULL, L"MRUList", NULL, m_pszSlotData, &cbData) == ERROR_SUCCESS)
499 m_cSlots = (cbData / sizeof(WCHAR)) - 1;
500
502 return S_OK;
503}
HKEY m_hKey
Definition: mrulist.cpp:99
#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:381
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ _RemoveSlot()

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

Implements CMruBase.

Definition at line 571 of file mrulist.cpp.

572{
573 HRESULT hr = _GetSlot(iSlot, puSlot);
574 if (FAILED(hr))
575 return hr;
576
577 MoveMemory(&m_pszSlotData[iSlot], &m_pszSlotData[iSlot + 1], (m_cSlots - iSlot) * sizeof(WCHAR));
578 --m_cSlots;
579 m_pSlots->dwFlags &= ~SLOT_SET;
581
582 return hr;
583}
BOOL m_bNeedSave
Definition: mrulist.cpp:97
HRESULT _GetSlot(UINT iSlot, UINT *puSlot) override
Definition: mrulist.cpp:557
#define TRUE
Definition: types.h:120
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
#define MoveMemory
Definition: winbase.h:1709

◆ _SaveSlots()

void CMruShortList::_SaveSlots ( )
overrideprotectedvirtual

Implements CMruBase.

Definition at line 505 of file mrulist.cpp.

506{
507 if (m_bNeedSave)
508 {
509 DWORD cbData = (m_cSlots + 1) * sizeof(WCHAR);
510 SHSetValueW(m_hKey, NULL, L"MRUList", REG_SZ, m_pszSlotData, cbData);
512 }
513}
#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 548 of file mrulist.cpp.

549{
550 if (cch >= 2)
551 {
552 psz[0] = (WCHAR)(L'a' + iSlot);
553 psz[1] = UNICODE_NULL;
554 }
555}
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202

◆ _UpdateSlots()

UINT CMruShortList::_UpdateSlots ( UINT  iSlot)
overrideprotectedvirtual

Implements CMruBase.

Definition at line 516 of file mrulist.cpp.

517{
518 UINT iData, cDataToMove = iSlot;
519
520 if (iSlot == m_cSlots)
521 {
522 if (SUCCEEDED(_UseEmptySlot(&iData)))
523 {
524 ++cDataToMove;
525 }
526 else
527 {
528 // This code is getting the item index from a lowercase letter.
529 iData = m_pszSlotData[m_cSlots - 1] - L'a';
530 --cDataToMove;
531 }
532 }
533 else
534 {
535 iData = m_pszSlotData[iSlot] - L'a';
536 }
537
538 if (cDataToMove)
539 {
540 MoveMemory(m_pszSlotData + 1, m_pszSlotData, cDataToMove * sizeof(WCHAR));
541 m_pszSlotData[0] = (WCHAR)(L'a' + iData);
543 }
544
545 return iData;
546}
HRESULT _UseEmptySlot(UINT *piSlot)
Definition: mrulist.cpp:444
#define SUCCEEDED(hr)
Definition: intsafe.h:50

Friends And Related Function Documentation

◆ CMruLongList

friend class CMruLongList
friend

Definition at line 478 of file mrulist.cpp.

Member Data Documentation

◆ m_pszSlotData

LPWSTR CMruShortList::m_pszSlotData = NULL
protected

Definition at line 470 of file mrulist.cpp.

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


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