home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / Classes / String / String.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-30  |  2.8 KB  |  89 lines

  1. //
  2. //    String.h -- a generic class to simplify manipulation of (char *)'s
  3. //        Written by Don Yacktman (c) 1993 by Don Yacktman.
  4. //                All rights reserved.
  5. //
  6. //        You may use and copy this class freely as long as you
  7. //        comply with the following terms:
  8. //            (1) If you use this class in an application which you
  9. //                intend to sell commercially, as shareware, or otherwise,
  10. //                you may only do so with express written permission
  11. //                of the author.  Use in applications which will
  12. //                be distributed free of charge is encouraged.
  13. //            (2) You must include the source code to this object and
  14. //                all accompanying documentation with your application,
  15. //                or provide it to users if requested, free of charge.
  16. //            (3) Do not remove the author's name or any of the
  17. //                copyright notices
  18. //
  19.  
  20. #import <appkit/appkit.h>
  21.  
  22. @interface String:Object
  23. {
  24.      char *buffer;
  25.      NXStringOrderTable *orderTable;
  26.      int length, _length;
  27. }
  28.  
  29. // basic allocation, deallocation methods
  30. - init;
  31. - allocateBuffer:(int)size;
  32. - allocateBuffer:(int)size fromZone:(NXZone *)zone;
  33. - read:(NXTypedStream *)stream;
  34. - write:(NXTypedStream *)stream;
  35. - freeString;
  36. - free;
  37.  
  38. // strcpy(), strlen() covers 
  39. - copyFromZone:(NXZone *)zone; // a -copy message calls this.
  40. - setString:(const char *)aString;
  41. - setString:(const char *)aString fromZone:(NXZone *)zone;
  42. - setStringValue:sender;
  43. - setStringValue:sender fromZone:(NXZone *)zone;
  44. - (const char *)stringValue;
  45. - (int)length;
  46.  
  47. // strcat(), strncat() covers
  48. - concatenate:sender;
  49. - concatenate:sender n:(int)n;
  50. - concatenate:sender fromZone:(NXZone *)zone;
  51. - concatenate:sender n:(int)n fromZone:(NXZone *)zone;
  52. - cat:(const char *)aString;
  53. - cat:(const char *)aString n:(int)n;
  54. - cat:(const char *)aString fromZone:(NXZone *)zone;
  55. - cat:(const char *)aString n:(int)n fromZone:(NXZone *)zone;
  56.  
  57. // index(), rindex() covers
  58. - (const char *)rindex:(char)aChar;
  59. - (const char *)index:(char)aChar;
  60.  
  61. // strcmp(), strncmp(), strcasecmp(), strncasecmp() covers
  62. - setStringOrderTable:(NXStringOrderTable *)table;
  63. - (NXStringOrderTable *)stringOrderTable;
  64. - (BOOL)isEqual:anObject;
  65. - (int)compareTo:sender;
  66. - (int)compareTo:sender n:(int)n;
  67. - (int)compareTo:sender caseSensitive:(BOOL)sense;
  68. - (int)compareTo:sender n:(int)n caseSensitive:(BOOL)sense;
  69. - (int)cmp:(const char *)aString;
  70. - (int)cmp:(const char *)aString n:(int)n;
  71. - (int)casecmp:(const char *)aString;
  72. - (int)casecmp:(const char *)aString n:(int)n;
  73.  
  74. // like BASIC's left$(), right$(), and mid$(); all return a new instance.
  75. - left:(int)count;
  76. - right:(int)count;
  77. - midFrom:(int)start to:(int)end;
  78. - midFrom:(int)start length:(int)len;
  79. - left:(int)count fromZone:(NXZone *)zone;
  80. - right:(int)count fromZone:(NXZone *)zone;
  81. - midFrom:(int)start to:(int)end fromZone:(NXZone *)zone;
  82. - midFrom:(int)start length:(int)len fromZone:(NXZone *)zone;
  83.  
  84. // private methods: do not use these!
  85. - _unhookBuffer;
  86.  
  87.  
  88. @end
  89.