本文整理汇总了C++中FindNext函数的典型用法代码示例。如果您正苦于以下问题:C++ FindNext函数的具体用法?C++ FindNext怎么用?C++ FindNext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindNext函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildTreeView
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
void __fastcall TDialogProjectNew::BuildTreeView(TTreeView *TreeView, TTreeNode *TreeNode, const String Path)
{
TSearchRec SearchRec;
if (FindFirst(Path + "\\*.*", faAnyFile, SearchRec) == 0) {
do {
if (SearchRec.Name[1] != '.') {
if (SearchRec.Attr & faDirectory) {
TTreeNode *TreeNode2 = TreeView->Items->AddChild(TreeNode, SearchRec.Name);
TreeNode2->ImageIndex = 2;
TreeNode2->SelectedIndex = 2;
BuildTreeView(TreeView, TreeNode2, Path + "\\" + SearchRec.Name);
}
}
} while (FindNext(SearchRec) == 0);
FindClose(SearchRec);
}
if (FindFirst(Path + "\\*.*", faAnyFile, SearchRec) == 0) {
do {
if (SearchRec.Name[1] != '.') {
if (!(SearchRec.Attr & faDirectory)) {
TTreeNode *TreeNode2 = TreeView->Items->AddChild(TreeNode, SearchRec.Name);
TreeNode2->ImageIndex = 1;
TreeNode2->SelectedIndex = 1;
}
}
} while (FindNext(SearchRec) == 0);
FindClose(SearchRec);
}
}
示例2: printf
int UnitTest::RunAllInGroup( const char* group )
{
printf( "GROUP %s\n", group );
int error_count = 0;
const char dashes[] = "------------------------------";
// Because of (naughty) reliance of static constructor to register tests, the order in the list is out of my
// control. A little extra code to make them run in alphabetical order.
UnitTest* test = FindNext( group, NULL );
while( test )
{
size_t offset = strlen( test->m_Name );
if( offset >= sizeof( dashes ) )
{
offset = sizeof( dashes ) - 1;
}
printf( " %s %s ", test->m_Name, dashes + offset );
test->m_ErrorCount = 0;
test->Test();
if( test->m_ErrorCount == 0 )
{
printf( "pass\n" );
}
error_count += test->m_ErrorCount;
test->m_Done = true;
test = FindNext( group, test );
}
return error_count;
}
示例3: ASSERT
LRESULT EditFind::FindReplaceCmd(WPARAM, LPARAM lParam)
{
FindReplaceDialog* dialog = FindReplaceDialog::GetNotifier(lParam);
ASSERT(dialog == m_dialog);
bool found = true;
if (dialog->IsTerminating())
{
m_lastFind = dialog->GetFindString();
m_searchDown = dialog->SearchDown();
m_matchCase = dialog->MatchCase();
m_matchWholeWord = dialog->MatchWholeWord();
m_dialog = NULL;
}
else if (dialog->FindNext())
{
found = FindNext(true);
if (!found)
found = FindNext(false);
}
else if (dialog->ReplaceCurrent())
found = Replace();
else if (dialog->ReplaceAll())
found = ReplaceAll();
if (!found)
::MessageBeep(MB_ICONEXCLAMATION);
return 0;
}
示例4: AddMenu
void __fastcall TForm1::FindFile2(TMenuItem *parent, String path) {
TSearchRec sr;
if (FindFirst(TPath::Combine(path, "*.*"), faDirectory, sr) == 0) {
do {
if (sr.Name == "." || sr.Name == ".." || sr.Attr != faDirectory)
continue;
TMenuItem *item = AddMenu(parent, sr, TPath::Combine(path, sr.Name));
if (sr.Attr & faDirectory && chbSubDirectory->Checked) {
FindFile2(item, TPath::Combine(path, sr.Name));
}
}
while (!FindNext(sr));
}
if (FindFirst(TPath::Combine(path, edtPattern->Text), faAnyFile, sr) == 0) {
do {
if (sr.Name == "." || sr.Name == ".." || sr.Attr & faDirectory)
continue;
AddMenu(parent, sr, TPath::Combine(path, sr.Name));
}
while (!FindNext(sr));
}
FindClose(sr);
}
示例5: RecursiveSearch
bool ClassBrowser::RecursiveSearch(const wxString& search, wxTreeCtrl* tree, const wxTreeItemId& parent, wxTreeItemId& result)
{
if (!parent.IsOk() || !tree)
return false;
// first check the parent item
if (FoundMatch(search, tree, parent))
{
result = parent;
return true;
}
wxTreeItemIdValue cookie;
wxTreeItemId child = tree->GetFirstChild(parent, cookie);
if (!child.IsOk())
return RecursiveSearch(search, tree, FindNext(search, tree, parent), result);
while (child.IsOk())
{
if (FoundMatch(search, tree, child))
{
result = child;
return true;
}
if (tree->ItemHasChildren(child))
{
if (RecursiveSearch(search, tree, child, result))
return true;
}
child = tree->GetNextChild(parent, cookie);
}
return RecursiveSearch(search, tree, FindNext(search, tree, parent), result);
}
示例6: assert
//@Override
ECode FindActionModeCallback::OnActionItemClicked(
/* [in] */ IActionMode* mode,
/* [in] */ IMenuItem* item,
/* [out] */ Boolean* result)
{
if (mWebView == NULL) {
//throw new AssertionError(
// "No WebView for FindActionModeCallback::onActionItemClicked");
assert(0);
}
AutoPtr<IBinder> binder;
assert(0);
// mWebView->GetWebView()->GetWindowToken((IBinder**)&binder);
mInput->HideSoftInputFromWindow(binder, 0, NULL);
Int32 id;
item->GetItemId(&id);
switch(id) {
case R::id::find_prev:
FindNext(FALSE);
break;
case R::id::find_next:
FindNext(TRUE);
break;
default:
if (result) *result = FALSE;
return NOERROR;
}
if (result) *result = TRUE;
return NOERROR;
}
示例7: DateTime
bool
MoonPhases::Test( )
{
bool ok = true;
cout << "Testing MoonPhases" << endl;
double jan2000 = DateTime( 1, January, 2000, 0, 0 ).JulianDay( );
TESTCHECKFE( FindNext( jan2000, New ),
DateTime( 6, January, 2000, 18, 14 ).JulianDay( ), &ok,
2.e-10 );
TESTCHECKFE( FindNext( jan2000, FirstQuarter ),
DateTime( 14, January, 2000, 13, 34 ).JulianDay( ), &ok,
2.e-10 );
TESTCHECKFE( FindNext( jan2000, Full ),
DateTime( 21, January, 2000, 4, 40 ).JulianDay( ), &ok,
2.e-10 );
TESTCHECKFE( FindNext( jan2000, LastQuarter ),
DateTime( 28, January, 2000, 7, 57 ).JulianDay( ), &ok,
2.e-10 );
if ( ok )
cout << "MoonPhases PASSED." << endl << endl;
else
cout << "MoonPhases FAILED." << endl << endl;
return ok;
}
示例8: ReplaceOnce
void
FindAndReplace::OnReplaceButton(LPFINDREPLACE& lpfr)
{
CharacterRange crange;
CharacterRange crtextrange;
if(m_havefound)
{
ReplaceOnce(lpfr->lpstrFindWhat, lpfr->lpstrReplaceWith);
m_havefound = FindNext(lpfr->lpstrFindWhat,
(wyBool)(!(lpfr->Flags & FR_DOWN)),
(wyBool)(lpfr->Flags & FR_WHOLEWORD),
(wyBool)(lpfr->Flags & FR_MATCHCASE));
}
else
{
crange = GetSelection();
pGlobals->m_findcount = 0;
::SendMessage (m_hwndedit, SCI_SETSEL, crange.cpMin, crange.cpMin);
m_havefound = FindNext(lpfr->lpstrFindWhat,
(wyBool)(!(lpfr->Flags & FR_DOWN)),
(wyBool)(lpfr->Flags & FR_WHOLEWORD),
(wyBool)(lpfr->Flags & FR_MATCHCASE));
crtextrange = GetSelection();
//checking whether the selected text is same as text to be replaced.
//if it is not same, then we are selecting the text,then on next replace click we will replace the text.
//if it is same then we will replace the text.
if(m_havefound && crtextrange.cpMin == crange.cpMin && crtextrange.cpMax == crange.cpMax )
{
//replace the selected text
ReplaceOnce(lpfr->lpstrFindWhat, lpfr->lpstrReplaceWith);
// Find the next given text
m_havefound = FindNext(lpfr->lpstrFindWhat,
(wyBool)(!(lpfr->Flags & FR_DOWN)),
(wyBool)(lpfr->Flags & FR_WHOLEWORD),
(wyBool)(lpfr->Flags & FR_MATCHCASE));
}
}
//if text not found
if(m_havefound == wyFalse)
{
NotFoundMsg(lpfr->lpstrFindWhat);
return;
}
return;
}
示例9: GetNode
HtmlNode GetNode(std::istream& io_is)
{
//get name
std::string node_name = GetString('>', io_is);
if(!FindNext('>', io_is))
{
throw std::logic_error("no >");
}
auto pos = io_is.tellg();
//get childs
std::vector<HtmlNode> node_childs;
while(FindNext('<', io_is) && io_is.peek() != '/')
{
node_childs.push_back(GetNode(io_is));
pos = io_is.tellg();
}
io_is.seekg(pos);
//get text
std::string node_text;
if(node_childs.empty())
{
//get text
node_text = GetString('<', io_is);
}
if(!FindNext('<', io_is))
{
throw std::logic_error("no <");
}
if(!FindNext('/', io_is))
{
throw std::logic_error("no /");
}
//get closed name
std::string node_close_name = GetString('>', io_is);
if(!FindNext('>', io_is))
{
throw std::logic_error("no >");
}
if(node_close_name != node_name)
{
throw std::logic_error("invalid close name");
}
HtmlNode node(node_name, node_text, node_childs);
return node;
}
示例10: dirSpec
/* Starts enumeration process. */
CHXDirectory::FSOBJ
CHXDirectory::FindFirst(const char* szPattern, char* szPath, UINT16 nSize)
{
OSErr err;
CHXDirSpecifier dirSpec(m_strPath);
require(dirSpec.IsSet() && CHXFileSpecUtils::DirectoryExists(dirSpec), bail);
// if there is already an iterator, dispose it
if (m_FSIterator)
{
err = FSCloseIterator(m_FSIterator);
check_noerr(err);
m_FSIterator = 0;
}
err = FSOpenIterator((FSRef *) dirSpec, kFSIterateFlat, &m_FSIterator);
require_noerr(err, bail);
m_strFindPattern = szPattern;
return FindNext(szPath, nSize);
bail:
return FSOBJ_NOTVALID;
}
示例11: assert
LRESULT ViewFilesDialog::OnFindDialogMessage(WPARAM wParam, LPARAM lParam)
{
/*
* Handle activity in the modeless "find" dialog.
*/
assert(fpFindDialog != NULL);
fFindDown = (fpFindDialog->SearchDown() != 0);
fFindMatchCase = (fpFindDialog->MatchCase() != 0);
fFindMatchWholeWord = (fpFindDialog->MatchWholeWord() != 0);
if (fpFindDialog->IsTerminating()) {
LOGI("VFD find dialog closing");
fpFindDialog = NULL;
return 0;
}
if (fpFindDialog->FindNext()) {
fFindLastStr = fpFindDialog->GetFindString();
FindNext(fFindLastStr, fFindDown, fFindMatchCase, fFindMatchWholeWord);
} else {
LOGI("Unexpected find dialog activity");
}
return 0;
}
示例12: TForm
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
__fastcall TDialogProjectNew::TDialogProjectNew(TComponent* Owner)
: TForm(Owner)
{
TemplatePath = Usul()->Ini->ReadString("Settings", "PathTemplatesProjects", TemplatePath = Usul()->Path + "\\Templates\\Projects");
PageControl->ActivePageIndex = 0;
TSearchRec SearchRec;
if (FindFirst(TemplatePath + "\\*", faDirectory, SearchRec) == 0) {
do {
if (SearchRec.Name[1] != '.') {
TListItem *ListItem = ListView->Items->Add();
ListItem->Caption = SearchRec.Name;
ListItem->ImageIndex = 1;
}
} while (FindNext(SearchRec) == 0);
}
FindClose(SearchRec);
if (Usul()->HasWriteAccessToExeDirectrory())
Edit->Text = Usul()->Path + "\\New project";
else
Edit->Text = Usul()->PathDocuments + "\\New project";
for (int I = 2;;I++) {
bool IsDirectoryExists = DirectoryExists(Edit->Text);
bool IsFileExists = FileExists(Edit->Text);
if (!IsDirectoryExists && !IsFileExists) break;
Edit->Text = Usul()->Path + "\\New project" + String(I);
}
}
示例13: FindFirstFileA
bool FileFind::FindFirst(std::string &name)
{
#ifdef WIN32
mInternalFind->hFindNext = FindFirstFileA(mSearchName, &mInternalFind->finddata);
if ( mInternalFind->hFindNext == INVALID_HANDLE_VALUE )
return false;
mInternalFind->bFound = 1; // have an initial file to check.
return FindNext(name);
#endif
#ifdef LINUX_GENERIC
mInternalFind->mDir = opendir(".");
return FindNext(name);
#endif
//return false;
}
示例14: GenerateFileList
// Generates a list of files in the root directory on the card
void GenerateFileList()
{
SearchRec file;
int i;
// Reset vars
g_FilesInList = 0;
// All file types except for directories
unsigned char Attributes = ATTR_HIDDEN | ATTR_SYSTEM | ATTR_READ_ONLY | ATTR_VOLUME| ATTR_ARCHIVE;
if(FindFirst("*.*", Attributes, &file) == 0)// 0 is success
{
g_FilesInList = 1;
strcpy(g_FileNames[0], file.filename);
g_FileLengths[0] = file.filesize;
for(i=1; i < MAX_FILENAMES; i++)
{
if(FindNext(&file) == 0)
{
strcpy(g_FileNames[i], file.filename);
g_FileLengths[i] = file.filesize;
}
else
break;
g_FilesInList++;
}
}
}
示例15: ResetLastHit
bool t4p::FinderClass::FindPrevious(const UnicodeString& text, int32_t start) {
bool found = false;
if (t4p::FinderClass::EXACT == Mode) {
ResetLastHit();
found = FindPreviousExact(text, start, true);
} else if (t4p::FinderClass::CASE_INSENSITIVE == Mode) {
ResetLastHit();
found = FindPreviousExact(text, start, false);
} else {
// lazy way of backwards searching, search from the beginning until
// we find the last hit before start
int32_t position = 0,
length = 0,
nextPosition = 0,
nextLength = 0;
while (FindNext(text, nextPosition + nextLength)) {
if (GetLastMatch(nextPosition, nextLength)) {
if ((nextPosition + nextLength) >= start && start > 0) {
break;
}
found = true;
position = nextPosition;
length = nextLength;
}
}
IsFound = found;
if (IsFound) {
LastPosition = position;
LastLength = length;
}
}
return IsFound;
}