home *** CD-ROM | disk | FTP | other *** search
-
- // rtf2ascii.h
-
- #import <string.h>
- #import <streams/streams.h>
-
- #define RTF_HEADER "{\\rtf0\\ansi"
- #define RTF_HEADER_LEN 11
-
-
- // A predicate to quickly check a region of possibly-rich memory (starting
- // at rtfText and going for length len) to see if it is convertible by the
- // following routines.
-
- static inline int isRTFText(const char * rtfText, int len)
- {
- return (rtfText
- && (len > RTF_HEADER_LEN)
- && !strncmp(rtfText, RTF_HEADER, RTF_HEADER_LEN));
- }
-
-
- // A memory-buffer-based conversion that reads one buffer pointed to by
- // rtfTextPtr and converts, for length rtfTextLen, RTF to ASCII. A pointer
- // to a newly allocated buffer of memory is returned (caller owns this
- // memory). Additionally, asciiTextLen is set to the length of the
- // null-terminated ascii character buffer.
-
- extern const char * rtfToAscii( const char *rtfTextPtr,
- int rtfTextLen,
- int * asciiTextLen );
-
-
- // A streams-based converter which takes an NXStream and either returns back
- // a new memory stream that has been converted to straight ASCII (the caller
- // should free this with NXCloseMemory()).
-
- extern NXStream * rtfToAsciiStream(NXStream * possiblyRichStream);
-
-