home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks3 / AppKit.framework / Headers / NSSpellServer.h < prev    next >
Text File  |  1996-03-27  |  2KB  |  65 lines

  1. #import <Foundation/NSObject.h>
  2. #import <Foundation/NSRange.h>
  3.  
  4. /*
  5. The server just handles all the checking in and IAC and delegates the real work to its delegate.  A single server can handle more than one language.  Services is used to rendezvous applications with servers.  The format of a services descriptor for a spell-checker:
  6.  
  7. Spell Checker: NeXT
  8. Language: French
  9. Language: English
  10. Executable: franglais.daemon
  11. */
  12. @class NSString;
  13. @class NSArray;
  14.  
  15. @interface NSSpellServer : NSObject
  16. {
  17. @private        /* these are private and are */
  18.     id delegate;    /* subject to change in any future */
  19.     id guesses;        /* release, so don't access them! */
  20.     id spellServer;
  21.     void *dictionaries;
  22.     id realTextStream;
  23.     id learnedDictionaries;
  24.     id forgottenDictionaries;
  25.     BOOL delegateLearnsWords;
  26.     BOOL delegateForgetsWords;
  27.     BOOL padBOOL1, padBOOL2;
  28.     int caseSensitive;
  29.     void *reserved;
  30. }
  31.  
  32. - setDelegate:anObject;
  33. - delegate;
  34.  
  35. /* Used to check in */
  36.  
  37. - (BOOL)registerLanguage:(NSString *)language byVendor:(NSString *)vendor;
  38.  
  39. /* Way to query user's private dictionary(ies). */
  40.  
  41. - (BOOL)isInUserDictionary:(NSString *)word caseSensitive:(BOOL)flag;
  42.  
  43. /* Waits for spell-check request to come in. */
  44.  
  45. - run;
  46.  
  47. @end
  48.  
  49. /*
  50. This is the protocol the object in the server that does the real work actually must respond to.  The first method checks spelling and the second suggests proper corrections.  The second (guessing) method is optional.
  51.  
  52. The argument wordCount is an out parameter.  It should return the number of words found in the document from startPosition until the misspelled word was found (or the end of the stream)  If your spell server can't count words (though it is hard to imagine why that might be), return -1 in wordCount.  countOnly of YES means forget about checking the spelling of words, just count them until you get to the end of the stream.
  53. */
  54.  
  55. @interface NSObject(NXSpellServerDelegate)
  56.  
  57. - (NSRange)spellServer:(NSSpellServer *)sender findMisspelledWordInString:(NSString *)stringToCheck language:(NSString *)language wordCount:(int *)wordCount countOnly:(BOOL)countOnly;
  58.  
  59. - (NSArray *)spellServer:(NSSpellServer *)sender suggestGuessesForWord:(NSString *)word inLanguage:(NSString *)language;
  60.  
  61. - (void)spellServer:(NSSpellServer *)sender didLearnWord:(NSString *)word inLanguage:(NSString *)language;
  62. - (void)spellServer:(NSSpellServer *)sender didForgetWord:(NSString *)word inLanguage:(NSString *)language;
  63.  
  64. @end
  65.