diff options
Diffstat (limited to 'common/quicktime_win32/HITextUtils.h')
| -rw-r--r-- | common/quicktime_win32/HITextUtils.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/common/quicktime_win32/HITextUtils.h b/common/quicktime_win32/HITextUtils.h new file mode 100644 index 0000000..7b03bfb --- /dev/null +++ b/common/quicktime_win32/HITextUtils.h @@ -0,0 +1,128 @@ +/* + File: HITextUtils.h + + Contains: Text utilities provided by HIToolbox. + + Version: QuickTime 7.3 + + Copyright: (c) 2007 (c)2002 by Apple Computer, Inc., all rights reserved. + + Bugs?: For bug reports, consult the following page on + the World Wide Web: + + http://developer.apple.com/bugreporter/ + +*/ +#ifndef __HITEXTUTILS__ +#define __HITEXTUTILS__ + +#ifndef __MACTYPES__ +#include <MacTypes.h> +#endif + +#ifndef __COREFOUNDATION__ +#include <CoreFoundation.h> +#endif + +#ifndef __TEXTCOMMON__ +#include <TextCommon.h> +#endif + + + +#if PRAGMA_ONCE +#pragma once +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if PRAGMA_IMPORT +#pragma import on +#endif + +/* + * GetTextAndEncodingFromCFString() + * + * Summary: + * Converts the contents of a CFString to the one- or two-byte + * encoding that most accurately represents the original Unicode + * characters in the string. + * + * Discussion: + * Because the Macintosh toolbox has had, until Carbon, little + * support for Unicode, you may often find that your applications + * need to translate a CFString (containing Unicode characters) back + * to a one- or two-byte encoding of the string in order to draw, + * measure, or otherwise use the text in the string. + * GetTextAndEncodingFromCFString is a utility that may be helpful + * to do this, in some circumstances. The Carbon toolbox uses this + * API itself when translating CFStrings to Pascal strings. + * GetTextAndEncodingFromCFString attempts to convert the Unicode + * characters in the string to the closest non-Unicode + * representation of the string. For example, a string containing + * only Unicode characters that are present in the MacRoman one-byte + * encoding will be translated to MacRoman, and + * kTextEncodingMacRoman will be returned as the encoding of the + * text. A string containing Unicode characters that are present in + * the MacJapanese two-byte encoding will be translated to + * MacJapanese (Shift-JIS), and kTextEncodingMacJapanese will be + * returned as the encoding of the text. + * GetTextAndEncodingFromCFString is designed to be used for simple + * strings which contain only text from a single language. It is not + * designed to translate strings with multiple runs of text from + * different languages, and will only return the first run of such a + * string; for example, if you pass it a string containing a run of + * Roman characters followed by a run of Japanese characters, it + * will only return the Roman characters in the output buffer. For + * more complex text translation, you should call the Unicode + * converter directly (see ConvertFromUnicodeToTextRun, which + * GetTextAndEncodingFromCFString uses internally). + * + * Parameters: + * + * inString: + * The string to convert. + * + * outText: + * The output buffer in which to place the converted text. + * + * inTextMaxLength: + * The length in bytes of the input buffer. + * + * outTextLength: + * On exit, contains the length in bytes of the text that was + * placed into the output buffer. + * + * outEncoding: + * On exit, contains the encoding of the text that was placed into + * the output buffer. + * + * Availability: + * Non-Carbon CFM: not available + * CarbonLib: in CarbonLib 1.2.5 and later + * Mac OS X: in version 10.0 and later + */ +EXTERN_API( OSStatus ) +GetTextAndEncodingFromCFString( + CFStringRef inString, + BytePtr outText, + ByteCount inTextMaxLength, + ByteCount * outTextLength, + TextEncoding * outEncoding); /* can be NULL */ + + + +#ifdef PRAGMA_IMPORT_OFF +#pragma import off +#elif PRAGMA_IMPORT +#pragma import reset +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __HITEXTUTILS__ */ + |