Ignore:
Timestamp:
Mar 31, 2010, 9:50:47 PM (12 years ago)
Author:
dmik
Message:

branches/kmk: Added a bunch of unicode conversion helpers based on the original propcnv() from lupoppler.cpp.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/kmk/Lucide/plugins/ludoc/cpconv.h

    r156 r337  
    3737
    3838#include <unidef.h>
     39#include <uconv.h>
    3940
    4041#ifdef __cplusplus
     
    5354// src remains unchanged
    5455VOID APIENTRY uniReplaceLigatures( UniChar *src, UniChar *dst );
    55                            
     56
     57// Converts the string from one encoding to another
     58// the returned string is allocated with the new[] operator
     59// if s is NULL, NULL is returned
     60// both from and to must be valid encodings, otherwise the results are undefined
     61// retLen may be NULL if the length of the returned buffer is not needed
     62char *APIENTRY uniConvertString( const char *s, size_t len, UconvObject from,
     63                                 UconvObject to, size_t *retLen );
     64
     65// Converts the string from UTF-16BE to the system encoding
     66// the returned zero-terminated string is allocated with the new[] operator
     67// if s is NULL, NULL is returned
     68// if s starts with the Unicode marker (0xFE,FF) it is skipped
     69// if utf16 or sys is NULL, a new temporary uconv object for the
     70// corresponding encoding will be created
     71// if utf16 or sys points to a null uconv object, the newly created object
     72// will be returned there and must be freed with UniFreeUconvObject,
     73// otherwise the passed in object will be used for the conversion
     74char *APIENTRY uniUtf16BEToSys( const char *s, size_t len, UconvObject *utf16,
     75                              UconvObject *sys );
     76
     77// The opposite to uniUtf16BEToSys
     78char *APIENTRY uniSysToUtf16BE( const char *s, UconvObject *sys,
     79                                UconvObject *utf16, size_t *retLen );
     80
     81// Same as uniUtf16BEToSys but converts UTF-16BE to UTF-8
     82char *APIENTRY uniUtf16BEToUtf8( const char *s, size_t len, UconvObject *utf16,
     83                                 UconvObject *utf8 );
     84
     85// The opposite to uniUtf16BEToUtf8
     86char *APIENTRY uniUtf8ToUtf16BE( const char *s, UconvObject *utf8,
     87                                 UconvObject *utf16, size_t *retLen );
     88
     89// Converts the zero-terminated string from UTF-8 to the system encoding
     90// the returned zero-terminated string is allocated with the new[] operator
     91// if s is NULL, NULL is returned
     92// if s starts with the Unicode marker (0xFE,FF) it is skipped
     93// if utf16 or sys is NULL, a new temporary uconv object for the
     94// corresponding encoding will be created
     95// if utf16 or sys points to a null uconv object, the newly created object
     96// will be returned there and must be freed with UniFreeUconvObject,
     97// otherwise the passed in object will be used for the conversion
     98char *APIENTRY uniUtf8ToSys( const char *s, UconvObject *utf8,
     99                             UconvObject *sys );
     100
     101// The opposite to uniUtf8ToSys
     102char *APIENTRY uniSysToUtf8( const char *s, UconvObject *sys,
     103                             UconvObject *utf8 );
     104
    56105#ifdef __cplusplus
    57106}
Note: See TracChangeset for help on using the changeset viewer.