Changeset View
Changeset View
Standalone View
Standalone View
src/lib/term.h
Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Line(s) | |||||
131 | 131 | | |||
132 | inline Term operator &&(const Term& lhs, const Term& rhs) | 132 | inline Term operator &&(const Term& lhs, const Term& rhs) | ||
133 | { | 133 | { | ||
134 | if (lhs.isEmpty()) | 134 | if (lhs.isEmpty()) | ||
135 | return rhs; | 135 | return rhs; | ||
136 | else if (rhs.isEmpty()) | 136 | else if (rhs.isEmpty()) | ||
137 | return lhs; | 137 | return lhs; | ||
138 | 138 | | |||
139 | Term t(Term::And); | 139 | return {lhs, Term::And, rhs}; | ||
140 | t.addSubTerm(lhs); | | |||
141 | t.addSubTerm(rhs); | | |||
142 | return t; | | |||
143 | } | 140 | } | ||
144 | 141 | | |||
145 | inline Term operator ||(const Term& lhs, const Term& rhs) | 142 | inline Term operator ||(const Term& lhs, const Term& rhs) | ||
146 | { | 143 | { | ||
147 | if (lhs.isEmpty()) | 144 | if (lhs.isEmpty()) | ||
148 | return rhs; | 145 | return rhs; | ||
149 | else if (rhs.isEmpty()) | 146 | else if (rhs.isEmpty()) | ||
150 | return lhs; | 147 | return lhs; | ||
151 | 148 | | |||
152 | Term t(Term::Or); | 149 | return {lhs, Term::Or, rhs}; | ||
153 | t.addSubTerm(lhs); | | |||
154 | t.addSubTerm(rhs); | | |||
155 | return t; | | |||
156 | } | 150 | } | ||
157 | 151 | | |||
158 | inline Term operator !(const Term& rhs) | 152 | inline Term operator !(const Term& rhs) | ||
159 | { | 153 | { | ||
160 | Term t(rhs); | 154 | Term t(rhs); | ||
161 | t.setNegation(!rhs.isNegated()); | 155 | t.setNegation(!rhs.isNegated()); | ||
162 | return t; | 156 | return t; | ||
163 | } | 157 | } | ||
164 | 158 | | |||
165 | } | 159 | } | ||
166 | 160 | | |||
167 | QDebug operator <<(QDebug d, const Baloo::Term& t); | 161 | QDebug operator <<(QDebug d, const Baloo::Term& t); | ||
168 | 162 | | |||
169 | #endif | 163 | #endif |