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