comparison OrthancServer/Search/DicomTagConstraint.cpp @ 3071:2df061cf2fec db-changes

getting rid of IFindConstraint hierarchy
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 02 Jan 2019 11:26:27 +0100
parents ce272138f15e
children 0e9d1731b1b0
comparison
equal deleted inserted replaced
3070:1bc4a1bb66e9 3071:2df061cf2fec
292 else 292 else
293 { 293 {
294 return IsMatch(tmp->GetContent()); 294 return IsMatch(tmp->GetContent());
295 } 295 }
296 } 296 }
297
298
299 std::string DicomTagConstraint::Format() const
300 {
301 switch (constraintType_)
302 {
303 case ConstraintType_Equal:
304 return tag_.Format() + " == " + GetValue();
305
306 case ConstraintType_SmallerOrEqual:
307 return tag_.Format() + " <= " + GetValue();
308
309 case ConstraintType_GreaterOrEqual:
310 return tag_.Format() + " >= " + GetValue();
311
312 case ConstraintType_Wildcard:
313 return tag_.Format() + " ~~ " + GetValue();
314
315 case ConstraintType_List:
316 {
317 std::string s = tag_.Format() + " IN [ ";
318
319 bool first = true;
320 for (std::set<std::string>::const_iterator
321 it = values_.begin(); it != values_.end(); ++it)
322 {
323 if (first)
324 {
325 first = false;
326 }
327 else
328 {
329 s += ", ";
330 }
331
332 s += *it;
333 }
334
335 return s + "]";
336 }
337
338 default:
339 throw OrthancException(ErrorCode_InternalError);
340 }
341 }
297 } 342 }