About the sample code

The examples in this chapter use a sample object as the target for tests. The target class is TSampleObject. The TSampleObject class stores a string and provides access to the string. This is the class definition:

      // TestString.h
      // Copyright (c) 1995 Taligent, Inc.  All rights reserved.
      
      class TSampleObject : public MCollectible {
      public:
          MCollectibleDeclarationsMacro(TSampleObject);
      
                                  TSampleObject();
                                  TSampleObject(unsigned long maxLength);
                                  TSampleObject(const TSampleObject&);
          virtual                 ~TSampleObject();
          TSampleObject&          operator=(const TSampleObject&);
      
          virtual void            SetString(const UniChar* string, unsigned long length);
          virtual void            GetString(UniChar* buffer, unsigned long& bufferlength) const;
          virtual unsigned long    GetLength() const;
          
          virtual void            SetMaxLength(unsigned long);
          virtual unsigned long   GetMaxLength() const;
      
          virtual TStream&        operator>>=(TStream&) const;
          virtual TStream&        operator<<=(TStream&);
      
          virtual bool            IsEqual(const MCollectible*) const;
          virtual long            Hash() const;
      
      protected:
      
      private:
          UniChar*                 fText;
          unsigned long            fLength;
          unsigned long            fMaxLength;
      
          enum EVersion { kOriginalVersion };
      };

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker