1 /* searchsettings.hh
2  * This file belongs to Worker, a file manager for UNIX/X11.
3  * Copyright (C) 2006-2008,2011 Ralf Hoffmann.
4  * You can contact me at: ralf@boomerangsworld.de
5  *   or http://www.boomerangsworld.de/worker
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 
22 #ifndef SEARCHSETTINGS_HH
23 #define SEARCHSETTINGS_HH
24 
25 #include "wdefines.h"
26 #include <string>
27 
28 class SearchSettings
29 {
30 public:
31     SearchSettings();
32     SearchSettings( const std::string &basedir,
33                     const std::string &matchname,
34                     bool matchname_re,
35                     bool matchname_fullpath,
36                     bool matchname_case,
37                     const std::string &matchcontent,
38                     bool matchcontent_case,
39                     bool follow_symlinks,
40                     bool search_vfs,
41                     bool search_same_fs,
42                     bool check_younger,
43                     const std::string &younger_than,
44                     bool check_older,
45                     const std::string &older_than );
46     ~SearchSettings();
47 
48     std::string getBaseDir() const;
49     std::string getMatchName() const;
50     bool getMatchNameRE() const;
51     bool getMatchNameFullPath() const;
52     bool getMatchNameCase() const;
53     std::string getMatchContent() const;
54     bool getMatchContentCase() const;
55     int getActiveRow() const;
56     bool getFollowSymlinks() const;
57     bool getSearchVFS() const;
58     bool getSearchSameFS() const;
59     bool getCheckYounger() const;
60     std::string getYoungerThan() const;
61     bool getCheckOlder() const;
62     std::string getOlderThan() const;
63     bool getCheckSizeGEQ() const;
64     bool getCheckSizeLEQ() const;
65     std::string getSizeGEQ() const;
66     std::string getSizeLEQ() const;
67 
68     time_t getYoungerThanDate() const;
69     time_t getOlderThanDate() const;
70     loff_t getSizeGEQAsInt() const;
71     loff_t getSizeLEQAsInt() const;
72 
73     void setCheckSizeGEQ( bool nv );
74     void setCheckSizeLEQ( bool nv );
75     void setSizeGEQ( const std::string &size );
76     void setSizeLEQ( const std::string &size );
77 
78     void setActiveRow( int nv );
79 
80     void setMaxVFSDepth( int nv );
81     int getMaxVFSDepth() const;
82 
83     void setMatchAlsoDirectories( bool nv );
84     bool getMatchAlsoDirectories() const;
85 private:
86     std::string _basedir;
87     std::string _matchname;
88     bool _matchname_re;
89     bool _matchname_fullpath;
90     bool _matchname_case;
91     std::string _matchcontent;
92     bool _matchcontent_case;
93     int _active_row;
94     bool _follow_symlinks;
95     bool _search_vfs;
96     bool _search_same_fs;
97     bool m_check_younger;
98     std::string m_younger_than;
99     bool m_check_older;
100     std::string m_older_than;
101 
102     bool m_check_size_geq, m_check_size_leq;
103     std::string m_size_geq, m_size_leq;
104 
105     // will be calculated
106     time_t m_younger_date, m_older_date;
107     loff_t m_size_geq_int, m_size_leq_int;
108 
109     int m_max_vfs_depth;
110 
111     bool m_match_also_directories;
112 
113     time_t convertDateString( const std::string &date ) const;
114     bool convertDates();
115 };
116 
117 #endif
118