From 696f4254ca7f5a847d2f8f6fdbdd39ec11581ca3 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 31 Mar 2015 17:42:02 -0400 Subject: [PATCH] TextSearch: trim trailing whitespace. --- src/apps/text_search/ChangesIterator.cpp | 2 +- src/apps/text_search/FileIterator.h | 30 ++++++++-------- src/apps/text_search/GrepApp.cpp | 46 ++++++++++++------------ src/apps/text_search/GrepApp.h | 30 ++++++++-------- src/apps/text_search/GrepListView.cpp | 34 +++++++++--------- src/apps/text_search/GrepListView.h | 30 ++++++++-------- src/apps/text_search/GrepWindow.cpp | 10 +++--- src/apps/text_search/GrepWindow.h | 38 ++++++++++---------- src/apps/text_search/Grepper.h | 46 ++++++++++++------------ src/apps/text_search/InitialIterator.cpp | 46 ++++++++++++------------ src/apps/text_search/InitialIterator.h | 34 +++++++++--------- src/apps/text_search/Model.h | 38 ++++++++++---------- src/apps/text_search/TextSearch.cpp | 2 +- 13 files changed, 193 insertions(+), 193 deletions(-) diff --git a/src/apps/text_search/ChangesIterator.cpp b/src/apps/text_search/ChangesIterator.cpp index 33bc32cabd..6a34ffee3c 100644 --- a/src/apps/text_search/ChangesIterator.cpp +++ b/src/apps/text_search/ChangesIterator.cpp @@ -24,7 +24,7 @@ using std::nothrow; #endif -ChangesIterator::ChangesIterator(const Model* model) +ChangesIterator::ChangesIterator(const Model* model) : FileIterator(), fPathMap(), fIteratorIndex(0), diff --git a/src/apps/text_search/FileIterator.h b/src/apps/text_search/FileIterator.h index c6cfa44304..1c4830c898 100644 --- a/src/apps/text_search/FileIterator.h +++ b/src/apps/text_search/FileIterator.h @@ -1,23 +1,23 @@ /* * Copyright (c) 2008 Stephan Aßmus * Copyright (c) 1998-2007 Matthijs Hollemans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in + * + * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef FILE_ITERATOR_H diff --git a/src/apps/text_search/GrepApp.cpp b/src/apps/text_search/GrepApp.cpp index da55f68210..f1801b264b 100644 --- a/src/apps/text_search/GrepApp.cpp +++ b/src/apps/text_search/GrepApp.cpp @@ -1,25 +1,25 @@ /* * Copyright (c) 1998-2007 Matthijs Hollemans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in + * + * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ - + #include "GrepApp.h" #include @@ -46,19 +46,19 @@ GrepApp::~GrepApp() } -void +void GrepApp::ArgvReceived(int32 argc, char** argv) { fGotArgvOnStartup = true; BMessage message(B_REFS_RECEIVED); int32 refCount = 0; - + for (int32 i = 1; i < argc; i++) { BEntry entry(argv[i]); entry_ref ref; entry.GetRef(&ref); - + if (entry.Exists()) { message.AddRef("refs", &ref); refCount += 1; @@ -73,7 +73,7 @@ GrepApp::ArgvReceived(int32 argc, char** argv) void GrepApp::RefsReceived(BMessage* message) -{ +{ if (IsLaunching()) fGotRefsOnStartup = true; @@ -114,12 +114,12 @@ GrepApp::MessageReceived(BMessage* message) void GrepApp::_TryQuit() -{ +{ if (CountWindows() == 0) PostMessage(B_QUIT_REQUESTED); - + if (CountWindows() == 1 && fQuitter == NULL) { - fQuitter = new BMessageRunner(be_app_messenger, + fQuitter = new BMessageRunner(be_app_messenger, new BMessage(MSG_TRY_QUIT), 200000, -1); } } diff --git a/src/apps/text_search/GrepApp.h b/src/apps/text_search/GrepApp.h index 86483b8db7..689e5619e3 100644 --- a/src/apps/text_search/GrepApp.h +++ b/src/apps/text_search/GrepApp.h @@ -1,22 +1,22 @@ /* * Copyright (c) 1998-2007 Matthijs Hollemans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in + * + * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #include diff --git a/src/apps/text_search/GrepListView.cpp b/src/apps/text_search/GrepListView.cpp index 787e4763ee..52e884a1b4 100644 --- a/src/apps/text_search/GrepListView.cpp +++ b/src/apps/text_search/GrepListView.cpp @@ -1,22 +1,22 @@ /* * Copyright (c) 1998-2007 Matthijs Hollemans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in + * + * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ @@ -30,12 +30,12 @@ ResultItem::ResultItem(const entry_ref& ref) { BEntry entry(&ref); BPath path(&entry); - SetText(path.Path()); + SetText(path.Path()); } GrepListView::GrepListView() - : BOutlineListView(BRect(0, 0, 40, 80), "SearchResults", + : BOutlineListView(BRect(0, 0, 40, 80), "SearchResults", B_MULTIPLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_NAVIGABLE) { diff --git a/src/apps/text_search/GrepListView.h b/src/apps/text_search/GrepListView.h index f0355a0dd3..c9ff26c225 100644 --- a/src/apps/text_search/GrepListView.h +++ b/src/apps/text_search/GrepListView.h @@ -1,22 +1,22 @@ /* * Copyright (c) 1998-2007 Matthijs Hollemans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in + * + * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef GREP_LIST_VIEW_H diff --git a/src/apps/text_search/GrepWindow.cpp b/src/apps/text_search/GrepWindow.cpp index 2a684f44f2..ae2c9c60ac 100644 --- a/src/apps/text_search/GrepWindow.cpp +++ b/src/apps/text_search/GrepWindow.cpp @@ -397,7 +397,7 @@ GrepWindow::_SetWindowTitle() if (entry.GetPath(&path) == B_OK) { if (fOldPattern.Length()) { title = B_TRANSLATE("%appname% : %path% : %searchtext%"); - title.ReplaceAll("%searchtext%", fOldPattern.String()); + title.ReplaceAll("%searchtext%", fOldPattern.String()); } else title = B_TRANSLATE("%appname% : %path%"); @@ -787,7 +787,7 @@ GrepWindow::_OnStartCancel() fButton->MoveTo( fMenuBar->Frame().Width() - fButton->Frame().Width() - 8, 8 + fSearchText->Frame().Height() + 8); - + fSearch->SetEnabled(false); // We need to remember the search pattern, because during @@ -844,7 +844,7 @@ GrepWindow::_OnSearchFinished() fButton->MoveTo( fMenuBar->Frame().Width() - fButton->Frame().Width() - 8, 8 + fSearchText->Frame().Height() + 8); - + fButton->SetEnabled(true); fSearch->SetEnabled(true); @@ -1028,7 +1028,7 @@ GrepWindow::_OnReportFileName(BMessage* message) fSearchText->TruncateString(&name, B_TRUNCATE_MIDDLE, fSearchBoxWidth - 10); - fSearchText->SetText(name); + fSearchText->SetText(name); } } @@ -1440,7 +1440,7 @@ GrepWindow::_OnSelectInTracker() BString str1; str1 << B_TRANSLATE("%APP_NAME couldn't open one or more folders."); str1.ReplaceFirst("%APP_NAME",APP_NAME); - BAlert* alert = new BAlert(NULL, str1.String(), B_TRANSLATE("OK"), + BAlert* alert = new BAlert(NULL, str1.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); diff --git a/src/apps/text_search/GrepWindow.h b/src/apps/text_search/GrepWindow.h index afcad60058..cb292a7384 100644 --- a/src/apps/text_search/GrepWindow.h +++ b/src/apps/text_search/GrepWindow.h @@ -1,22 +1,22 @@ /* * Copyright (c) 1998-2007 Matthijs Hollemans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in + * + * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef GREP_WINDOW_H @@ -38,14 +38,14 @@ class GrepWindow : public BWindow { public: GrepWindow(BMessage* message); virtual ~GrepWindow(); - + virtual void FrameResized(float width, float height); virtual void FrameMoved(BPoint origin); virtual void MenusBeginning(); virtual void MenusEnded(); virtual void MessageReceived(BMessage* message); virtual void Quit(); - + private: void _InitRefsReceived(entry_ref* directory, BMessage* message); @@ -54,7 +54,7 @@ private: void _CreateViews(); void _LayoutViews(); void _TileIfMultipleWindows(); - + void _LoadPrefs(); void _SavePrefs(); @@ -101,7 +101,7 @@ private: private: BTextControl* fSearchText; GrepListView* fSearchResults; - + BMenuBar* fMenuBar; BMenu* fFileMenu; BMenuItem* fNew; diff --git a/src/apps/text_search/Grepper.h b/src/apps/text_search/Grepper.h index 23d04745bc..d57a3a18d6 100644 --- a/src/apps/text_search/Grepper.h +++ b/src/apps/text_search/Grepper.h @@ -1,22 +1,22 @@ /* * Copyright (c) 1998-2007 Matthijs Hollemans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in + * + * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef GREPPER_H @@ -38,18 +38,18 @@ public: bool IsValid() const; void Start(); - void Cancel(); - + void Cancel(); + private: // Spawns the real grepper thread. static int32 _SpawnThread(void* cookie); // The thread function that does the actual grepping. - int32 _GrepperThread(); - + int32 _GrepperThread(); + // Remembers, and possibly escapes, the search pattern. void _SetPattern(const char* source); - + // Prepends all quotes, dollars and backslashes with at backslash // to prevent the shell from misinterpreting them. bool _EscapeSpecialChars(char* buffer, @@ -57,16 +57,16 @@ private: private: // The (escaped) search pattern. char* fPattern; - + // The settings from the model. BMessenger fTarget; bool fEscapeText : 1; bool fCaseSensitive : 1; uint32 fEncoding; - + // The supplier of files to grep FileIterator* fIterator; - + // Our thread's ID. thread_id fThreadId; diff --git a/src/apps/text_search/InitialIterator.cpp b/src/apps/text_search/InitialIterator.cpp index 68db11b367..d0db425b42 100644 --- a/src/apps/text_search/InitialIterator.cpp +++ b/src/apps/text_search/InitialIterator.cpp @@ -1,23 +1,23 @@ /* * Copyright (c) 2008 Stephan Aßmus * Copyright (c) 1998-2007 Matthijs Hollemans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in + * + * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ @@ -40,7 +40,7 @@ using std::nothrow; // For the moment I don't know the life cycle of the InitialIterator object. -InitialIterator::InitialIterator(const Model* model) +InitialIterator::InitialIterator(const Model* model) : FileIterator(), fDirectories(10), fCurrentDir(new (nothrow) BDirectory(&model->fDirectory)), @@ -90,7 +90,7 @@ InitialIterator::GetNextName(char* buffer) return false; // If the entry is a subdir, then add it to the - // list of directories and continue the loop. + // list of directories and continue the loop. // If the entry is a file and we can grep it // (i.e. it is a text file), then we're done // here. Otherwise, continue with the next entry. @@ -119,12 +119,12 @@ InitialIterator::NotifyNegatives() const bool InitialIterator::GetTopEntry(BEntry& entry) { - // If the user selected one or more files, we must look - // at the "refs" inside the message that was passed into - // our add-on's process_refs(). If the user didn't select - // any files, we will simply read all the entries from the + // If the user selected one or more files, we must look + // at the "refs" inside the message that was passed into + // our add-on's process_refs(). If the user didn't select + // any files, we will simply read all the entries from the // current working directory. - + entry_ref fileRef; if (fSelectedFiles.FindRef("refs", fCurrentRef, &fileRef) == B_OK) { @@ -184,7 +184,7 @@ InitialIterator::_GetSubEntry(BEntry& entry) if (fCurrentDir->GetNextEntry(&entry, fRecurseLinks) == B_OK) return true; - // If we get here, there are no more entries in + // If we get here, there are no more entries in // this subdir, so return to the parent directory. fDirectories.RemoveItem(fCurrentDir); diff --git a/src/apps/text_search/InitialIterator.h b/src/apps/text_search/InitialIterator.h index e43cdb2b2a..9b2ae1f127 100644 --- a/src/apps/text_search/InitialIterator.h +++ b/src/apps/text_search/InitialIterator.h @@ -1,23 +1,23 @@ /* * Copyright (c) 2008 Stephan Aßmus * Copyright (c) 1998-2007 Matthijs Hollemans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in + * + * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef INITIAL_ITERATOR_H @@ -69,10 +69,10 @@ private: private: // Contains pointers to BDirectory objects. BList fDirectories; - + // The directory we are currently looking at. BDirectory* fCurrentDir; - + // The ref number we are currently looking at. int32 fCurrentRef; diff --git a/src/apps/text_search/Model.h b/src/apps/text_search/Model.h index 9b8fe2b996..c2f2249aae 100644 --- a/src/apps/text_search/Model.h +++ b/src/apps/text_search/Model.h @@ -1,22 +1,22 @@ /* * Copyright (c) 1998-2007 Matthijs Hollemans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in + * + * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef MODEL_H @@ -60,7 +60,7 @@ enum { MSG_REFS_RECEIVED, MSG_TRY_QUIT, MSG_QUIT_NOW, - + MSG_TRIM_SELECTION, MSG_COPY_TEXT, MSG_SELECT_IN_TRACKER, @@ -78,7 +78,7 @@ enum state_t { class Model { public: Model(); - + status_t LoadPrefs(); status_t SavePrefs(); @@ -124,13 +124,13 @@ public: // Grep string encoding ? uint32 fEncoding; - + private: bool _LoadHistory(BList& items) const; status_t _SaveHistory(const BList& items) const; void _FreeHistory(const BList& items) const; status_t _OpenFile(BFile* file, const char* name, - uint32 openMode = B_READ_ONLY, + uint32 openMode = B_READ_ONLY, directory_which which = B_USER_SETTINGS_DIRECTORY, BVolume* volume = NULL) const; diff --git a/src/apps/text_search/TextSearch.cpp b/src/apps/text_search/TextSearch.cpp index 5ff0938e55..46780ba089 100644 --- a/src/apps/text_search/TextSearch.cpp +++ b/src/apps/text_search/TextSearch.cpp @@ -11,7 +11,7 @@ int -main() +main() { GrepApp app; app.Run();