home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vgserv45.zip / BASE / HPTWGS2 / include / fcwmap.h < prev    next >
Text File  |  2001-03-21  |  13KB  |  487 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /*                           OCO SOURCE MATERIALS                            */
  4. /*                             IBM CONFIDENTIAL                              */
  5. /*                                    OR                                     */
  6. /*                        IBM CONFIDENTIAL RESTRICTED                        */
  7. /*            WHEN COMBINED WITH THE AGGREGATED OCO SOURCE MODULES           */
  8. /*                           FOR THIS PROGRAM PRODUCT                        */
  9. /*                                                                           */
  10. /*      VisualAge Generator Server for OS/2, AIX, HP-UX, and Windows NT      */
  11. /*                          Version 3.0  5697-C28                            */
  12. /*                    (C) COPYRIGHT IBM CORP. 1994,1997                      */
  13. /*                                                                           */
  14. /*****************************************************************************/
  15. #ifndef FCWMAP_H
  16. #define FCWMAP_H
  17.  
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #include <memory.h>
  21. #include <stdarg.h>
  22. #include <stdio.h>
  23.  
  24. #define MAPPASSEDSAME 0
  25. #define MAPPASSEDDIFF 1
  26. #define NOMAPPASSED   2
  27.  
  28. //----------------------------------------------------------------------------
  29. //  Declare forward references                                               -
  30. //----------------------------------------------------------------------------
  31. class FCWApp;
  32. class iMap;
  33. class quadnum;
  34.  
  35. //----------------------------------------------------------------------------
  36. //  Map class definition...                                                  -
  37. //----------------------------------------------------------------------------
  38.  
  39. class Map : public Parameter
  40. {
  41.    friend class MAPCHA;
  42.    friend class MAPNUM;
  43.    friend class MAPMIX;
  44.    friend class MAPDBCS;
  45.  
  46.    private:
  47.       iMap*             piMap;
  48.       void*             pData;
  49.  
  50.    protected:
  51.  
  52.                         Map(char*, long);
  53.       virtual           ~Map();
  54.       FCWApp*           pApp();
  55.  
  56.    public:
  57.  
  58.       void              Setup(void* b=NULL);
  59.  
  60.       //-----------------------------------------------------------------------
  61.       // SET statement functions                                              -
  62.       //-----------------------------------------------------------------------
  63.       void              SetClear();
  64.       void              SetEmpty();
  65.       void              SetAlarm();
  66.       void              SetPage();
  67.  
  68.       //-----------------------------------------------------------------------
  69.       // Process option functions                                             -
  70.       //-----------------------------------------------------------------------
  71.       void              Display();
  72.       void              Converse();
  73.       void              Close();
  74.  
  75.       //-----------------------------------------------------------------------
  76.       // TEST functions                                                       -
  77.       //-----------------------------------------------------------------------
  78.       Bool              IsModified();
  79.       Bool              TestModified();
  80.  
  81.       //-----------------------------------------------------------------------
  82.       // other                                                                -
  83.       //-----------------------------------------------------------------------
  84.       virtual void      StatementGroupEdits() {};
  85.       virtual ItemType  itemType() const { return tMAP; };
  86.  
  87.       long              ParmSize();
  88.       char*             ParmData();
  89.       void              VerifyAndRetrieveFirstMap();
  90.       FCWString const&  Name();
  91.  
  92.       // For RPC
  93.       int&              fNumberOfRPCEntries();
  94.       LIST(RPCParm*)&   RPCList();
  95.       void              SetupRpc();
  96. };
  97.  
  98. //----------------------------------------------------------------------------
  99. //  Map item types...                                                        -
  100. //----------------------------------------------------------------------------
  101.  
  102. class  iMapItem;                       /* forward reference                */
  103.  
  104. class MapItem
  105. {
  106.    public:
  107.  
  108.       // SET map-item methods
  109.       void SetCursor()                          const;
  110.       void SetNormal()                          const;
  111.       void SetDefined()                         const;
  112.       void SetAttribute( Color::enum_Color )    const;
  113.       void SetAttribute( Hilite::enum_Hilite )  const;
  114.       void SetAttribute( unsigned char )        const;
  115.  
  116.       // TEST map-item methods
  117.       Bool HasCursor()                          const;
  118.       Bool IsBlank()                            const;
  119.       Bool IsNull()                             const;
  120.       Bool HasData()                            const;
  121.       Bool IsModified()                         const;
  122.       Bool TestModified()                       const;
  123.       int  InputLength()                        const;
  124.       void SetSelected()                        const;           // @6653
  125.  
  126.       // others
  127.       MapItem operator[] (quadnum)              const;
  128.  
  129.       MapItem(iMap* p, int occ, int off, int len);
  130.       MapItem(MapItem const& mi, int index);
  131.       virtual ~MapItem();
  132.  
  133.    protected:
  134.       void               SetEmpty()             const;
  135.       void               SetClear()             const;
  136.  
  137.    private:
  138.       iMapItem*          piMapItem;
  139.       void*              pData;
  140. };
  141.  
  142. inline Bool MapItem :: IsBlank()    const
  143. {
  144.    return (!InputLength());
  145. }
  146.  
  147. inline Bool MapItem :: IsNull()     const
  148. {
  149.    return (!InputLength());
  150. }
  151.  
  152. inline Bool MapItem :: HasData()    const
  153. {
  154.    return (InputLength() != 0);
  155. }
  156.  
  157. //---------------------------------------------------------------------------
  158. //  MAPCHA                                                                  -
  159. /* ---------------------------------------------------------------------------*/
  160.  
  161. class MAPCHA : public CHA, public MapItem
  162. {
  163.   public:
  164.     MAPCHA (Map& p, int occ, int off, int len);
  165.     MAPCHA (const MAPCHA& mc, int index);
  166.     MAPCHA (const MAPCHA& mc, quadnum index);
  167.     virtual ~MAPCHA();
  168.  
  169.     MAPCHA operator[] (quadnum) const;
  170.  
  171.     virtual void SetEmpty() const;
  172.     virtual void SetClear();
  173.     Bool IsBlank();
  174.     Bool IsNull()                             const;
  175.  
  176.     void operator = (const CHA& v);
  177.     void operator = (const MAPCHA& v);
  178.     void operator = (const HEX& v);
  179.     void operator = (const MIX& v);
  180.     void operator = (const NUM& v);
  181.     void operator = (const char *v);
  182.     void operator = (const quadnum& v );
  183.     void operator = (const int v );
  184.  
  185.   private:
  186.     void*     pData;
  187. };
  188.  
  189. inline void MAPCHA :: SetEmpty () const
  190. {
  191.    CHA :: SetEmpty();
  192.    MapItem :: SetEmpty();
  193. }
  194.  
  195. inline void MAPCHA :: SetClear()
  196. {
  197.    SetEmpty();
  198.    MapItem :: SetClear();
  199. }
  200.  
  201. inline void MAPCHA :: operator = (const CHA& v)
  202. {
  203.    SetSelected();
  204.    CHA :: operator  = (v);
  205. }
  206.  
  207. inline void MAPCHA :: operator = (const MAPCHA& v)
  208. {
  209.    SetSelected();
  210.    CHA :: operator  = (v);
  211. }
  212.  
  213. inline void MAPCHA :: operator = (const HEX& v)
  214. {
  215.    SetSelected();
  216.    CHA :: operator  = (v);
  217. }
  218.  
  219. inline void MAPCHA :: operator = (const MIX& v)
  220. {
  221.    SetSelected();
  222.    CHA :: operator  = (v);
  223. }
  224.  
  225. inline void MAPCHA :: operator = (const NUM& v)
  226. {
  227.    SetSelected();
  228.    CHA :: operator  = (v);
  229. }
  230.  
  231. inline void MAPCHA :: operator = (const char *v)
  232. {
  233.    SetSelected();
  234.    CHA :: operator  = (v);
  235. }
  236.  
  237. inline void MAPCHA :: operator = (const quadnum& v )
  238. {
  239.    SetSelected();
  240.    CHA :: operator  = (v);
  241. }
  242.  
  243. inline void MAPCHA :: operator = (const int v )
  244. {
  245.    *this = quadnum(v);
  246. }
  247.  
  248. inline Bool MAPCHA :: IsBlank()
  249. {
  250.    return MapItem :: IsBlank();
  251. }
  252.  
  253. inline Bool MAPCHA :: IsNull() const
  254. {
  255.    return MapItem :: IsNull();
  256. }
  257.  
  258. //---------------------------------------------------------------------------
  259. // MAPNUM                                                                   -
  260. //---------------------------------------------------------------------------
  261.  
  262. class MAPNUM : public NUM, public MapItem
  263. {
  264.   public:
  265.  
  266.     MAPNUM (Map& p, int occ, int off, int len, int dec=0);
  267.     MAPNUM (const MAPNUM& mn, int index);
  268.     MAPNUM (const MAPNUM& mn, quadnum index);
  269.     virtual ~MAPNUM();
  270.  
  271.     virtual void SetEmpty() const;
  272.     virtual void SetClear();
  273.     Bool IsNull()                             const;
  274.  
  275.     MAPNUM operator [] (quadnum) const;
  276.  
  277.     void operator = (const NUM&);
  278.     void operator = (const MAPNUM& v);
  279.     void operator <<= (const NUM&);
  280.     void operator = (const CHA& v);
  281.     void operator = (const quadnum& v);
  282.     void operator <<= (const quadnum& v);
  283.  
  284.   private:
  285.     void*     pData;
  286. };
  287.  
  288. inline void MAPNUM :: SetEmpty () const
  289. {
  290.    NUM :: SetEmpty();
  291.    MapItem :: SetEmpty();
  292. }
  293.  
  294. inline void MAPNUM :: SetClear()
  295. {
  296.    SetEmpty();
  297.    MapItem :: SetClear();
  298. }
  299.  
  300. inline void MAPNUM :: operator = (const NUM& v)
  301. {
  302.    SetSelected();
  303.    NUM :: operator = ( v );
  304. }
  305.  
  306. inline void MAPNUM :: operator = (const MAPNUM& v)
  307. {
  308.    SetSelected();
  309.    NUM :: operator = ( v );
  310. }
  311.  
  312. inline void MAPNUM :: operator <<= (const NUM& v)
  313. {
  314.    SetSelected();
  315.    NUM :: operator <<= ( v );
  316. }
  317.  
  318. inline void MAPNUM :: operator = (const CHA& v)
  319. {
  320.    SetSelected();
  321.    NUM :: operator = ( v );
  322. }
  323.  
  324. inline void MAPNUM :: operator = (const quadnum& v)
  325. {
  326.    SetSelected();
  327.    NUM :: operator = ( v );
  328. }
  329.  
  330. inline void MAPNUM :: operator <<= (const quadnum& v)
  331. {
  332.    SetSelected();
  333.    NUM :: operator <<= ( v );
  334. }
  335.  
  336. inline Bool MAPNUM :: IsNull() const
  337. {
  338.    return MapItem :: IsNull();
  339. }
  340.  
  341. /* ---------------------------------------------------------------------------*/
  342. /* MAPMIX                                                                   -*/
  343. /* ---------------------------------------------------------------------------*/
  344.  
  345. class MAPMIX : public MIX, public MapItem
  346. {
  347.   public:
  348.  
  349.     MAPMIX (Map& p, int occ, int off, int len);
  350.     MAPMIX (const MAPMIX& mn, int index);
  351.     MAPMIX (const MAPMIX& mn, quadnum index);
  352.     virtual ~MAPMIX();
  353.  
  354.     virtual void SetEmpty() const;
  355.     virtual void SetClear();
  356.     Bool IsNull()                             const;
  357.  
  358.     MAPMIX operator [] (quadnum) const;
  359.  
  360.     void operator = (const MIX& v);
  361.     void operator = (const MAPMIX& v);
  362.     void operator = (const CHA& v);
  363.     void operator = (const char *v);
  364.     Bool IsBlank();
  365.  
  366.   private:
  367.     void*     pData;
  368. };
  369.  
  370. inline void MAPMIX :: SetEmpty () const
  371. {
  372.    MIX :: SetEmpty();
  373.    MapItem :: SetEmpty();
  374. }
  375.  
  376. inline void MAPMIX :: SetClear()
  377. {
  378.    SetEmpty();
  379.    MapItem :: SetClear();
  380. }
  381.  
  382. inline void MAPMIX :: operator = (const MIX& v)
  383. {
  384.    SetSelected();
  385.    MIX :: operator = ( v );
  386. }
  387.  
  388. inline void MAPMIX :: operator = (const MAPMIX& v)
  389. {
  390.    SetSelected();
  391.    MIX :: operator = ( v );
  392. }
  393.  
  394. inline void MAPMIX :: operator = (const CHA& v)
  395. {
  396.    SetSelected();
  397.    MIX :: operator = ( v );
  398. }
  399.  
  400. inline void MAPMIX :: operator = (const char *v)
  401. {
  402.    SetSelected();
  403.    MIX :: operator = ( v );
  404. }
  405.  
  406.  
  407. inline Bool MAPMIX :: IsBlank ()
  408. {
  409.    return ( MapItem :: IsBlank() );
  410. }
  411.  
  412. inline Bool MAPMIX :: IsNull() const
  413. {
  414.    return MapItem :: IsNull();
  415. }
  416.  
  417. //---------------------------------------------------------------------------
  418. // MAPDBCS                                                                  -
  419. //---------------------------------------------------------------------------
  420.  
  421. class MAPDBCS : public DBCS, public MapItem
  422. {
  423.   public:
  424.  
  425.     MAPDBCS (Map& p, int occ, int off, int len);
  426.     MAPDBCS (const MAPDBCS& mn, int index);
  427.     MAPDBCS (const MAPDBCS& mn, quadnum index);
  428.     virtual ~MAPDBCS();
  429.  
  430.     virtual void SetEmpty() const;
  431.     virtual void SetClear();
  432.     Bool IsNull()                             const;
  433.  
  434.     MAPDBCS operator [] (quadnum) const;
  435.  
  436.     void operator = (const DBCS& v);
  437.     void operator = (const MAPDBCS& v);
  438.     void operator = (const char *v);
  439.  
  440.     Bool IsBlank();
  441.  
  442.   private:
  443.     void*     pData;
  444. };
  445.  
  446. inline void MAPDBCS :: SetEmpty () const
  447. {
  448.    DBCS :: SetEmpty();
  449.    MapItem :: SetEmpty();
  450. }
  451.  
  452. inline void MAPDBCS :: SetClear()
  453. {
  454.    SetEmpty();
  455.    MapItem :: SetClear();
  456. }
  457.  
  458. inline void MAPDBCS :: operator = (const DBCS& v)
  459. {
  460.    SetSelected();
  461.    DBCS :: operator = ( v );
  462. }
  463.  
  464. inline void MAPDBCS :: operator = (const MAPDBCS& v)
  465. {
  466.    SetSelected();
  467.    DBCS :: operator = ( v );
  468. }
  469.  
  470. inline void MAPDBCS :: operator = (const char *v)
  471. {
  472.    SetSelected();
  473.    DBCS :: operator = ( v );
  474. }
  475.  
  476. inline Bool MAPDBCS :: IsBlank ()
  477. {
  478.    return ( MapItem :: IsBlank() );
  479. }
  480.  
  481. inline Bool MAPDBCS :: IsNull() const
  482. {
  483.    return MapItem :: IsNull();
  484. }
  485.  
  486. #endif
  487.