📄 iterator.cpp
字号:
//===========================================================================//
// File: iterator.cc //
// Contents: Implementation details of base iterator //
//---------------------------------------------------------------------------//
// Copyright (C) Microsoft Corporation. All rights reserved. //
//===========================================================================//
#include "StuffHeaders.hpp"
//
//###########################################################################
// First
//###########################################################################
//
void
Iterator::First()
{
STOP(("Iterator::First - Should never reach here"));
}
//
//###########################################################################
// Last
//###########################################################################
//
void
Iterator::Last()
{
STOP(("Iterator::Last - Should never reach here"));
}
//
//###########################################################################
// Next
//###########################################################################
//
void
Iterator::Next()
{
STOP(("Iterator::Next - Should never reach here"));
}
//
//###########################################################################
// Previous
//###########################################################################
//
void
Iterator::Previous()
{
STOP(("Iterator::Previous - Should never reach here"));
}
//
//###########################################################################
// GetSize
//###########################################################################
//
CollectionSize
Iterator::GetSize()
{
CollectionSize i = 0;
void *item;
First();
while ((item = GetCurrentImplementation()) != NULL)
{
i++;
Next();
}
return i;
}
//
//###########################################################################
// ReadAndNextImplementation
//###########################################################################
//
void
*Iterator::ReadAndNextImplementation()
{
void *item;
if ((item = GetCurrentImplementation()) != NULL)
{
Next();
}
return item;
}
//
//###########################################################################
// ReadAndPreviousImplementation
//###########################################################################
//
void
*Iterator::ReadAndPreviousImplementation()
{
void *item;
if ((item = GetCurrentImplementation()) != NULL)
{
Previous();
}
return item;
}
//
//###########################################################################
// GetCurrentImplementation
//###########################################################################
//
void*
Iterator::GetCurrentImplementation()
{
STOP(("Iterator::GetCurrentImplementation - Should never reach here"));
return NULL;
}
//
//###########################################################################
// GetNthImplementation
//###########################################################################
//
void
*Iterator::GetNthImplementation(CollectionSize index)
{
CollectionSize i = 0;
void *item;
First();
while ((item = GetCurrentImplementation()) != NULL)
{
if (i == index)
return item;
Next();
i++;
}
return NULL;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -