home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ User's Journal & Wi…eveloper's Journal Tools
/
C-C__Users_Journal_and_Windows_Developers_Journal_Tools_1997.iso
/
windbase
/
memslcpp.3
/
set1.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-11
|
6KB
|
168 lines
/***************************************************************************\
** **
** WW WW IIIIIIII NNN NN DDDDDDD BBBBBBB AA SSSSSS EEEEEEEE **
** WW W WW II NNNN NN DD DD BB BB AA AA SS EE **
** WW W WW II NN NN NN DD DD BBBBBBB AAAAAAAA SSSSSS EEEEEE **
** WW W WW II NN NNNN DD DD BB BB AA AA SS EE **
** WWWWW IIIIIIII NN NNN DDDDDDD BBBBBBB AA AA SSSSSS EEEEEEEE **
** **
** SSSSSS OOOOOO FFFFFFFF TTTTTTTT WW WW AA RRRRRRR EEEEEEEE **
** SS OO OO FF TT WW W WW AA AA RR RR EE **
** SSSSS OO OO FFFFF TT WW W WW AAAAAAAA RRRRRRR EEEEEE **
** SS OO OO FF TT WW W WW AA AA RR RR EE **
** SSSSSS OOOOOO FF TT WWWWW AA AA RR RR EEEEEEEE **
** **
********** NOTICE ***********************************************************
** This file contains valuable trade secrets and proprietary **
** assets of Windbase Software Inc. Embodying substantial **
** creative efforts and confidential information. Unauthorized **
** use, copying, decompiling, translating, disclosure or **
** transfer, of any kind, is strictly prohibited. **
** **
** COPYRIGHT (C) 1992, 1993, 1994, 1995. Windbase Software Inc. **
** ALL RIGHTS RESERVED. **
\***************************************************************************/
/*
** Set - Templates Version
*/
int WBCompareFunct(void *nullitem, char *item1, char *item2)
{
nullitem = nullitem;
return(strcmp(item1,item2));
}
void WBExecuteFunct(void *nullitem, char *item)
{
nullitem = nullitem;
cout << "Execute: " << item << "\n";
}
char *WBCopyFunct(void *nullitem, char *item)
{
nullitem = nullitem;
return(item);
}
main()
{
WBSet<char *> set1, set2, newset;
int rval;
set1.SetCompare(NULL,WBCompareFunct);
set1.SetExecute(NULL,WBExecuteFunct);
set2.SetCompare(NULL,WBCompareFunct);
set2.SetExecute(NULL,WBExecuteFunct);
newset.SetCompare(NULL,WBCompareFunct);
newset.SetExecute(NULL,WBExecuteFunct);
newset.SetCopy(NULL,WBCopyFunct);
set1+="Item01";
set1+="Item02";
set1+="Item03";
set1+="Item04";
set1+="Item05";
set1+="Item07";
set2+="Item03";
set2+="Item04";
set2+="Item05";
set2+="Item06";
set2+="Item07";
set2+="Item08";
set2+="Item09";
set2+="Item10";
set2+="Item11";
cout << "Set one members\n";
set1.Execute();
cout << "Set two members\n";
set2.Execute();
cout << "SetCmp(): return val == " << set1.SetCmp(set2,&rval);
cout << " rval == " << rval << "\n";
cout << "IsEqual(): " << (set1.IsEqual(set2) ? "True" : "False") << "\n";
cout << "IsSubset(): " << (set1.IsSubset(set2) ? "True" : "False") << "\n";
cout << "IsSuperset(): " << (set1.IsSuperset(set2) ? "True" : "False") << "\n";
cout << "set1 < set2: " << (set1 < set2 ? "True" : "False") << "\n";
cout << "set1 <= set2: " << (set1 <= set2 ? "True" : "False") << "\n";
cout << "set1 > set2: " << (set1 > set2 ? "True" : "False") << "\n";
cout << "set1 >= set2: " << (set1 >= set2 ? "True" : "False") << "\n";
cout << "set1 == set2: " << (set1 == set2 ? "True" : "False") << "\n";
cout << "set1 != set2: " << (set1 != set2 ? "True" : "False") << "\n";
cout << "Union Operators\n";
cout << "newset.Union(set1,set2)\n";
newset.Clear();
newset.Union(set1,set2);
newset.Execute();
cout << "newset = set1\n";
newset = set1;
newset.Execute();
cout << "newset += set2\n";
newset += set2;
newset.Execute();
cout << "newset = set1 + set2\n";
newset = set1 + set2;
newset.Execute();
cout << "Difference Operators\n";
cout << "newset.Difference(set1,set2)\n";
newset.Clear();
newset.Difference(set2,set1);
newset.Execute();
cout << "newset = set2\n";
newset = set2;
newset.Execute();
cout << "newset -= set1\n";
newset -= set1;
newset.Execute();
cout << "newset = set2 - set1\n";
newset = set2 - set1;
newset.Execute();
cout << "Intersection Operators\n";
cout << "newset.Intersection(set1,set2)\n";
newset.Clear();
newset.Intersection(set1,set2);
newset.Execute();
cout << "newset = set1\n";
newset = set1;
newset.Execute();
cout << "newset *= set2\n";
newset *= set2;
newset.Execute();
cout << "newset = set1 * set2\n";
newset = set1 * set2;
newset.Execute();
cout << "SetCmp(): return val == " << newset.SetCmp(set2,&rval);
cout << " rval == " << rval << "\n";
cout << "IsEqual(): " << (newset.IsEqual(set2) ? "True" : "False") << "\n";
cout << "IsSubset(): " << (newset.IsSubset(set2) ? "True" : "False") << "\n";
cout << "IsSuperset(): " << (newset.IsSuperset(set2) ? "True" : "False") << "\n";
cout << "newset < set2: " << (newset < set2 ? "True" : "False") << "\n";
cout << "newset <= set2: " << (newset <= set2 ? "True" : "False") << "\n";
cout << "newset > set2: " << (newset > set2 ? "True" : "False") << "\n";
cout << "newset >= set2: " << (newset >= set2 ? "True" : "False") << "\n";
cout << "newset == set2: " << (newset == set2 ? "True" : "False") << "\n";
cout << "newset != set2: " << (newset != set2 ? "True" : "False") << "\n";
return(0);
}