home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / SourceCode / Palettes / PAStringList / PAStringList.h < prev    next >
Encoding:
Text File  |  1993-05-12  |  3.0 KB  |  81 lines

  1. #import <appkit/appkit.h>
  2.  
  3. /******************************************************************************
  4. PAStringList
  5.  
  6.     The PAStringList (a subclass of Storage) is a convenient way to deal with lists of character strings. It contains methods for adding strings, inserting strings, sorting strings and searching for strings.
  7.         
  8.     The PAStringList can also add strings from a delimited string (such as the ones passed to an app by the workspace). The delimiters can be supplied or assumed to be white space.
  9.     
  10.     Finally, the PAStringList implements a browser delegate method so that it can easily display itself if set to be a browser delegate.
  11.  
  12.     Copyright 1992, Jeff Martin (jmartin@next.com) (415) 780-3833.
  13. ******************************************************************************/
  14.  
  15. @interface PAStringList : Storage
  16. {
  17.     BOOL    isSorted;            // Whether or not the list is currently sorted
  18. }
  19.  
  20. // Convenience adding methods (defaulting to ifAbsent=NO, noCopy=NO, 
  21. //        sorted=NO and at=count)
  22. - addString:(const char *)string;
  23. - addStringIfAbsent:(const char *)string;
  24. - addStringNoCopy:(const char *)string;
  25. - addStringIfAbsentNoCopy:(const char *)string;
  26.  
  27. - addString:(const char *)string at:(int)at;
  28. - addStringIfAbsent:(const char *)string at:(int)at;
  29. - addStringNoCopy:(const char *)string at:(int)at;
  30. - addStringIfAbsentNoCopy:(const char *)string at:(int)at;
  31.  
  32. - addStringSorted:(const char *)string;
  33. - addStringIfAbsentSorted:(const char *)string;
  34. - addStringNoCopySorted:(const char *)string;
  35. - addStringIfAbsentNoCopySorted:(const char *)string;
  36.  
  37. // The main adding method (all other adds call this)
  38. - addString:(const char *)string ifAbsent:(BOOL)ifAbsent noCopy:(BOOL)noCopy sorted:(BOOL)sorted at:(int)at;
  39.  
  40. // Adding Multiple strings
  41. - addStrings:(const char *const*)strings;
  42. - addStrings:(const char *const*)strings ifAbsent:(BOOL)ifAbsent noCopy:(BOOL)noCopy sorted:(BOOL)sorted at:(int)at;
  43.  
  44. // Adding another PAStringList
  45. - addPAStringList:stringListObject;
  46. - addPAStringList:stringListObject ifAbsent:(BOOL)ifAbsent noCopy:(BOOL)noCopy sorted:(BOOL)sorted at:(int)at;
  47.  
  48. // Adding individual strings from delimited (tab or otherwise) string
  49. - addDelimitedStrings:(const char *)string delimiters:(const char *)dels;
  50. - addDelimitedStrings:(const char *)string delimiters:(const char *)dels ifAbsent:(BOOL)ifAbsent sorted:(BOOL)sorted at:(int)at;
  51.  
  52. // Finding strings in list
  53. - (const char *const*)strings;
  54. - (const char *)stringAt:(int)at;
  55.  
  56. // Finding the index of a given string and/or whether it is in list
  57. - (BOOL)stringExists:(const char *)string;
  58. - (unsigned)indexOfString:(const char *)string;
  59. - (unsigned)indexOfString:(const char *)string exists:(BOOL *)exists;
  60.  
  61. // Removing strings from list
  62. - removeString:(const char *)string;
  63. - removeStrings:(const char *const*)strings;
  64. - (char *)removeStringAt:(int)at;
  65.  
  66. // Sorting list
  67. - (BOOL)isSorted;
  68. - sortStrings:sender;
  69.  
  70. // Archiving
  71. - write:(NXTypedStream *)stream;
  72. - read:(NXTypedStream *)stream;
  73.  
  74. // Cleanup
  75. - freeStrings;
  76. - free;
  77.  
  78. // Bonus NXBrowser support
  79. - (int)browser:sender fillMatrix:matrix inColumn:(int)column;
  80.  
  81. @end