ReactOS 0.4.16-dev-125-g798ea90
Completion.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef const TCHAR *(* ReplaceCompletionCallback) (unsigned __int64 &rnIndex, const BOOL *pblnForward, const TCHAR *pchContext, const TCHAR *pchBegin)
 

Functions

const TCHARCompletionCallback (unsigned __int64 &rnIndex, const BOOL *pblnForward, const TCHAR *pchContext, const TCHAR *pchBegin)
 
void InvalidateCompletion ()
 

Typedef Documentation

◆ ReplaceCompletionCallback

typedef const TCHAR *(* ReplaceCompletionCallback) (unsigned __int64 &rnIndex, const BOOL *pblnForward, const TCHAR *pchContext, const TCHAR *pchBegin)

Definition at line 7 of file Completion.h.

Function Documentation

◆ CompletionCallback()

const TCHAR * CompletionCallback ( unsigned __int64 rnIndex,
const BOOL pblnForward,
const TCHAR pchContext,
const TCHAR pchBegin 
)

Definition at line 439 of file Completion.cpp.

443{
444 static TCHAR pszBuffer[COMPLETION_BUFFER_SIZE];
445
446 // Find first non-white space in context
447 while(*pszContext && _istspace(*pszContext))
448 pszContext++;
449
450 BOOL blnNewCompletion = TRUE;
451 if (!g_Completion.IsNewCompletion(pszContext,pszBegin,blnNewCompletion))
452 {
453 ASSERT(FALSE);
454 return NULL;
455 }
456
457 if (blnNewCompletion)
458 {
459 _tcsncpy(pszBuffer,pszBegin,COMPLETION_BUFFER_SIZE-1);
460 pszBuffer[COMPLETION_BUFFER_SIZE-1] = 0;
461 TCHAR *pszSeparator = pszBuffer; // set it to aby non null value
462 if (_tcscmp(pszBuffer,_T("\\")))
463 {
464 pszSeparator = _tcsrchr(pszBuffer,_T('\\'));
465 if (pszSeparator)
466 *pszSeparator = 0;
467 }
468
469 if (!FillCompletion(pszSeparator?pszBuffer:NULL))
470 return NULL;
471 }
472
473 unsigned __int64 nTotalItems = g_Completion.GetCount();
474 if (nTotalItems == 0)
475 return NULL;
476
477 if (rnIndex >= nTotalItems)
478 rnIndex = nTotalItems-1;
479
480 if (pblnForward)
481 {
482 if (*pblnForward)
483 {
484 rnIndex++;
485 if (rnIndex >= nTotalItems)
486 {
488 rnIndex = 0;
489 else
490 rnIndex--;
491 }
492 }
493 else
494 {
495 if (rnIndex)
496 rnIndex--;
497 else if (g_blnCompletionCycle)
498 rnIndex = nTotalItems-1;
499 }
500 }
501 BOOL blnIsKey = FALSE;
502 const TCHAR *pszName = g_Completion.Get(rnIndex,blnIsKey);
503
504 ASSERT(pszName);
505
506 _sntprintf(pszBuffer,COMPLETION_BUFFER_SIZE-1,_T("%s%s"),pszName,(blnIsKey?_T("\\"):_T("")));
507 pszBuffer[COMPLETION_BUFFER_SIZE-1] = 0;
508 return pszBuffer;
509}
BOOL FillCompletion(const TCHAR *pszKey)
Definition: Completion.cpp:332
BOOL g_blnCompletionCycle
Definition: Completion.cpp:31
class CCompletionList g_Completion
#define COMPLETION_BUFFER_SIZE
Definition: Completion.cpp:27
#define __int64
Definition: basetyps.h:16
BOOL IsNewCompletion(const TCHAR *pszContext, const TCHAR *pszBegin, BOOL &rblnNew)
Definition: Completion.cpp:149
const TCHAR * Get(unsigned __int64 nIndex, BOOL &rblnIsKey)
Definition: Completion.cpp:249
unsigned __int64 GetCount()
Definition: Completion.cpp:301
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define _istspace
Definition: tchar.h:1504
#define _tcscmp
Definition: tchar.h:1424
#define _tcsncpy
Definition: tchar.h:1410
#define ASSERT(a)
Definition: mode.c:44
#define _tcsrchr
Definition: utility.h:116
#define _T(x)
Definition: vfdio.h:22
char TCHAR
Definition: xmlstorage.h:189
#define _sntprintf
Definition: xmlstorage.h:201

Referenced by co_IntCallSentMessageCallback(), co_IntSendMessageWithCallBack(), co_MsqSendMessageAsync(), and main().

◆ InvalidateCompletion()