home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / owlsrc.pak / VALIDATE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-24  |  1.6 KB  |  85 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1994, 1994 by Borland International, All Rights Reserved
  4. //
  5. //   Implementation of TValidator, user input validator abstract base class
  6. //----------------------------------------------------------------------------
  7. #pragma hdrignore SECTION
  8. #include <owl/owlpch.h>
  9. #include <owl/validate.h>
  10. #include <owl/module.h>
  11. #include <stdlib.h>
  12. #include <ctype.h>
  13.  
  14. #if !defined(SECTION) || SECTION == 1
  15.  
  16. //
  17. // Construct a validator
  18. //
  19. TValidator::TValidator()
  20. {
  21.   Options = 0;
  22. }
  23.  
  24. TValidator::~TValidator()
  25. {
  26. }
  27.  
  28. //
  29. // Validator error display. Overridden in derived classes
  30. //
  31. void
  32. TValidator::Error()
  33. {
  34. }
  35.  
  36. //
  37. // Checks current input against validator. May adjust input if suppressFill
  38. // isn't set & validator has the voFill option set.
  39. //
  40. bool
  41. TValidator::IsValidInput(char far*, bool /*suppressFill*/)
  42. {
  43.   return true;
  44. }
  45.  
  46. //
  47. // Checks input against validator for completeness. Never modifies input.
  48. //
  49. bool
  50. TValidator::IsValid(const char far*)
  51. {
  52.   return true;
  53. }
  54.  
  55. uint
  56. TValidator::Transfer(char far*, void*, TTransferDirection)
  57. {
  58.   return 0;
  59. }
  60.  
  61. TValidator::TXValidator::TXValidator(uint resId) : TXOwl(resId)
  62. {
  63. }
  64.  
  65. #endif
  66. #if !defined(SECTION) || SECTION == 2
  67.  
  68. IMPLEMENT_STREAMABLE(TValidator);
  69.  
  70. void*
  71. TValidator::Streamer::Read(ipstream& is, uint32 /*version*/) const
  72. {
  73.   is >> GetObject()->Options;
  74.   return GetObject();
  75. }
  76.  
  77. void
  78. TValidator::Streamer::Write(opstream& os) const
  79. {
  80.   os << GetObject()->Options;
  81. }
  82.  
  83. #endif
  84.  
  85.