~ubuntu-branches/ubuntu/gutsy/icu/gutsy-updates

« back to all changes in this revision

Viewing changes to source/extra/ustdio/ufile.h

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2005-11-19 11:29:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20051119112931-vcizkrp10tli4enw
Tags: 3.4-3
Explicitly build with g++ 3.4.  The current ICU fails its test suite
with 4.0 but not with 3.4.  Future versions should work properly with
4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
*******************************************************************************
3
 
*
4
 
*   Copyright (C) 1998-1999, International Business Machines
5
 
*   Corporation and others.  All Rights Reserved.
6
 
*
7
 
*******************************************************************************
8
 
*
9
 
* File ufile.h
10
 
*
11
 
* Modification History:
12
 
*
13
 
*   Date        Name        Description
14
 
*   12/01/98    stephen        Creation.
15
 
*   03/12/99    stephen     Modified for new C API.
16
 
*******************************************************************************
17
 
*/
18
 
 
19
 
#ifndef UFILE_H
20
 
#define UFILE_H
21
 
 
22
 
#include "unicode/utypes.h"
23
 
#include "unicode/ucnv.h"
24
 
#include "unicode/utrans.h"
25
 
#include "locbund.h"
26
 
 
27
 
/* The buffer size for fromUnicode calls */
28
 
#define UFILE_CHARBUFFER_SIZE 1024
29
 
 
30
 
/* The buffer size for toUnicode calls */
31
 
#define UFILE_UCHARBUFFER_SIZE 1024
32
 
 
33
 
/* A UFILE */
34
 
 
35
 
typedef struct {
36
 
  UTransliterator *fTranslit;
37
 
  UChar  *buffer;             /* Beginning of buffer */
38
 
  int32_t capacity;           /* Capacity of buffer */
39
 
  int32_t pos;                /* Beginning of untranslitted data */
40
 
  int32_t length;             /* Length *from beginning of buffer* of untranslitted data */
41
 
  UTransliterator *translit;
42
 
} UFILETranslitBuffer;
43
 
 
44
 
struct UFILE {
45
 
  FILE            *fFile;        /* the actual fs interface */
46
 
  UBool        fOwnFile;    /* TRUE if fFile should be closed */
47
 
  
48
 
  ULocaleBundle        *fBundle;     /* formatters */
49
 
  UBool        fOwnBundle;     /* TRUE if fBundle should be deleted */
50
 
 
51
 
  UConverter        *fConverter;     /* for codeset conversion */
52
 
 
53
 
                      /* buffer used for fromUnicode */
54
 
  char            fCharBuffer     [UFILE_CHARBUFFER_SIZE];
55
 
 
56
 
                      /* buffer used for toUnicode */
57
 
  UChar            fUCBuffer     [UFILE_UCHARBUFFER_SIZE];
58
 
 
59
 
  UChar            *fUCLimit;     /* data limit in fUCBuffer */
60
 
  UChar         *fUCPos;     /* current pos in fUCBuffer */
61
 
 
62
 
  UFILETranslitBuffer *fTranslit;
63
 
};
64
 
 
65
 
/**
66
 
 * Like u_file_write but takes a flush parameter
67
 
 */
68
 
U_CAPI int32_t U_EXPORT2
69
 
u_file_write_flush(    const UChar     *chars, 
70
 
        int32_t        count, 
71
 
        UFILE         *f,
72
 
        UBool         flush);
73
 
 
74
 
/**
75
 
 * Fill a UFILE's buffer with converted codepage data.
76
 
 * @param f The UFILE containing the buffer to fill.
77
 
 */
78
 
void
79
 
ufile_fill_uchar_buffer(UFILE *f);
80
 
 
81
 
/**
82
 
 * Close out the transliterator and flush any data therein.
83
 
 * @param f flu
84
 
 */
85
 
void 
86
 
ufile_close_translit(UFILE *f);
87
 
 
88
 
/**
89
 
 * Flush the buffer in the transliterator 
90
 
 * @param f UFile to flush
91
 
 */
92
 
void 
93
 
ufile_flush_translit(UFILE *f);
94
 
 
95
 
 
96
 
#endif