// $Source: /usr/local/SimSoft/SoftShop/Basics/Messager/StrmSet.h,v $
// $Revision: 1.20 $
// $Author: baum $
// $Date: 2001/11/29 15:52:23 $
//
// Login name of the user who locked the revision
// $Locker:  $
// Tag name used to checkout the file
// $Name: Release-20 $
// State assigned to revision
// $State: Exp $
//
//
// $Log: StrmSet.h,v $
// Revision 1.20  2001/11/29 15:52:23  baum
// -In Kalender.cpp und Kalender.h Handsteuerung eingebaut
//

#ifndef _STREAMSET_H
#define _STREAMSET_H  1

#include <iostream.h>
#include <fstream.h>

#ifdef WIN32
#include <strstrea.h>
#else
#include <strstream.h>
#endif


#ifdef _STREAMSET_CPP
#  undef _impexp
#  define _impexp __declspec(dllexport)
#elif defined BUILD_BASICS_DLL
#  undef _impexp
#  define _impexp
#else
#  undef _impexp
#  define _impexp __declspec(dllimport)
#endif

#if defined __GNUG__ || defined __hpux
#  undef _impexp
#  define _impexp
#endif

//==================================================================
//		defs and forward
//==================================================================

//##ModelId=3FBCBCC4006D
typedef void StreamCallbackFunc (char*);

// forward
class CBstrstreambuf;

//==================================================================
//		Classdefinition for class OStreamController
//==================================================================

//##ModelId=3FBCBCC4008C
class _impexp OStreamController {
  public:
    // constructer, that defines nothing
    // normaly it makes no sense to
    // create another Object as the 
    // three default objects for the
    // standard streams (cout, clog, cerr)
    // !!!! USE StdStreamControl::setup () !!!!
	//##ModelId=3FBCBCC4008D
    OStreamController ();

    // destructor
    // !!!! USE StdStreamControl::cleanup () !!!!
	//##ModelId=3FBCBCC4008E
    ~OStreamController ();
    
    // manipulate the stream
	//##ModelId=3FBCBCC4009C
    const ostream& setToCallback (StreamCallbackFunc*);
	//##ModelId=3FBCBCC4009E
    const ostream& setToFile     (const char *fileName,
                                  const unsigned truncFile = 0);
	//##ModelId=3FBCBCC400A1
    const ostream& setToOstream  (const ostream&);
	//##ModelId=3FBCBCC400AC
    const ostream& setToDefault  ();

#if !defined(_MSC_VER)
  private:
#endif
    // prepare usage
	//##ModelId=3FBCBCC400AD
    void setup (const ostream&);
  private:
    // declared, but never defined
	//##ModelId=3FBCBCC400BB
    OStreamController (const OStreamController&);
	//##ModelId=3FBCBCC400BD
    OStreamController& operator = (const OStreamController&);


    // end usage
	//##ModelId=3FBCBCC400BF
    void cleanup ();

    // data members
#if defined(_MSC_VER)
	//##ModelId=3FBCBCC400CC
    ostream_withassign *ObjOutOld;
	//##ModelId=3FBCBCC400D1
    ostream_withassign *ObjTarget;
#else
    ostream *ObjOutOld;
    ostream *ObjTarget;
#endif
	//##ModelId=3FBCBCC400DB
    ofstream* ObjOutFile;
	//##ModelId=3FBCBCC400EA
    CBstrstreambuf *ObjOutCBbuf;

    // reset the stream
	//##ModelId=3FBCBCC400EE
    void setToNothing ();

  friend class StdStreamControl;

}; // class OStreamController

//==================================================================
//		OStreamController objects for the three
//              standard ostreams cout, clog and cerr
//==================================================================

extern OStreamController _impexp coutController;
extern OStreamController _impexp clogController;
extern OStreamController _impexp cerrController;

//==================================================================
//		Classdefinition for class StdStreamControl
//==================================================================

//##ModelId=3FBCBCC400FA
class _impexp StdStreamControl {
  public:
    // prepare usage
	//##ModelId=3FBCBCC40109
    static void setup ();

    // end usage
	//##ModelId=3FBCBCC4010B
    static void cleanup ();

    // query if initialized
	//##ModelId=3FBCBCC4010D
    static bool isInitialized ();

  private:
    // declared, but never defined
	//##ModelId=3FBCBCC4011A
    StdStreamControl ();
	//##ModelId=3FBCBCC4011B
    StdStreamControl (const StdStreamControl&);
	//##ModelId=3FBCBCC4011D
    ~StdStreamControl ();
	//##ModelId=3FBCBCC40128
    StdStreamControl& operator = (const StdStreamControl&);

    // data members
	//##ModelId=3FBCBCC4012B
    static unsigned ClassCounter;

  friend class Dummy; // to avoid compiler-warning!

}; // class StdStreamControl


#endif  //!_STREAMSET_H

//	$Filename: C:\Software\SoftShop\Basics\Messager\StrmSet.h $	ends
