📄 vmstringlist.h
字号:
#ifndef VM_STRING_LIST_H_INCLUDED
#define VM_STRING_LIST_H_INCLUDED
/*****************************************************************************/
/* HEADER FILE */
/*****************************************************************************/
/*
$Archive: $
$Revision: $
$Date: $
$Author: $
Description: The class contains support for a doubly linked string lists.
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.
*/
/*****************************************************************************/
typedef struct _tagStringList
{
char* m_pchString;
bool m_bMarked;
struct _tagStringList* m_pxPrev;
struct _tagStringList* m_pxNext;
void* m_pvData;
}
STRING_LIST, *P_STRING_LIST;
class VMStringList
{
public:
enum retcodes { success = 0, notfound = 1, cancelled = 2, nomemory = 4 };
VMStringList( void ); // initialize member variables
~VMStringList( void ); // call RemoveAll
short GetCount( void ) { return( m_iCount ); }
VMStringList::retcodes Add( const char* pchString, void* pvData = NULL ); // add to the list
VMStringList::retcodes SortedAdd( const char* pchString, void* pvData = NULL );
VMStringList::retcodes Find( const char* pchString, int* piIndex = NULL );
P_STRING_LIST FindNodeByName( const char* pchString, int* piIndex );
VMStringList::retcodes Remove( int iIndex );
LPSTR GetFirstString( void ); // get the first string NULL indicates end
LPSTR GetPrevString( void ); // get the next string NULL indicates end
LPSTR GetLastString( void ); // get the last string NULL indicates end
LPSTR GetNextString( void ); // get the prev string NULL indicates end
LPSTR GetStringAt( short iIndex ); // get the prev string NULL indicates end
P_STRING_LIST GetFirstNode( void );
P_STRING_LIST GetPrevNode( void );
P_STRING_LIST GetLastNode( void );
P_STRING_LIST GetNextNode( void );
P_STRING_LIST GetNodeAt( short iIndex );
void SetMarked( short iIndex, bool bMarked ); // mark or unmark an entry
bool IsMarked( short iIndex ); // returns the mark state of an entry
void RemoveAll( void ); // remove all entries in the linked list
private:
P_STRING_LIST MakeNewEntry( const char* pStr, void* pData );
P_STRING_LIST m_pxHead; // pointer to the head of the linked list
P_STRING_LIST m_pxCurrent; // pointer to the current entry in the list
P_STRING_LIST m_pxTail; // pointer to the tail of the linked list
short m_iCount; // number of entries in the list
};
#endif
/*****************************************************************************/
/* Check-in history */
/*
*$Log: $
*/
/*****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -