summaryrefslogtreecommitdiff
path: root/stringlist.h
blob: ec10883c98b845ae1f3e9332649597a4beb81943 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*

"Spam Filter"-Plugin for Miranda IM

Copyright 2003-2006 Heiko Herkenrath

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program ("SpamFilter-License.txt"); if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef SF_STRINGLIST_H__
#define SF_STRINGLIST_H__ 1


// -- Structs
typedef struct {
	UINT uCount; // protected by csListAccess
	WCHAR** papszList; // protected by csListAccess
	CRITICAL_SECTION csListAccess;
} STRINGLIST, *LPSTRINGLIST;

// -- Defines
#define SL_MIN_POS			0
#define SL_INVALID_POS		(-1)

// -- Prototypes
LPSTRINGLIST SLNewList(void);
void SLFreeList(LPSTRINGLIST psl);
BOOL SLClearList(LPSTRINGLIST psl);
BOOL SLMergeList(LPSTRINGLIST pslDest, LPSTRINGLIST pslFrom);

int SLGetMaxPos(LPSTRINGLIST psl);
int SLGetSize(LPSTRINGLIST psl, BOOL bAlsoTerminatingZeros); // character count size
int SLGetItemCount(LPSTRINGLIST psl);
WCHAR* SLGetItem(LPSTRINGLIST psl, int iPos);
BOOL SLIsValid(LPSTRINGLIST psl, int iPos);

BOOL SLMoveItem(LPSTRINGLIST psl, int iOldPos, int iNewPos, BOOL bOnlySwitch);
BOOL SLItemPrintf(LPSTRINGLIST psl, int iPos, int cchArgMaxLen, ...);
BOOL SLSetItemLength(LPSTRINGLIST psl, int iPos, int cchLength);
BOOL SLChangeItem(LPSTRINGLIST psl, int iPos, WCHAR* pszNewStr, BOOL bDoAppend);

BOOL SLDeleteItem(LPSTRINGLIST psl, int iPos);
BOOL SLDeleteItems(LPSTRINGLIST psl, int iPosFirst, int iPosLast);

BOOL SLAddItems(LPSTRINGLIST psl, const WCHAR* apszNewItems[], UINT uNewItemsCount);
int SLAddItem(LPSTRINGLIST psl, const WCHAR* pszNewItem);
int SLAddItemPair(LPSTRINGLIST psl, const WCHAR* pszNewItem1, const WCHAR* pszNewItem2);
int SLPrepareItem(LPSTRINGLIST psl, int cchLength);

BOOL SLIsItem(LPSTRINGLIST psl, const WCHAR* pszItem, BOOL bCaseSensitive);
int SLFindItem(LPSTRINGLIST psl, const WCHAR* pszItem, BOOL bCaseSensitive, int iStartPos);

WCHAR* SLConvertToString(LPSTRINGLIST psl, const WCHAR* pszSeparator, BOOL bAlsoDoFirst, BOOL bAlsoDoLast, int* piSize);
void SLFreeReturn(void* pszPntr);
BOOL SLConvertToStringBuf(LPSTRINGLIST psl, WCHAR* pszOutput, int cchMaxSize, const WCHAR* pszSeparator, BOOL bAlsoDoFirst, BOOL bAlsoDoLast);
BOOL SLConvertFromString(LPSTRINGLIST psl, const WCHAR* pszString, int cchSize, const WCHAR* pszSeparator, BOOL bIgnoreEmptyItems);

BOOL SLLoadFromFile(LPSTRINGLIST psl, const WCHAR* pszSearchPath);
BOOL SLSaveToFile(LPSTRINGLIST psl, const WCHAR* pszFileName);
BOOL SLLoadFromIniFile(LPSTRINGLIST psl, const WCHAR* pszSearchPath, const WCHAR* pszSection, const WCHAR* pszSettingPrefix);
BOOL SLSaveToIniFile(LPSTRINGLIST psl, const WCHAR* pszFileName, const WCHAR* pszSection, const WCHAR* pszSettingPrefix);

BOOL SLRetrieveFromListBoxCtrl(LPSTRINGLIST psl, HWND hwndListBox);
BOOL SLAssignToListBoxCtrl(LPSTRINGLIST psl, HWND hwndListBox);

BOOL SLBlockList(LPSTRINGLIST psl);
BOOL SLUnBlockList(LPSTRINGLIST psl);

#endif // SF_STRINGLIST_H__