home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / INCLUDE / IOMANIP.H < prev    next >
Text File  |  1993-09-17  |  10KB  |  160 lines

  1. #pragma info( none )
  2. #ifndef __CHKHDR__
  3.    #pragma info( none )
  4. #endif
  5. #pragma info( restore )
  6.  
  7. #ifndef __iomanip_h
  8.    #define __iomanip_h
  9.  
  10.    /********************************************************************/
  11.    /*  <iomanip.h> header file                                         */
  12.    /*                                                                  */
  13.    /*  Licensed Materials - Property of IBM                            */
  14.    /*                                                                  */
  15.    /*  IBM C/C++ Tools Version 2.01                                    */
  16.    /*  Copyright (C) International Business Machines Corp., 1991, 1993.*/
  17.    /*  All rights reserved                                             */
  18.    /*                                                                  */
  19.    /*                                                                  */
  20.    /*                                                                  */
  21.    /*  Licensed Materials - Property of USL                            */
  22.    /*                                                                  */
  23.    /*  Standard Class Library Version 3.0                              */
  24.    /*  Copyright (C) Unix System Laboratories Inc. 1991.               */
  25.    /*  All rights reserved                                             */
  26.    /*                                                                  */
  27.    /********************************************************************/
  28.  
  29.    /**************************************************************************/
  30.    /*  C++ source for the C++ Language System, Release 3.0.  This product    */
  31.    /*  is a new release of the original cfront developed in the computer     */
  32.    /*  science research center of AT&T Bell Laboratories.                    */
  33.    /*                                                                        */
  34.    /*  Copyright (c) 1991 AT&T and UNIX System Laboratories, Inc.            */
  35.    /*  Copyright (c) 1984, 1989, 1990 AT&T.  All Rights Reserved.            */
  36.    /*                                                                        */
  37.    /*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of AT&T and UNIX System   */
  38.    /*  Laboratories, Inc.  The copyright notice above does not evidence      */
  39.    /*  any actual or intended publication of such source code.               */
  40.    /*                                                                        */
  41.    /*  UNIX is a registered trademark of UNIX System Laboratories, Inc.      */
  42.    /*                                                                        */
  43.    /*  ident "@(#)ctrans:incl-master/const-headers/iomanip.h 1.8"            */
  44.    /**************************************************************************/
  45.  
  46.    #include <generic.h>
  47.  
  48.    #ifndef IOSTREAMH
  49.    #include <iostream.h>
  50.    #endif
  51.  
  52.    #pragma pack(4)
  53.  
  54.    #define SMANIP(T)name2(smanip_,T)
  55.    #define SAPP(T)name2(sapply_,T)
  56.    #define IMANIP(T)name2(imanip_,T)
  57.    #define OMANIP(T)name2(omanip_,T)
  58.    #define IOMANIP(T)name2(iomanip_,T)
  59.    #define IAPP(T)name2(iapply_,T)
  60.    #define OAPP(T)name2(oapply_,T)
  61.    #define IOAPP(T)name2(ioapply_,T)
  62.  
  63.    #define IOMANIPdeclare(T)                                               \
  64.    class SMANIP(T) {                                                       \
  65.            ios& (*fct)(ios&,T) ;                                           \
  66.            T arg ;                                                         \
  67.    public:                                                                 \
  68.            SMANIP(T)(ios& (*f)(ios&, T), T a) :                            \
  69.                            fct(f), arg(a) { }                              \
  70.            friend istream& operator>>(istream& i, const SMANIP(T)& m) {    \
  71.                            ios* s = &i ;                                   \
  72.                            (*m.fct)(*s,m.arg) ; return i ; }               \
  73.            friend ostream& operator<<(ostream& o, const SMANIP(T)& m) {    \
  74.                            ios* s = &o ;                                   \
  75.                            (*m.fct)(*s,m.arg) ; return o ; }               \
  76.            } ;                                                             \
  77.    class SAPP(T) {                                                         \
  78.            ios& (*fct)(ios&, T) ;                                          \
  79.    public:                                                                 \
  80.            SAPP(T)(ios& (*f)(ios&,T)) : fct(f) { }                         \
  81.            SMANIP(T) operator()(T a) {                                     \
  82.                            return SMANIP(T)(fct,a) ; }                     \
  83.            } ;                                                             \
  84.    class IMANIP(T) {                                                       \
  85.            istream& (*fct)(istream&,T) ;                                   \
  86.            T arg ;                                                         \
  87.    public:                                                                 \
  88.            IMANIP(T)(istream& (*f)(istream&, T), T a ) :                   \
  89.                    fct(f), arg(a) { }                                      \
  90.            friend istream& operator>>(istream& s, const IMANIP(T)& m) {    \
  91.                    return(*m.fct)(s,m.arg) ;                               \
  92.                    }                                                       \
  93.            } ;                                                             \
  94.    class IAPP(T) {                                                         \
  95.            istream& (*fct)(istream&, T) ;                                  \
  96.    public:                                                                 \
  97.            IAPP(T)(istream& (*f)(istream&,T)) : fct(f) { }                 \
  98.            IMANIP(T) operator()(T a) {                                     \
  99.                            return IMANIP(T)(fct,a) ; }                     \
  100.            } ;                                                             \
  101.    class OMANIP(T) {                                                       \
  102.            ostream& (*fct)(ostream&,T) ;                                   \
  103.            T arg ;                                                         \
  104.    public:                                                                 \
  105.            OMANIP(T)(ostream& (*f)(ostream&, T), T a ) :                   \
  106.                    fct(f), arg(a) { }                                      \
  107.            friend ostream& operator<<(ostream& s, const OMANIP(T)& m) {    \
  108.                    return(*m.fct)(s,m.arg) ;                               \
  109.                    }                                                       \
  110.            } ;                                                             \
  111.    class OAPP(T) {                                                         \
  112.            ostream& (*fct)(ostream&, T) ;                                  \
  113.    public:                                                                 \
  114.            OAPP(T)(ostream& (*f)(ostream&,T)) : fct(f) { }                 \
  115.            OMANIP(T) operator()(T a) {                                     \
  116.                            return OMANIP(T)(fct,a) ; }                     \
  117.            } ;                                                             \
  118.    class IOMANIP(T) {                                                      \
  119.            iostream& (*fct)(iostream&,T) ;                                 \
  120.            T arg ;                                                         \
  121.    public:                                                                 \
  122.            IOMANIP(T)(iostream& (*f)(iostream&, T), T a ) :                \
  123.                    fct(f), arg(a) { }                                      \
  124.            friend istream& operator>>(iostream& s, const IOMANIP(T)& m) {  \
  125.                    return(*m.fct)(s,m.arg) ;                               \
  126.                    }                                                       \
  127.            friend ostream& operator<<(iostream& s, const IOMANIP(T)& m) {  \
  128.                    return(*m.fct)(s,m.arg) ;                               \
  129.                    }                                                       \
  130.            } ;                                                             \
  131.    class IOAPP(T) {                                                        \
  132.            iostream& (*fct)(iostream&, T) ;                                \
  133.    public:                                                                 \
  134.            IOAPP(T)(iostream& (*f)(iostream&,T)) : fct(f) { }              \
  135.            IOMANIP(T) operator()(T a) {                                    \
  136.                            return IOMANIP(T)(fct,a) ; }                    \
  137.            } ;                                                             \
  138.  
  139.  
  140.  
  141.    IOMANIPdeclare(int) ;
  142.    IOMANIPdeclare(long) ;
  143.  
  144.    SMANIP(int)     setbase(int b) ;        /* 10, 8, 16 or 0 */
  145.    SMANIP(long)    resetiosflags(long b) ;
  146.    SMANIP(long)    setiosflags(long b) ;
  147.    SMANIP(int)     setfill(int f);
  148.    SMANIP(int)     setprecision(int p);
  149.    SMANIP(int)     setw(int w) ;
  150.  
  151.    #pragma pack()
  152.  
  153. #endif
  154.  
  155. #pragma info( none )
  156. #ifndef __CHKHDR__
  157.    #pragma info( restore )
  158. #endif
  159. #pragma info( restore )
  160.