home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pc3270sa.zip / eclbase.hpp < prev    next >
C/C++ Source or Header  |  2002-02-28  |  3KB  |  81 lines

  1. //-------------------------------------------------------------------------------
  2. // Module:  eclbase.hpp
  3. //-------------------------------------------------------------------------------
  4. //
  5. // Description:  Base class for all ECL classes.  The members and methods defined 
  6. //               in this class are available in any of the ECL classes.
  7. //
  8. //-------------------------------------------------------------------------------
  9. // Copyright Notice: IBM Personal Communication/3270 Version 4.3
  10. //                   (C) COPYRIGHT IBM CORP. 1989,1998 - PROGRAM PROPERTY
  11. //                   OF IBM ALL RIGHTS RESERVED
  12. //-------------------------------------------------------------------------------
  13.  
  14. #ifndef _ECLBASE_HPP_
  15. #define _ECLBASE_HPP_
  16.  
  17. #include "eclopsys.hpp"
  18.  
  19. // Check for supported compiler and make compiler-specific mappings
  20.  
  21. #if defined(__IBMCPP__)  // IBM VisualAge C++
  22.   #define DllExport   _Export
  23. #elif defined(_MSC_VER)  // Microsoft Visual C++
  24.   #define DllExport   __declspec( dllexport )
  25. #else
  26.   #error Unsupported compiler for the IBM Emulator Class Library.
  27. #endif
  28.  
  29. #define HOSTTYPE_3270DISPLAY 'D'            // ECLConnection::GetConnType() values     
  30. #define HOSTTYPE_3270PRINTER 'E'
  31. #define HOSTTYPE_5250DISPLAY 'F'
  32. #define HOSTTYPE_5250PRINTER 'G'
  33. #define HOSTTYPE_VT          'H'
  34. #define HOSTTYPE_PC          'P'            // ...obsolete "PC" session
  35. #define HOSTTYPE_UNKNOWN     'U'            // Unknown, unable to query session
  36.  
  37. #define HOSTTYPE_MAXSTRLEN    20            // Max length required by ConvertTypeToString()
  38.  
  39. class ECLBaseData;                          // Forward declaration 
  40. class DllExport ECLBase
  41. {
  42.  
  43.   private: // Class private data
  44.     ECLBaseData *pd;                        
  45.  
  46.   public:
  47.     ECLBase();                              // Constructor
  48.     ~ECLBase();                             // Destructor
  49.  
  50.     // ECL handle/shortname conversion
  51.     char ConvertHandle2ShortName(long ConnHandle) const; // Convert numeric connection ID to EHLLAPI short name
  52.     long ConvertShortName2Handle(char ShortName) const;  // Ditto, in reverse
  53.  
  54.     // Static utilities
  55.     static int GetVersion(void);            // Get version number * 100 of ECL
  56.     static void ConvertTypeToString(int ConnType, char *TypeString); // Convert type integer to descriptive string (non-NLS)
  57.  
  58.     // Handy inline function to get row/col from pos given #of cols in PS.
  59.     // This is much faster then ECLPS::ConvertPosToRowCol() if the app 
  60.     // already knows the number of columns in the PS.
  61.     static inline void ConvertPos(ULONG Pos, ULONG *Row, ULONG *Col, ULONG PSCols) 
  62.     {
  63.       if(PSCols != 0)
  64.       {
  65.          *Col = ((Pos-1) % PSCols) + 1;        // Column number, 1-based
  66.          *Row = (Pos / (PSCols));              // Row number, 1-based
  67.          if (*Col != PSCols)                   // Not full line?
  68.            (*Row)++;                           // Row number, 1-based
  69.       }
  70.       else
  71.       {
  72.          *Col = *Row = 0L;
  73.       }
  74.     }
  75.  
  76. };
  77.  
  78. typedef ECLBase * PECLBase;
  79.  
  80. #endif //_ECLBASE_HPP_
  81.