home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / Utilities / Comics-1.0-MIS / ComicsObj.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-09-25  |  5.0 KB  |  199 lines

  1. #import <AppKit/AppKit.h>
  2.  
  3. /*
  4.  File:       ComicsObj.h
  5.  
  6.  Contains:   Header file for the 3 classes used for the Comics database management:
  7.              CIssue, CTitle, CComics
  8.  
  9.  Written by: Eric Simenel
  10.  
  11.  Created:    May 1997
  12.  
  13.  Copyright:  (c)1997 by Apple Computer, Inc., all rights reserved.
  14.  
  15.  Change History (most recent first):
  16.  
  17.  You may incorporate this sample code into your applications without
  18.  restriction, though the sample code has been provided "AS IS" and the
  19.  responsibility for its operation is 100% yours.  However, what you are
  20.  not permitted to do is to redistribute the source as "DSC Sample Code"
  21.  after having made changes. If you're going to re-distribute the source,
  22.  we require that you make it clear in the source that the code was
  23.  descended from Apple Sample Code, but that you've made changes.
  24. */
  25.  
  26. #define debug 0
  27.  
  28. #define mskMarvel    0x0001
  29. #define mskDC        0x0002
  30. #define mskOther     0x0004
  31. #define mskBrand     0x0007
  32. #define mskNotBrand  0xFFF8
  33.  
  34. #define mskLong      0x0008
  35. #define mskMini      0x0010
  36. #define mskSeries    0x0018
  37. #define mskNotSeries 0xFFE7
  38.  
  39. #define mskMain      0x0020
  40. #define mskDual      0x0040
  41. #define mskKind      0x0060
  42. #define mskNotKind   0xFF9F
  43.  
  44. #define mskLive      0x0080
  45. #define mskDead      0x0100
  46. #define mskState     0x0180
  47. #define mskNotState  0xFE7F
  48.  
  49. #define mskMiss      0x0001
  50. #define mskPoor      0x0002
  51. #define mskGood      0x0004
  52. #define mskFine      0x0008
  53. #define mskMint      0x0010
  54. #define mskGrade     0x001F
  55. #define mskNotGrade  0xFFE0
  56.  
  57. #define mskComics    0x0020
  58. #define mskMagazine  0x0040
  59. #define mskNewForm   0x0080
  60. #define mskLuxe      0x0100
  61. #define mskType      0x01E0
  62. #define mskNotType   0xFE1F
  63.  
  64. #define mskStory     0x0200
  65. #define mskReprint   0x0400
  66. #define mskInfo      0x0800
  67. #define mskCntnt     0x0E00
  68. #define mskNotCntnt  0xF1FF
  69.  
  70. #define defaultFI   (mskMint | mskComics | mskStory)
  71.  
  72. @interface CIssue : NSObject
  73. {
  74.     @private
  75.     short issueFlags;
  76.     short issueNumber;
  77.     short editMonth;
  78.     short buyMonth;
  79. }
  80.  
  81. - (id)init;
  82. - (id)initWithIsh:(short)ish withEdit:(short)edit withBuy:(short)buy withFlag:(short)flag;
  83.  
  84. - (void)setIssueFlags:(short)value;
  85. - (short)issueFlags;
  86. - (void)setIssueNumber:(short)value;
  87. - (short)issueNumber;
  88. - (void)setEditMonth:(short)value;
  89. - (short)editMonth;
  90. - (void)setBuyMonth:(short)value;
  91. - (short)buyMonth;
  92.  
  93. - (NSString *)grade;
  94. - (NSString *)ishtype;
  95. - (NSString *)content;
  96.  
  97. - (id)initWithCoder:(NSCoder *)coder;
  98. - (void)encodeWithCoder:(NSCoder *)coder;
  99.  
  100. @end
  101.  
  102. @interface CTitle : NSObject
  103. {
  104.     @private
  105.     short titleFlags;
  106.     NSString *abb;
  107.     NSString *title;
  108.     NSMutableArray *issues;
  109. }
  110.  
  111. - (id)init;
  112. - (id)initWithAbb:(NSString *)theAbb withTitle:(NSString *)theTitle withFlag:(short)flag;
  113. - (void)dealloc;
  114.  
  115. - (void)setTitleFlags:(short)value;
  116. - (short)titleFlags;
  117. - (void)setAbb:(NSString *)value;
  118. - (NSString *)abb;
  119. - (void)setTitle:(NSString *)value;
  120. - (NSString *)title;
  121. - (short)nbIssues;
  122. - (void)setIssues:(NSMutableArray *)theArray;
  123. - (NSMutableArray *)issues;
  124.  
  125. - (NSString *)listIssues;
  126. - (NSString *)brand;
  127. - (NSString *)tstate;
  128. - (NSString *)series;
  129. - (NSString *)kind;
  130.  
  131. - (id)initWithCoder:(NSCoder *)coder;
  132. - (void)encodeWithCoder:(NSCoder *)coder;
  133.  
  134. - (short)findIssue:(short)byIshNum;
  135. - (short)addIssue:(CIssue *)theIssue;
  136. - (short)modIssue:(CIssue *)oldIssue withNewIssue:(CIssue *)newIssue;
  137. - (short)deleteIssue:(CIssue *)theIssue;
  138.  
  139. - (NSComparisonResult)compareAbb:(CTitle *)aTitle;
  140. - (NSComparisonResult)compareTitle:(CTitle *)aTitle;
  141. - (NSComparisonResult)compareChrono:(CTitle *)aTitle;
  142. - (NSComparisonResult)compareMaxIssue:(CTitle *)aTitle;
  143.  
  144. @end
  145.  
  146. @interface CComics : NSObject
  147. {
  148.     @private
  149.     short nbIssues;
  150.     short maxIssue;
  151.     short startEditMonth;
  152.     short lastEditMonth;
  153.     short startBuyMonth;
  154.     short lastBuyMonth;
  155.     NSMutableArray *titles;
  156. }
  157.  
  158. + (char *)cStrDate:(short)theMonth;
  159. + (NSString *)nsStrDate:(short)theMonth;
  160. - (id)init;
  161. - (void)dealloc;
  162. - (void)reset;
  163. - (void)setAll;
  164. - (void)setIssue:(CIssue *)theIssue;
  165.  
  166. - (short)nbIssues;
  167. - (void)modNbIssues:(short)delta;
  168. - (short)maxIssue;
  169. - (short)startEditMonth;
  170. - (short)lastEditMonth;
  171. - (short)startBuyMonth;
  172. - (short)lastBuyMonth;
  173. - (short)nbTitles;
  174. - (NSMutableArray *)titles;
  175. - (void)setTitles:(NSMutableArray *)theArray;
  176.  
  177. - (void)save:(id)sender;
  178. - (id)initWithCoder:(NSCoder *)coder;
  179. - (void)encodeWithCoder:(NSCoder *)coder;
  180.  
  181. - (void)sortArray:(NSMutableArray *)theArray withBrand:(short)brand withSeries:(short)series withKind:(short)kind withState:(short)state withSort:(short)sort;
  182.  
  183. - (short)findTitleByAbb:(NSString *)theAbb;
  184. - (short)findTitleByTitle:(NSString *)theTitle;
  185. - (short)addTitle:(CTitle *)theTitle;
  186. - (short)modTitle:(CTitle *)oldTitle withNewTitle:(CTitle *)newTitle;
  187. - (short)deleteTitle:(CTitle *)theTitle;
  188.  
  189. @end
  190.  
  191. // see comment on these globals in ComicsObj.m
  192. extern CComics *comicsBase;
  193. typedef struct {long lens[1001]; long nstrs[1001];} tnumstr;
  194. typedef unsigned char Str3[4];
  195. extern tnumstr gnumstr;
  196. extern Str3 gmonths[12];
  197. extern Str3 gnums[1000];
  198.  
  199. extern NSString *ComicsDidChangeNotification;