00001 /******************************************************************************* 00002 * Copyright (c) 1999-2008 ACCESS CO., LTD. All rights reserved. 00003 * Copyright (c) 2006 PalmSource, Inc (an ACCESS company). All rights reserved. 00004 ******************************************************************************/ 00005 00012 #ifndef ALP_TEXT_MGR_H 00013 #define ALP_TEXT_MGR_H 00014 00015 #ifdef __cplusplus 00016 extern "C" { 00017 #endif 00018 00019 #include <alp/types.h> 00020 #include <alp/sysclass.h> 00021 #include <time.h> 00022 00029 // ---------------------------------------------------------------------------- 00030 // flags 00031 // ---------------------------------------------------------------------------- 00032 00034 #define ALP_TEXT_FLAGS_TRIM 0x0001 00035 00037 #define ALP_TEXT_FLAGS_DONT_CONVERT_CHARS 0x0002 00038 00039 // ---------------------------------------------------------------------------- 00040 // error codes 00041 // ---------------------------------------------------------------------------- 00042 00044 #define ALP_TEXT_ERR_ILLEGAL_CHARACTER (ALP_CLASS_TEXT | 0x00010000) 00045 00047 #define ALP_TEXT_ERR_BUFFER_TOO_SMALL (ALP_CLASS_TEXT | 0x00020000) 00048 00050 #define ALP_TEXT_ERR_BUFFER_TOO_BIG (ALP_CLASS_TEXT | 0x00030000) 00051 00053 #define ALP_TEXT_ERR_OUT_OF_MEMORY (ALP_CLASS_TEXT | 0x00040000) 00054 00056 #define ALP_TEXT_ERR_NUMBER_TOO_BIG (ALP_CLASS_TEXT | 0x00050000) 00057 00059 #define ALP_TEXT_ERR_ILLEGAL_FORMAT (ALP_CLASS_TEXT | 0x00060000) 00060 00061 // ---------------------------------------------------------------------------- 00062 // types 00063 // ---------------------------------------------------------------------------- 00064 00065 typedef enum { 00066 AlpNumberFormatCommaPeriod, // 1,000,000.00 00067 AlpNumberFormatPeriodComma, // 1.000.000,00 00068 AlpNumberFormatSpaceComma, // 1 000 000,00 00069 AlpNumberFormatApostrophePeriod, // 1'000'000.00 00070 AlpNumberFormatApostropheComma, // 1'000'000,00 00071 AlpNumberFormatSpacePeriod // 1 000 000.00 00072 } AlpTextNumberFormatType; 00073 00074 typedef enum { 00075 AlpTimeFormatColon, // 1:00 00076 AlpTimeFormatColonAMPM, // 1:00 pm 00077 AlpTimeFormatColon24h, // 13:00 00078 AlpTimeFormatDot, // 1.00 00079 AlpTimeFormatDotAMPM, // 1.00 pm 00080 AlpTimeFormatDot24h, // 13.00 00081 AlpTimeFormatHoursAMPM, // 1 pm 00082 AlpTimeFormatHours24h, // 13 00083 AlpTimeFormatComma24h // 13,00 00084 } AlpTimeFormatType; 00085 00086 typedef enum { 00087 AlpDateFormatMDYWithSlashes, // 12/31/95 00088 AlpDateFormatDMYWithSlashes, // 31/12/95 00089 AlpDateFormatDMYWithDots, // 31.12.95 00090 AlpDateFormatDMYWithDashes, // 31-12-95 00091 AlpDateFormatYMDWithSlashes, // 95/12/31 00092 AlpDateFormatYMDWithDots, // 95.12.31 00093 AlpDateFormatYMDWithDashes, // 95-12-31 00094 00095 AlpDateFormatMDYLongWithComma, // Dec 31, 1995 00096 AlpDateFormatDMYLong, // 31 Dec 1995 00097 AlpDateFormatDMYLongWithDot, // 31. Dec 1995 00098 AlpDateFormatDMYLongNoDay, // Dec 1995 00099 AlpDateFormatDMYLongWithComma, // 31 Dec, 1995 00100 AlpDateFormatYMDLongWithDot, // 1995.12.31 00101 AlpDateFormatYMDLongWithSpace, // 1995 Dec 31 00102 00103 AlpDateFormatMYMed, // Dec '95 00104 AlpDateFormatMYMedNoPost, // Dec 95 (added for French 2.0 ROM) 00105 AlpDateFormatMDYWithDashes // 12-31-95 (added for 4.0 ROM) 00106 } AlpDateFormatType; 00107 00108 typedef enum { 00109 AlpDateTimeFormatDMYShort, // 12/31/2006 00110 AlpDateTimeFormatDMYShortWithDay, // Sun 12/31/2006 00111 AlpDateTimeFormatDMShort, // 12/31 00112 AlpDateTimeFormatDMYLong, // Dec 31, 2006 00113 AlpDateTimeFormatDMYLongWithDay, // Sun, Dec 31, 2006 00114 AlpDateTimeFormatDMLong, // Dec 31 00115 AlpDateTimeFormatMYLong, // Dec 2006 00116 AlpDateTimeFormatHHMM, // 2:28 00117 } AlpDateTimeFormatType; 00118 00119 typedef enum { 00120 AlpDayDateFormatBeginCommaSpace, // Tue, 8/1/2006 00121 AlpDayDateFormatBeginNoCommaSpace, // Tue 8/1/2006 00122 AlpDayDateFormatBeginCommaNoSpace, // Tue,8/1/2006 00123 AlpDayDateFormatBeginNoCommaNoSpace, // Tue8/1/2006 00124 AlpDayDateFormatEndCommaSpace, // 8/1/2006, Tue 00125 AlpDayDateFormatEndNoCommaSpace, // 8/1/2006 Tue 00126 AlpDayDateFormatEndCommaNoSpace, // 8/1/2006,Tue 00127 AlpDayDateFormatEndNoCommaNoSpace, // 8/1/2006Tue 00128 } AlpDayDateFormatType; 00129 00130 // ---------------------------------------------------------------------------- 00131 // GSM 03.38 to UTF-8 unicode conversions 00132 // ---------------------------------------------------------------------------- 00133 00146 alp_status_t alp_txt_utf8_to_gsm(unsigned char * src, int slength, unsigned char * dst, int dlength, int * size, int flags); 00147 00160 alp_status_t alp_txt_utf8_from_gsm(unsigned char * src, int slength, unsigned char * dst, int dlength, int * size, int flags); 00161 00162 // ---------------------------------------------------------------------------- 00163 // UCS-2 to UTF-8 unicode conversions 00164 // ---------------------------------------------------------------------------- 00165 00178 alp_status_t alp_txt_utf8_to_ucs2(unsigned char * src, int slength, unsigned char * dst, int dlength, int * size, int flags); 00179 00191 alp_status_t alp_txt_utf8_from_ucs2(unsigned char * src, int slength, unsigned char * dst, int dlength, int * size, int flags); 00192 00193 // ---------------------------------------------------------------------------- 00194 // numeric conversions 00195 // ---------------------------------------------------------------------------- 00196 00208 alp_status_t alp_txt_dtostr(char * buffer, int buffer_length, double d, int ndigits, int flags); 00209 00210 // ---------------------------------------------------------------------------- 00211 // date and time conversions 00212 // ---------------------------------------------------------------------------- 00213 00224 alp_status_t alp_txt_strftime(char * buffer, int buffer_length, AlpDateTimeFormatType nType, struct tm * pTime, int * length); 00225 00236 alp_status_t alp_txt_strftime_format(char * buffer, int buffer_length, AlpTimeFormatType nType, struct tm * pTime, int * length); 00237 00248 alp_status_t alp_txt_strfdate_format(char * buffer, int buffer_length, AlpDateFormatType nType, struct tm * pTime, int * length); 00249 00251 00252 #ifdef __cplusplus 00253 } // extern "C" 00254 #endif 00255 00256 #endif
Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.