📄 vmhashbucket.h
字号:
#ifndef DOUBLY_LINKED_LIST_H_INCLUDED
#define DOUBLY_LINKED_LIST_H_INCLUDED
/*****************************************************************************/
/* HEADER FILE */
/*****************************************************************************/
/*
$Archive: $
$Revision: $
$Date: $
$Author: $
Description: Declaration of a doubly linked list class that is used by
the hash table object
TOOL And XML FORMS License
==========================
Except where otherwise noted, all of the documentation
and software included in the TOOL package is
copyrighted by Michael Swartzendruber.
Copyright (C) 2005 Michael John Swartzendruber.
All rights reserved.
Access to this code, whether intentional or accidental,
does NOT IMPLY any transfer of rights.
This software is provided "as-is," without any express
or implied warranty. In no event shall the author be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for
any purpose, including commercial applications, and to
alter and redistribute it, provided that the following
conditions are met:
1. All redistributions of source code files must retain
all copyright notices that are currently in place,
and this list of conditions without modification.
2. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
3. If you use this software in another product, an acknowledgment
in the product documentation would be appreciated but is
not required.
4. Modified versions in source or binary form must be plainly
marked as such, and must not be misrepresented as being
the original software.
*/
/*****************************************************************************/
#include <limits.h>
#include "../VMCoreGlobal.h"
class VMHashtableEntry
{
public:
VMVariant Key;
VMVariant Data;
VMHashtableEntry( void )
{
memset( &Key, 0, sizeof( Key ) );
memset( &Data, 0, sizeof( Data ) );
}
};
class VMHashBucket
{
public:
VMHashBucket( bool circ = false );
VMHashBucket( const VMHashBucket& dlst, bool shallow = false );
VMHashBucket( const VMHashtableEntry* array, size_t no );
~VMHashBucket( void );
void operator = ( const VMHashBucket& dlst );
VMHashtableEntry& operator * ( void );
void Append( const VMHashtableEntry& item );
void Append( const VMHashtableEntry* array, size_t no );
void Append( const VMHashBucket& dlst );
void Delete( void );
void InsertBefore( const VMHashtableEntry& item );
void InsertBefore( const VMHashtableEntry* array, size_t no );
void InsertBefore( const VMHashBucket& dlst );
void InsertAfter( const VMHashtableEntry& item );
void InsertAfter( const VMHashtableEntry* array, size_t no );
void InsertAfter( const VMHashBucket& dlst );
void Erase( void );
bool Get( VMHashtableEntry& roOutput );
operator VMHashtableEntry*( void );
// TRUE if current item is last item
bool AtHead( void );
bool AtTail( void );
// set current item to head of list
void ToHead( void );
void ToTail( void );
// move to next item in list
bool ToNext( void );
bool ToPrev( void );
// interrogate list
size_t GetCount( void );
bool IsShallow( void );
bool IsCircular( void );
protected:
// type defining a node in the list
struct Node
{
VMHashtableEntry Data;
Node* Next;
Node* Prev;
};
size_t Count; // # of items in list
Node* Head; // first item
Node* Tail; // last item
Node* Work; // current item
bool Shallow; // Is this a shallow copy?
bool Circular; // is this a circular list?
// internal utility functions
void DeepCopy( const VMHashBucket& dlst );
void ShallowCopy( const VMHashBucket& dlst );
void SetNull();
};
#endif
/*****************************************************************************/
/* Check-in history */
/*
*$Log: $
*/
/*****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -