home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / YellowBox / Kits / MiscTableScroll-138.1 / Palettes / MiscTableScroll / Framework / MiscExporterPrivate.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-31  |  3.7 KB  |  127 lines

  1. #ifndef __MiscExporterPrivate_h
  2. #define __MiscExporterPrivate_h
  3. //=============================================================================
  4. //
  5. //    Copyright (C) 1996-1997 by Paul S. McCarthy and Eric Sunshine.
  6. //        Written by Paul S. McCarthy and Eric Sunshine.
  7. //                All Rights Reserved.
  8. //
  9. //    This notice may not be removed from this source code.
  10. //
  11. //    This object is included in the MiscKit by permission from the authors
  12. //    and its use is governed by the MiscKit license, found in the file
  13. //    "License.rtf" in the MiscKit distribution.  Please refer to that file
  14. //    for a list of all applicable permissions and restrictions.
  15. //    
  16. //=============================================================================
  17. //-----------------------------------------------------------------------------
  18. // MiscExporterPrivate.h
  19. //
  20. //    Private, internal communication and utility routines for the
  21. //    MiscExporter class.
  22. //
  23. //-----------------------------------------------------------------------------
  24. //-----------------------------------------------------------------------------
  25. // $Id: MiscExporterPrivate.h,v 1.4 97/04/15 08:58:07 sunshine Exp $
  26. // $Log:    MiscExporterPrivate.h,v $
  27. //  Revision 1.4  97/04/15  08:58:07  sunshine
  28. //  v0.125.8: Added "MiscTableScroll/" prefix to #import to facilitate new
  29. //  framework organization.
  30. //  
  31. //  Revision 1.3  97/03/10  10:29:16  sunshine
  32. //  v113.1: For OpenStep conformance, many 'col' methods renamed to 'column'.
  33. //  
  34. //  Revision 1.2  97/02/07  13:53:11  sunshine
  35. //  v108: Ported to OPENSTEP 4.1 (gamma).
  36. //-----------------------------------------------------------------------------
  37. #import <MiscTableScroll/MiscExporter.h>
  38. #import    <MiscTableScroll/MiscTableScroll.h>
  39.  
  40. extern "Objective-C" {
  41. #import    <AppKit/NSCell.h>
  42. }
  43.  
  44. extern "C" {
  45. #import    <stdio.h>
  46. #import    <string.h>
  47. }
  48.  
  49.  
  50. @interface MiscExporter(Private)
  51. - (int*)makeColMap:(int)ncols;
  52. - (int)rowTitleCharWidth:(int) nrows;
  53. @end
  54.  
  55. @interface MiscExporter(ASCII)
  56. - (void)exportFixed:(FILE*)fp;
  57. - (void)exportTab:(FILE*)fp;
  58. - (void)exportDelimited:(FILE*)fp;
  59. @end
  60.  
  61. @interface MiscExporter(DBF)
  62. - (void)exportDBF:(FILE*)fp;
  63. @end
  64.  
  65. //-----------------------------------------------------------------------------
  66. // safe_strlen
  67. //-----------------------------------------------------------------------------
  68. inline static int safe_strlen( NSString* s )
  69.     {
  70.     return (s != 0 ? [s length] : 0);
  71.     }
  72.  
  73.  
  74. //-----------------------------------------------------------------------------
  75. // safe_strlen
  76. //-----------------------------------------------------------------------------
  77. inline static int safe_strlen( char const* s )
  78.     {
  79.     return (s != 0 ? strlen(s) : 0);
  80.     }
  81.  
  82.  
  83. //-----------------------------------------------------------------------------
  84. // repchar
  85. //-----------------------------------------------------------------------------
  86. inline static void repchar( int rep, char c, FILE* fp )
  87.     {
  88.     for (int i = 0; i < rep; i++)
  89.     fputc( c, fp );
  90.     }
  91.  
  92.  
  93. //-----------------------------------------------------------------------------
  94. // pad
  95. //-----------------------------------------------------------------------------
  96. inline static void pad( int len, FILE* fp )
  97.     {
  98.     repchar( len, ' ', fp );
  99.     }
  100.  
  101.  
  102. inline static int row_at( int visual_pos, id obj )
  103.     { return [obj rowAtPosition:visual_pos]; }
  104.  
  105.  
  106. inline static int col_at( int visual_pos, id obj )
  107.     { return [obj columnAtPosition:visual_pos]; }
  108.  
  109.  
  110. inline static id cell_at( int r, int c, id obj )
  111.     { return [obj cellAtRow:r column:c]; }
  112.  
  113.  
  114. inline static NSString* str_at( int r, int c, id obj )
  115.     { return [obj stringValueAtRow:r column:c]; }
  116.  
  117.  
  118. inline static NSString* col_title( int c, id obj )
  119.     { return [obj columnTitle:c]; }
  120.  
  121.  
  122. inline static NSString* row_title( int r, id obj )
  123.     { return [obj rowTitle:r]; }
  124.  
  125.  
  126. #endif // __MiscExporterPrivate_h
  127.