summaryrefslogtreecommitdiff
path: root/inc/Resource_Unicode.hxx
blob: 526a630526613a8fddd0316492c54215822955a8 (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _Resource_Unicode_HeaderFile
#define _Resource_Unicode_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_PCharacter_HeaderFile
#include <Standard_PCharacter.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Resource_FormatType_HeaderFile
#include <Resource_FormatType.hxx>
#endif
class TCollection_ExtendedString;


//! This class provides functions used to convert a non-ASCII C string <br>
//! given in ANSI, EUC, GB or SJIS format, to a <br>
//! Unicode string of extended characters, and vice versa. <br>
class Resource_Unicode  {
public:

  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  //! Converts non-ASCII CString <fromstr> in SJIS format <br>
//!          to Unicode ExtendedString <tostr>. <br>
  Standard_EXPORT   static  void ConvertSJISToUnicode(const Standard_CString fromstr,TCollection_ExtendedString& tostr) ;
  //! Converts non-ASCII CString <fromstr> in EUC format <br>
//!          to Unicode ExtendedString <tostr>. <br>
  Standard_EXPORT   static  void ConvertEUCToUnicode(const Standard_CString fromstr,TCollection_ExtendedString& tostr) ;
  //! Converts non-ASCII CString <fromstr> in GB format <br>
//!          to Unicode ExtendedString <tostr>. <br>
  Standard_EXPORT   static  void ConvertGBToUnicode(const Standard_CString fromstr,TCollection_ExtendedString& tostr) ;
  //! Converts non-ASCII CString <fromstr> in ANSI format <br>
//!          to Unicode ExtendedString <tostr>. <br>
  Standard_EXPORT   static  void ConvertANSIToUnicode(const Standard_CString fromstr,TCollection_ExtendedString& tostr) ;
  //! Converts Unicode ExtendedString <fromstr> to non-ASCII <br>
//!          CString <tostr> in SJIS format, limited to <maxsize> <br>
//!          characters. To translate the whole <fromstr>, use more <br>
//!          than twice the length of <fromstr>. Returns true if <br>
//!          <maxsize> has not been reached before end of conversion. <br>
  Standard_EXPORT   static  Standard_Boolean ConvertUnicodeToSJIS(const TCollection_ExtendedString& fromstr,Standard_PCharacter& tostr,const Standard_Integer maxsize) ;
  //! Converts Unicode ExtendedString <fromstr> to non-ASCII <br>
//!          CString <tostr> in EUC format, limited to <maxsize> <br>
//!          characters. To translate the whole <fromstr>, use more <br>
//!          than twice the length of <fromstr>. Returns true if <br>
//!          <maxsize> has not been reached before end of conversion. <br>
  Standard_EXPORT   static  Standard_Boolean ConvertUnicodeToEUC(const TCollection_ExtendedString& fromstr,Standard_PCharacter& tostr,const Standard_Integer maxsize) ;
  //! Converts Unicode ExtendedString <fromstr> to non-ASCII <br>
//!          CString <tostr> in GB format, limited to <maxsize> <br>
//!          characters. To translate the whole <fromstr>, use more <br>
//!          than twice the length of <fromstr>. Returns true if <br>
//!          <maxsize> has not been reached before end of conversion. <br>
  Standard_EXPORT   static  Standard_Boolean ConvertUnicodeToGB(const TCollection_ExtendedString& fromstr,Standard_PCharacter& tostr,const Standard_Integer maxsize) ;
  //! Converts Unicode ExtendedString <fromstr> to non-ASCII <br>
//!          CString <tostr> in ANSI format, limited to <maxsize> <br>
//!          characters. To translate the whole <fromstr>, use more <br>
//!          than twice the length of <fromstr>.  Returns true if <br>
//!          <maxsize> has not been reached before end of conversion. <br>
  Standard_EXPORT   static  Standard_Boolean ConvertUnicodeToANSI(const TCollection_ExtendedString& fromstr,Standard_PCharacter& tostr,const Standard_Integer maxsize) ;
  //! Defines the current conversion format as typecode. <br>
//!          This conversion format will then be used by the <br>
//!          functions ConvertFormatToUnicode and <br>
//!          ConvertUnicodeToFormat to convert the strings. <br>
  Standard_EXPORT   static  void SetFormat(const Resource_FormatType typecode) ;
  //! Returns the current conversion format (either <br>
//!          ANSI, EUC, GB or SJIS). <br>
//!          The current converting format must be defined in <br>
//!          advance with the SetFormat function. <br>
  Standard_EXPORT   static  Resource_FormatType GetFormat() ;
  //! Reads converting format from resource "FormatType" <br>
//!          in Resource Manager "CharSet" <br>
  Standard_EXPORT   static  void ReadFormat() ;
  //! Converts the non-ASCII C string fromstr to the <br>
//!          Unicode string of extended characters tostr. <br>
//!          fromstr is translated according to the format <br>
//!          (either ANSI, EUC, GB or SJIS) returned by the function GetFormat. <br>
  Standard_EXPORT   static  void ConvertFormatToUnicode(const Standard_CString fromstr,TCollection_ExtendedString& tostr) ;
  //! Converts the Unicode string of extended <br>
//!          characters fromstr to the non-ASCII C string <br>
//!          tostr according to the format (either ANSI, EUC, <br>
//!          GB or SJIS) returned by the function GetFormat. <br>
//!          maxsize limits the size of the string tostr to a <br>
//!          maximum number of characters. You need more <br>
//!          than twice the length of the string fromstr to <br>
//!          complete the conversion. <br>
//!          The function returns true if conversion is <br>
//!          complete, i.e. the maximum number of characters <br>
//!          maxsize is not reached by tostr before the end <br>
//!          of conversion of fromstr. <br>
  Standard_EXPORT   static  Standard_Boolean ConvertUnicodeToFormat(const TCollection_ExtendedString& fromstr,Standard_PCharacter& tostr,const Standard_Integer maxsize) ;





protected:





private:





};





// other Inline functions and methods (like "C++: function call" methods)


#endif