本文整理汇总了C++中Compare函数的典型用法代码示例。如果您正苦于以下问题:C++ Compare函数的具体用法?C++ Compare怎么用?C++ Compare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Compare函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: value_comparison
value_comparison(KeyFromValue key_=KeyFromValue(),Compare comp_=Compare()):
key(key_),comp(comp_)
{
}
示例2: equal
int equal(const char *s1, const char *s2) {
return Compare(s1, s2) == 0;
}
示例3: Compare
int Compare(LPARAM lParam1, LPARAM lParam2)
{
return Compare(
(CShadowTree*)m_pList->GetItemData((int)lParam1),
(CShadowTree*)m_pList->GetItemData((int)lParam2));
}
示例4: Compare
int String::Compare(const char* str, bool caseSensitive) const
{
return Compare(CString(), str, caseSensitive);
}
示例5: p1
// key -> value access
value_ref_type operator[]( key_param_type key ) const
{
iterator it = boost::detail::lower_bound( m_map.begin(), m_map.end(), key, p1() );
return (it == m_map.end() || Compare()( key, it->first ) ) ? m_invalid_value : it->second;
}
示例6: main
main(int argc,
char **argv)
{
l_int32 error;
l_uint32 *data;
PIX *pix1, *pix2, *pix3, *pix1c, *pix2c, *pix1t, *pix2t, *pixd;
PIXA *pixa;
static char mainName[] = "pixmem_reg";
error = 0;
pixa = pixaCreate(0);
/* Copy with internal resizing: onto a cmapped image */
pix1 = pixRead("weasel4.16c.png");
pix2 = pixRead("feyn-fract.tif");
pix3 = pixRead("lucasta.150.jpg");
fprintf(stderr, "before copy 2 --> 3\n");
pixCopy(pix3, pix2);
Compare(pix2, pix3, &error);
pixSaveTiled(pix3, pixa, 4, 1, 30, 32);
fprintf(stderr, "before copy 3 --> 1\n");
pixCopy(pix1, pix3);
Compare(pix2, pix1, &error);
pixSaveTiled(pix1, pixa, 4, 0, 30, 32);
pixDestroy(&pix1);
pixDestroy(&pix2);
pixDestroy(&pix3);
/* Copy with internal resizing: from a cmapped image */
pix1 = pixRead("weasel4.16c.png");
pix2 = pixRead("feyn-fract.tif");
pix3 = pixRead("lucasta.150.jpg");
fprintf(stderr, "before copy 1 --> 2\n");
pixCopy(pix2, pix1);
Compare(pix2, pix1, &error);
pixSaveTiled(pix2, pixa, 1, 1, 30, 32);
fprintf(stderr, "before copy 2 --> 3\n");
pixCopy(pix3, pix2);
Compare(pix3, pix2, &error);
pixSaveTiled(pix3, pixa, 1, 0, 30, 32);
pixDestroy(&pix1);
pixDestroy(&pix2);
pixDestroy(&pix3);
/* Transfer of data pixs --> pixd, when pixs is not cloned.
* pixs is destroyed. */
pix1 = pixRead("weasel4.16c.png");
pix2 = pixRead("feyn-fract.tif");
pix3 = pixRead("lucasta.150.jpg");
pix1c = pixCopy(NULL, pix1);
fprintf(stderr, "before transfer 1 --> 2\n");
pixTransferAllData(pix2, &pix1, 0, 0);
Compare(pix2, pix1c, &error);
pixSaveTiled(pix2, pixa, 1, 1, 30, 32);
fprintf(stderr, "before transfer 2 --> 3\n");
pixTransferAllData(pix3, &pix2, 0, 0);
Compare(pix3, pix1c, &error);
pixSaveTiled(pix3, pixa, 1, 0, 30, 32);
pixDestroy(&pix1c);
pixDestroy(&pix3);
/* Another transfer of data pixs --> pixd, when pixs is not cloned.
* pixs is destroyed. */
pix1 = pixRead("weasel4.16c.png");
pix2 = pixRead("feyn-fract.tif");
pix3 = pixRead("lucasta.150.jpg");
pix1c = pixCopy(NULL, pix1);
pix2c = pixCopy(NULL, pix2);
fprintf(stderr, "before copy transfer 1 --> 2\n");
pixTransferAllData(pix2, &pix1c, 0, 0);
Compare(pix2, pix1, &error);
pixSaveTiled(pix2, pixa, 1, 0, 30, 32);
fprintf(stderr, "before copy transfer 2 --> 3\n");
pixTransferAllData(pix3, &pix2, 0, 0);
Compare(pix3, pix1, &error);
pixSaveTiled(pix3, pixa, 1, 0, 30, 32);
pixDestroy(&pix1);
pixDestroy(&pix2c);
pixDestroy(&pix3);
/* Transfer of data pixs --> pixd, when pixs is cloned.
* pixs has its refcount reduced by 1. */
pix1 = pixRead("weasel4.16c.png");
pix2 = pixRead("feyn-fract.tif");
pix3 = pixRead("lucasta.150.jpg");
pix1c = pixClone(pix1);
pix2c = pixClone(pix2);
fprintf(stderr, "before clone transfer 1 --> 2\n");
pixTransferAllData(pix2, &pix1c, 0, 0);
Compare(pix2, pix1, &error);
pixSaveTiled(pix2, pixa, 1, 0, 30, 32);
fprintf(stderr, "before clone transfer 2 --> 3\n");
pixTransferAllData(pix3, &pix2c, 0, 0);
Compare(pix3, pix1, &error);
pixSaveTiled(pix3, pixa, 1, 0, 30, 32);
pixDestroy(&pix1);
pixDestroy(&pix2);
pixDestroy(&pix3);
/* Extraction of data when pixs is not cloned, putting
//.........这里部分代码省略.........
示例7: Cmp_Hi
static int Cmp_Hi(const void *a, const void *b)
{
return Compare( Sort_Pts[*(int*)b], Sort_Pts[*(int*)a] );
}
示例8: PerformSpecificTest
//.........这里部分代码省略.........
{
pStr = NULL ;
}
~PointerEnvelope( )
{
delete pStr ;
}
} envelope ; /* struct */
/***** Function
STR_String * GetVariable( )
*****/
int inxEnv = -1 ;
int sizValue = -1 ;
char Value[ TAL_dimBuffer ] ;
int numRead = TST_pReader->ReadCommandLine( "is" ,
&inxEnv , &sizValue , Value ) ;
if ( ( numRead != 2 )
|| !VerifyInxEnv( inxEnv , YES ))
{
return TST_RetCodeParmError ;
} /* if */
envelope.pStr = vtEnv[ inxEnv ]->GetVariable( ) ;
if ( strcmp( Value , "." ) != 0 )
{
if ( envelope.pStr != NULL )
{
return Compare( envelope.pStr->GetLength( ) ,
envelope.pStr->GetString( ) , sizValue , Value ,
"Incorrect environment variable name" ) ;
} /* if */
if ( strcmp( Value , "" ) != 0 )
{
return TST_RetCodeOK ;
} /* if */
DisplayErrorMsg( "Variable is NULL." ) ;
return TST_RetCodeFailure ;
} /* if */
if ( envelope.pStr != NULL )
{
DisplayInformation( "Environment variable name: " ,
envelope.pStr->GetString( )) ;
} else
{
DisplayInformation( "Variable is not set." , "" ) ;
} /* if */
return TST_RetCodeOK ;
} // end selection: Test: ENV !Get environment variable
// Test: ENV !Get environment string
// AE: GetEnvironmentString inxEnvironment expString
// expString == "." displays the string
// expString == "" expects NULL string
else if ( strcmp( Command , GetString_007_CMD ) == 0 )
{
示例9: return
int WebRect::Merge(WebRect *pRect1, WebRect *pRect2)
{
return (MergeCase(pRect1, pRect2, Compare(pRect1)));
}
示例10: Compare
bool BinaryData::operator<(const BinaryData & inData) const
{
return Compare(inData) < 0;
}
示例11: Compare
int cbTreeCtrl::OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2)
{
return Compare(((FileTreeData*)GetItemData(item1))->GetProjectFile(), ((FileTreeData*)GetItemData(item2))->GetProjectFile());
}
示例12: return
bool CDuiString::operator > (LPCTSTR str) const { return (Compare(str) > 0); };
示例13: main
int
main(int argc, char *argv[])
{
const char *name = "PATH";
char out_delim = PATHDELIM;
int remove_duplicates = FALSE;
size_t length = (size_t) argc;
int operation = 'a';
const char *where = 0;
int c, point = 0;
LIST *list;
char *s;
while ((c = getopt(argc, argv, "a:bdefn:prv")) != EOF) {
switch (c) {
case 'a':
where = optarg;
break;
case 'b':
where = BLANK;
break;
case 'd':
remove_duplicates = TRUE;
break;
case 'e':
where = 0;
break;
case 'f':
allow_files = TRUE;
break;
case 'n':
name = optarg;
break;
case 'p':
out_delim = ' ';
break;
case 'r':
if (where == 0)
where = BLANK;
operation = c;
break;
case 'v':
out_delim = '\n';
break;
default:
usage();
}
}
/* Get the current path, make a corresponding list of strings. Leave
* enough room in the list to allow us to insert the arguments also.
*/
if ((s = getenv(name)) == 0)
s = StrAlloc(BLANK);
else
s = StrAlloc(s); /* ...just in case someone else uses it */
for (c = 0; s[c] != EOS; c++)
if (s[c] == PATHDELIM)
length++;
length += 3;
list = (LIST *) calloc(length, sizeof(LIST));
list[0].nn = StrAlloc(BLANK); /* dummy entry, to simplify -b option */
/* Split the environment variable into strings indexed in list[] */
for (c = 1; *s != EOS; c++) {
if (*s == PATHDELIM) {
list[c].nn = StrAlloc(".");
} else {
list[c].nn = s;
while (*s != PATHDELIM && *s != EOS)
s++;
if (*s == EOS)
continue;
*s = EOS;
}
s++;
}
list[c].nn = 0;
TRACE((stderr, "%s has %d entries\n", name, c));
/* Find the list-entry after which we insert/remove entries */
for (c = 0; list[c].nn != 0; c++) {
if (where != 0 && !Compare(where, list[c].nn)) {
point = c;
break;
}
}
if (list[c].nn == 0)
point = c - 1;
TRACE((stderr, "argc=%d, point=%d (%c)\n", argc, point, operation));
/* Perform the actual insertion/removal */
while (optind < argc) {
s = argv[optind++];
if (!Compare(s, "-"))
break;
if (operation == 'r') {
Remove(point, list, s);
//.........这里部分代码省略.........
示例14: Compare
bool Word::operator==(const Word &compare) const
{
int ret = Compare(compare);
return ret == 0;
}
示例15: dt_RunDrawTest
bool dt_RunDrawTest(const char* from, Int_t mode = 0, Int_t verboseLevel = 0) {
// This launch a test a TTree::Draw.
// The mode currently available are:
// 0: Do not load the shared library
// 1: Load the shared library before opening the file
// 2: Load the shared library after opening the file
// 3: Simple TChain test with shared library
// 4: Simple Friend test with shared library
// The verboseLeve currently available:
// 0: As silent as possible, only report errors and overall speed results.
// 1: Output 0 + label for the start of each phase
// 2: Output 1 + more details on the different phase being done
// 3: Output 2 + stop at the first and draw a canvas showing the differences
//gDebug = 5;
SetVerboseLevel(verboseLevel);
if (mode == 1) {
if (!TClassTable::GetDict("Event")) {
gSystem->Load("Event_cxx");
}
gHasLibrary = kTRUE;
}
TFile *hfile = 0;
TTree *tree = 0;
if (mode <3) {
hfile = new TFile(from);
tree = (TTree*)hfile->Get("T");
}
if (mode >= 2 && mode <= 4) {
if (!TClassTable::GetDict("Event")) {
gSystem->Load("Event_cxx");
} else {
cerr << "Since libEvent.so has already been loaded, mode 2 can not be tested!";
cerr << endl;
}
gHasLibrary = kTRUE;
}
if (mode == 3) {
// Test Chains.
TChain * chain = new TChain("T");
chain->Add(from);
chain->Add(from);
tree = chain;
}
if (mode == 4) {
// Test friends.
tree = new TTree("T","Base of friendship");
tree->AddFriend("T",from);
}
TBranch *eb = tree->GetBranch("event");
gBranchStyle = (int) eb->InheritsFrom(TBranchElement::Class());
// cerr << "Branch style is " << gBranchStyle << endl;
if (gQuietLevel<2) cout << "Generating histograms from TTree::Draw" << endl;
TDirectory* where = GenerateDrawHist(tree,2,gQuietLevel);
if (gQuietLevel<2) cout << "Comparing histograms" << endl;
if (Compare(where)>0) {
cout << "DrawTest: Comparison failed" << endl;
return false;
}
DrawMarks();
if (gQuietLevel<2) cout << "DrawTest: Comparison was successfull" << endl;
if (hfile) delete hfile;
else delete tree;
gROOT->GetList()->Delete();
return true;
}