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