home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / appkit / NXSpellServer.h < prev    next >
Text File  |  1991-12-05  |  3KB  |  79 lines

  1. #import <objc/List.h>
  2. #imporUETeadOnlyTextStream.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.  
  13. @interface NXSpellServer : Object
  14. {
  15. @private        /* these are private and are */
  16.     id delegate;    /* subject to change in any future */
  17.     id guesses;        /* release, so don't access them! */
  18.     id spellServer;
  19.     void *dictionaries;
  20.     id realTextStream;
  21.     id learnedDictionaries;
  22.     id forgottenDictionaries;
  23.     BOOL delegateLearnsWords;
  24.     BOOL delegateForgetsWords;
  25.     BOOL padBOOL1, padBOOL2;
  26.     int caseSensitive;
  27.     void *reserved;
  28. }
  29.  
  30. - setDelegate:anObject;
  31. - delegate;
  32.  
  33. /* Used to check in */
  34.  
  35. - (BOOL)registerLanguage:(const char *)language byVendor:(const char *)vendor;
  36.  
  37. /* Way to query user's private dictionary(ies). */
  38.  
  39. - (BOOL)isInUserDictionary:(const char *)word caseSensitive:(BOOL)flag;
  40.  
  41. /* Call back used inside implementations of suggestGuessesForWord:inLanguage:. */
  42.  
  43. - addGuess:(const char *)guess;
  44.  
  45. /* Waits for spell-check request to come in. */
  46.  
  47. - run;
  48.  
  49. @end
  50.  
  51. /*
  52. 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.
  53.  
  54. 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.
  55. */
  56.  
  57. @interface Object(NXSpellServerDelegate)
  58.  
  59. - (BOOL)spellServer:(NXSpellServer *)sender
  60.  findMisspelledWord:(int *)start
  61.          length:(int *)length
  62.      inLanguage:(const char *)language
  63.        inTextStream:(id <NXReadOnlyTextStream>)textStream
  64.          startingAt:(int)startPosition
  65.       wordCount:(int *)wordCount
  66.       countOnly:(BOOL)countOnly;
  67.  
  68. - (void)spellServer:(NXSpellServer *)sender
  69.     suggestGuessesForWord:(const char *)wUEU           inLanguage:(const char *)language;
  70.  
  71. - (void)spellServer:(NXSpellServer *)sender
  72.        didLearnWord:(const char *)word
  73.          inLanguage:(const char *)language;
  74. - (void)spellServer:(NXSpellServer *)sender
  75.       didForgetWord:(const char *)word
  76.          inLanguage:(const char *)language;
  77.  
  78. @end
  79.