~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/contrib/ThreadSearch/TextFileSearcher.h

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
class TextFileSearcher
20
20
{
21
21
public:
22
 
        enum eFileSearcherReturn
23
 
        {
24
 
                idStringFound=0,
25
 
                idStringNotFound,
26
 
                idFileNotFound,
27
 
                idFileOpenError
28
 
        };
29
 
 
30
 
        /** BuildTextFileSearcher
31
 
          * Builds a TextFileSearcherRegEx or a TextFileSearcherText pointer depending on regEx
32
 
          * @return TextFileSearcher* : NULL if failure (regular expression syntax for example)
33
 
          */
34
 
        // We don't use ThreadSearchFindData to limit coupling
35
 
        static TextFileSearcher* BuildTextFileSearcher(const wxString& searchText,
36
 
                                                                                                   bool matchCase,
37
 
                                                                                                   bool matchWordBegin,
38
 
                                                                                                   bool matchWord,
39
 
                                                                                                   bool regEx);
40
 
 
41
 
 
42
 
        /** Destructor. */
43
 
        virtual ~TextFileSearcher() {};
44
 
 
45
 
        /** Return true if line matches search text.
46
 
          * This method must be implemented in derived classes to allows using
47
 
          * different search strategies (at least simple text and regular expressions).
48
 
          * @param line : the text line to match.
49
 
          * @return true if line matches search text.
50
 
          */
51
 
        virtual bool MatchLine(wxString line) = 0;
52
 
 
53
 
        /** Return true if object is OK.
54
 
          * Exists to test validity of the object, mainly for reg ex syntax errors.
55
 
          * @param pErrorMessage : error message if object is not valid. May be NULL
56
 
          *                        if it is not necessary to get it.
57
 
          * @return true if object is Ok, ie usable.
58
 
          */
59
 
        virtual bool IsOk(wxString* pErrorMessage = NULL);
60
 
 
61
 
        /** Return true if Line matches search text.
62
 
          * This method must be implemented in derived classes to allows using
63
 
          * different search strategies (at least simple text and regular expressions use.
64
 
          * @param filePath : file path in which we look for m_SearchText
65
 
          * @param foundLines : array that stores a list of line number and line text
66
 
          * @return true if success (error can only come from bad reg ex or file open
67
 
          * failure).
68
 
          */
69
 
        eFileSearcherReturn FindInFile(const wxString& filePath, wxArrayString &foundLines);
 
22
    enum eFileSearcherReturn
 
23
    {
 
24
        idStringFound=0,
 
25
        idStringNotFound,
 
26
        idFileNotFound,
 
27
        idFileOpenError
 
28
    };
 
29
 
 
30
    /** BuildTextFileSearcher
 
31
      * Builds a TextFileSearcherRegEx or a TextFileSearcherText pointer depending on regEx
 
32
      * @return TextFileSearcher* : NULL if failure (regular expression syntax for example)
 
33
      */
 
34
    // We don't use ThreadSearchFindData to limit coupling
 
35
    static TextFileSearcher* BuildTextFileSearcher(const wxString& searchText,
 
36
                                                   bool matchCase,
 
37
                                                   bool matchWordBegin,
 
38
                                                   bool matchWord,
 
39
                                                   bool regEx);
 
40
 
 
41
 
 
42
    /** Destructor. */
 
43
    virtual ~TextFileSearcher() {};
 
44
 
 
45
    /** Return true if line matches search text.
 
46
      * This method must be implemented in derived classes to allows using
 
47
      * different search strategies (at least simple text and regular expressions).
 
48
      * @param line : the text line to match.
 
49
      * @return true if line matches search text.
 
50
      */
 
51
    virtual bool MatchLine(wxString line) = 0;
 
52
 
 
53
    /** Return true if object is OK.
 
54
      * Exists to test validity of the object, mainly for reg ex syntax errors.
 
55
      * @param pErrorMessage : error message if object is not valid. May be NULL
 
56
      *                        if it is not necessary to get it.
 
57
      * @return true if object is Ok, ie usable.
 
58
      */
 
59
    virtual bool IsOk(wxString* pErrorMessage = NULL);
 
60
 
 
61
    /** Return true if Line matches search text.
 
62
      * This method must be implemented in derived classes to allows using
 
63
      * different search strategies (at least simple text and regular expressions use.
 
64
      * @param filePath : file path in which we look for m_SearchText
 
65
      * @param foundLines : array that stores a list of line number and line text
 
66
      * @return true if success (error can only come from bad reg ex or file open
 
67
      * failure).
 
68
      */
 
69
    eFileSearcherReturn FindInFile(const wxString& filePath, wxArrayString &foundLines);
70
70
 
71
71
protected:
72
 
        /** Constructor. */
73
 
        // We don't use ThreadSearchFindData to limit coupling
74
 
        TextFileSearcher(const wxString& searchText, bool matchCase, bool matchWordBegin, bool matchWord):
75
 
                                         m_SearchText(searchText),
76
 
                                         m_MatchCase(matchCase),
77
 
                                         m_MatchWordBegin(matchWordBegin),
78
 
                                         m_MatchWord(matchWord)
79
 
        {}
 
72
    /** Constructor. */
 
73
    // We don't use ThreadSearchFindData to limit coupling
 
74
    TextFileSearcher(const wxString& searchText, bool matchCase, bool matchWordBegin, bool matchWord):
 
75
                     m_SearchText(searchText),
 
76
                     m_MatchCase(matchCase),
 
77
                     m_MatchWordBegin(matchWordBegin),
 
78
                     m_MatchWord(matchWord)
 
79
    {}
80
80
 
81
 
        wxString   m_SearchText;
82
 
        bool       m_MatchCase;
83
 
        bool       m_MatchWordBegin;
84
 
        bool       m_MatchWord;
85
 
        wxTextFile m_TextFile;
 
81
    wxString   m_SearchText;
 
82
    bool       m_MatchCase;
 
83
    bool       m_MatchWordBegin;
 
84
    bool       m_MatchWord;
 
85
    wxTextFile m_TextFile;
86
86
};
87
87
 
88
88
#endif // TEXT_FILE_SEARCHER_H