File: gtm_conv.h

package info (click to toggle)
fis-gtm 7.1-006-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,908 kB
  • sloc: ansic: 344,906; asm: 5,184; csh: 4,859; sh: 2,000; awk: 294; makefile: 73; sed: 13
file content (50 lines) | stat: -rwxr-xr-x 2,363 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/****************************************************************
 *                                                              *
 * Copyright (c) 2006-2024 Fidelity National Information	*
 * Services, Inc. and/or its subsidiaries. All rights reserved.	*
 *                                                              *
 *      This source code contains the intellectual property     *
 *      of its copyright holder(s), and is made available       *
 *      under a license.  If you do not know the terms of       *
 *      the license, please stop and do not read further.       *
 *                                                              *
 ****************************************************************/

#ifndef GTM_CONV_H
#define GTM_CONV_H
#include "gtm_icu_api.h"

#define MAX_CASE_IDX	3		/* maximum number of case conversions supported */
#define MAX_ZCONVBUFF	(8 * 1024)	/* temporary buffer size used in case conversion */

#define MIN_CHSET_LEN	1		/* minimum length of CHSET names */
#define MAX_CHSET_LEN	8		/* maximum length of CHSET names */

int verify_chset(const mstr *parm);
int verify_case(const mstr *parm);
UConverter* get_chset_desc(const mstr *chset);
int gtm_conv(UConverter* from, UConverter* to, mstr* src, char* dstbuff, int* bufflen);
gtm_chset_t check_w1252(const mstr *parm);
gtm_chset_t check_valid_utf(const mstr *parm);

typedef void 	(*m_casemap_t)(uchar_ptr_t, uchar_ptr_t, int4);
typedef int32_t	(*u_casemap_t)(UChar *dest, int32_t destCapacity, const UChar *src,
			       int32_t srcLength, const char *locale, UErrorCode *pErrorCode);

/* An interlude routine for title case to have the same signature as u_strToUpper/u_strToLower */
int32_t gtm_strToTitle(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength,
		       const char *locale, UErrorCode *pErrorCode);

/* descriptor for case mapping */
typedef struct
{
	const char*	code;	/* case conversion code - "U","L","T" */
	m_casemap_t	m;	/* conversion routine for "M" mode */
	u_casemap_t	u;	/* conversion routine for "UTF-8" mode */
} casemap_t;

/* Call back function for ICU to stop at illegal/invalid characters and return with error */
void callback_stop(const void* context, UConverterToUnicodeArgs *args, const char *codeUnits,
		   int32_t length, UConverterCallbackReason reason, UErrorCode *pErrorCode);

#endif /* GTM_CONV_H */