@@ -46,25 +46,26 @@ extern "C" {
46
46
47
47
U_NAMESPACE_BEGIN
48
48
/* *
49
- * This class isolates our access to private internal methods of
50
- * MessageFormat. It is never instantiated; it exists only for C++
51
- * access management.
49
+ * ICU declares MessageFormatAdapter as a friend class of MessageFormat,
50
+ * to use as a backdoor for accessing private MessageFormat members.
51
+ * We use it for the same purpose here. Prefix the methods with php to
52
+ * avoid clashes with any definitions in ICU.
52
53
*/
53
54
class MessageFormatAdapter {
54
55
public:
55
- static const Formattable::Type* getArgTypeList (const MessageFormat& m,
56
+ static const Formattable::Type* phpGetArgTypeList (const MessageFormat& m,
56
57
int32_t & count);
57
- static const MessagePattern getMessagePattern (MessageFormat* m);
58
+ static const MessagePattern phpGetMessagePattern (MessageFormat* m);
58
59
};
59
60
60
61
const Formattable::Type*
61
- MessageFormatAdapter::getArgTypeList (const MessageFormat& m,
62
+ MessageFormatAdapter::phpGetArgTypeList (const MessageFormat& m,
62
63
int32_t & count) {
63
64
return m.getArgTypeList (count);
64
65
}
65
66
66
67
const MessagePattern
67
- MessageFormatAdapter::getMessagePattern (MessageFormat* m) {
68
+ MessageFormatAdapter::phpGetMessagePattern (MessageFormat* m) {
68
69
return m->msgPattern ;
69
70
}
70
71
U_NAMESPACE_END
@@ -80,7 +81,7 @@ using icu::FieldPosition;
80
81
U_CFUNC int32_t umsg_format_arg_count (UMessageFormat *fmt)
81
82
{
82
83
int32_t fmt_count = 0 ;
83
- MessageFormatAdapter::getArgTypeList (*(const MessageFormat*)fmt, fmt_count);
84
+ MessageFormatAdapter::phpGetArgTypeList (*(const MessageFormat*)fmt, fmt_count);
84
85
return fmt_count;
85
86
}
86
87
@@ -103,7 +104,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo,
103
104
return mfo->mf_data .arg_types ;
104
105
}
105
106
106
- const Formattable::Type *types = MessageFormatAdapter::getArgTypeList (
107
+ const Formattable::Type *types = MessageFormatAdapter::phpGetArgTypeList (
107
108
*(MessageFormat*)mfo->mf_data .umsgf , parts_count);
108
109
109
110
/* Hash table will store Formattable::Type objects directly,
@@ -288,7 +289,7 @@ static HashTable *umsg_get_types(MessageFormatter_object *mfo,
288
289
{
289
290
MessageFormat *mf = (MessageFormat *)mfo->mf_data .umsgf ;
290
291
291
- const MessagePattern mp = MessageFormatAdapter::getMessagePattern (mf);
292
+ const MessagePattern mp = MessageFormatAdapter::phpGetMessagePattern (mf);
292
293
293
294
return umsg_parse_format (mfo, mp, err);
294
295
}
0 commit comments