HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
searchoptions.cpp
Go to the documentation of this file.
2 #include <QDebug>
3 
4 
5 namespace hal
6 {
8  {
9  //construct default filter options
10  mExactMatch = false;
11  mCaseSensitive = false;
12  mRegularExpression = false;
13  mColumns = {};
14  };
15 
17  {
18  mExactMatch = code & 1;
19  mCaseSensitive = code & 2;
20  mRegularExpression = code & 4;
21  if (!(code & (1<<3))) //check if the first column is 0
22  {
23  for(int i = 4; i<32; i++)
24  {
25  if(code & (1<<i))
26  mColumns.append(i-4);
27  }
28  }
29 
30  //qInfo() << mExactMatch << mCaseSensitive << mRegularExpression << "; " << mColumns;
31  }
32 
34  {
35  int prefix = 0;
36  int suffix = 0;
37  prefix += mExactMatch;
38  prefix += mCaseSensitive << 1;
39  prefix += mRegularExpression << 2;
40  if(mColumns.empty()) prefix += 1 << 3;
41  else
42  {
43  for(int i=0; i < mColumns.length(); i++)
44  {
45  suffix += 1<<mColumns[i];
46  }
47  }
48  suffix = suffix << 4;
49  return prefix + suffix;
50  }
51 
52  int SearchOptions::toInt(bool exactMatch, bool caseSensitive, bool regEx, QList<int> columns)
53  {
54  int prefix = 0;
55  int suffix = 0;
56  prefix += exactMatch;
57  prefix += caseSensitive << 1;
58  prefix += regEx << 2;
59  if(columns.empty()) prefix += 1 << 3;
60  else
61  {
62  for(int i=0; i < columns.length(); i++)
63  {
64  suffix += 1<<columns[i];
65  }
66  }
67  suffix = suffix << 4;
68  return prefix + suffix;
69  }
70 
71  void SearchOptions::setOptions(bool exactMatch, bool caseSensitive, bool regEx, QList<int> columns)
72  {
73  mExactMatch = exactMatch;
74  mCaseSensitive = caseSensitive;
75  mRegularExpression = regEx;
76  mColumns = columns;
77  }
78 
80  {
81  return mExactMatch;
82  }
83 
85  {
86  return mCaseSensitive;
87  }
88 
90  {
91  return mRegularExpression;
92  }
93 
95  {
96  return mColumns;
97  }
98 }
const QList< int > & getColumns() const
bool isExactMatch() const
bool isCaseSensitive() const
bool isRegularExpression() const
void setOptions(bool exactMatch, bool caseSensitive, bool regEx, QList< int > columns)
Definition: defines.h:45
void append(const T &value)
bool empty() const const
int length() const const