Filter.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* ---------------------------------------------------------------------------
  2. Nullsoft Database Engine
  3. --------------------
  4. codename: Near Death Experience
  5. --------------------------------------------------------------------------- */
  6. /* ---------------------------------------------------------------------------
  7. Filter Class
  8. --------------------------------------------------------------------------- */
  9. // Filters can now be a test on a field or a single operator that will pop
  10. // one operation from the filters stack. upon AddFilter*, return value will
  11. #include "Filter.h"
  12. #include "Field.h"
  13. //---------------------------------------------------------------------------
  14. Filter::Filter(unsigned char _Op)
  15. {
  16. DataField = 0;
  17. Op = _Op;
  18. Id = -1;
  19. }
  20. //---------------------------------------------------------------------------
  21. Filter::Filter(Field *Data, unsigned char _Id, unsigned char _Op)
  22. {
  23. DataField = Data;
  24. Op = _Op;
  25. Id = _Id;
  26. }
  27. //---------------------------------------------------------------------------
  28. Filter::~Filter()
  29. {
  30. delete DataField;
  31. }
  32. //---------------------------------------------------------------------------
  33. unsigned char Filter::GetOp(void) const
  34. {
  35. return Op;
  36. }
  37. //---------------------------------------------------------------------------
  38. void Filter::SetOp(unsigned char _Op)
  39. {
  40. Op = _Op;
  41. }
  42. //---------------------------------------------------------------------------
  43. Field *Filter::Data(void) const
  44. {
  45. return DataField;
  46. }
  47. //---------------------------------------------------------------------------
  48. void Filter::SetData(Field *data)
  49. {
  50. DataField = data;
  51. }
  52. //---------------------------------------------------------------------------
  53. int Filter::GetId(void) const
  54. {
  55. return Id;
  56. }