// $Revision: 1.11 $ //------------------------------------------------------------------------------ // // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. // // Project: StockBrowser // File: StockServer.h // Build/Version: 1.0.0 // // Description: TStockData is an abstract base class for objects which // represent stock data. // // TStockException is a generic exception class for anything // that could go wrong during an operation involving stock // data. // //------------------------------------------------------------------------------ #ifndef TaligentSamples_STOCKDATA #define TaligentSamples_STOCKDATA class TStockData; class TStockException; #ifndef TaligentSamples_STOCKDAY #include "StockDay.h" #endif #ifndef TaligentSamples_STOCKTYPES #include "StockTypes.h" #endif #ifndef Taligent_STANDARDTEXT #include #endif class TCollectionOf; //============================================================================== // TStockData class TStockData { public: TaligentTypeExtensionDeclarationsMacro_Abstract(TStockData) public: TStockData(const TStandardText& name); virtual ~TStockData(); TStockData& operator=(const TStockData& source); virtual TStream& operator>>=(TStream& toStream) const; virtual TStream& operator<<=(TStream& fromStream); virtual bool operator==(const TStockData& other) const; virtual long Hash() const; const TStandardText& GetName() const; // CopyData returns true if data was found for the specified range of // days. virtual bool CopyData(TCollectionOf& fillWithData, const TRangeOfDays& range = TRangeOfDays::kAllDays) const = 0; protected: TStockData(); TStockData(const TStockData& source); private: enum {kOriginalVersion}; TStandardText fName; }; //============================================================================== // TStockException // NOTE: When you're writing your own exceptions, be sure to follow each // enum with its associated numerical value. This makes it easy to search // for the particular exception generated, and will save you a lot of time. class TStockException : public TStandardException { public: TaligentTypeExtensionDeclarationsMacro(TStockException) public: enum EStockExceptionCode { // This is a catch-all for any general problem encountered // during a call to one of the MStockDatabase functions. kCouldNotComplete = 0x2001, // Thrown if the data couldn't be retrieved for some reason. kDataInaccessible = 0x2002 }; TStockException(); TStockException(EStockExceptionCode errorCode); TStockException(const TStockException& source); virtual ~TStockException(); // Base exception functionality TStockException& operator=(const TStockException& source); virtual void Throw() const; // Clients use these functions EStockExceptionCode GetReason() const; }; #endif