Skip to content

Commit 8d35a42

Browse files
committed
Utilize the recommended way to handle the icu namespace
1 parent cad2a0f commit 8d35a42

21 files changed

+66
-0
lines changed

ext/intl/breakiterator/breakiterator_class.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ extern "C" {
3838
}
3939

4040
using PHP::CodePointBreakIterator;
41+
using U_ICU_NAMESPACE::RuleBasedBreakIterator;
4142

4243
/* {{{ Global variables */
4344
zend_class_entry *BreakIterator_ce_ptr;

ext/intl/breakiterator/breakiterator_class.h

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
#ifndef USE_BREAKITERATOR_POINTER
2828
typedef void BreakIterator;
29+
#else
30+
using U_ICU_NAMESPACE::BreakIterator;
2931
#endif
3032

3133
typedef struct {

ext/intl/breakiterator/breakiterator_methods.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ extern "C" {
3232
}
3333

3434
using PHP::CodePointBreakIterator;
35+
using U_ICU_NAMESPACE::BreakIterator;
36+
using U_ICU_NAMESPACE::Locale;
3537

3638
U_CFUNC PHP_METHOD(BreakIterator, __construct)
3739
{

ext/intl/breakiterator/codepointiterator_internal.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ typedef union {
3333

3434
using namespace PHP;
3535

36+
using U_ICU_NAMESPACE::UCharCharacterIterator;
37+
3638
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CodePointBreakIterator);
3739

3840
CodePointBreakIterator::CodePointBreakIterator()

ext/intl/breakiterator/codepointiterator_internal.h

+3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
#define CODEPOINTITERATOR_INTERNAL_H
1919

2020
#include <unicode/brkiter.h>
21+
#include <unicode/unistr.h>
2122

2223
using U_ICU_NAMESPACE::BreakIterator;
24+
using U_ICU_NAMESPACE::CharacterIterator;
25+
using U_ICU_NAMESPACE::UnicodeString;
2326

2427
namespace PHP {
2528

ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ extern "C" {
2626
#include "../intl_convertcpp.h"
2727
#include "../intl_common.h"
2828

29+
using U_ICU_NAMESPACE::RuleBasedBreakIterator;
30+
using U_ICU_NAMESPACE::Locale;
31+
2932
static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) {
3033
return (RuleBasedBreakIterator*)bio->biter;
3134
}

ext/intl/calendar/calendar_class.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ extern "C" {
3434
#include <assert.h>
3535
}
3636

37+
using U_ICU_NAMESPACE::GregorianCalendar;
38+
using U_ICU_NAMESPACE::Locale;
39+
3740
/* {{{ Global variables */
3841
zend_class_entry *Calendar_ce_ptr;
3942
zend_class_entry *GregorianCalendar_ce_ptr;

ext/intl/calendar/calendar_class.h

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
#ifndef USE_CALENDAR_POINTER
2828
typedef void Calendar;
29+
#else
30+
using U_ICU_NAMESPACE::Calendar;
2931
#endif
3032

3133
typedef struct {

ext/intl/calendar/calendar_methods.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ extern "C" {
4343
}
4444
#include "../common/common_enum.h"
4545

46+
using U_ICU_NAMESPACE::Locale;
47+
4648
U_CFUNC PHP_METHOD(IntlCalendar, __construct)
4749
{
4850
zend_throw_exception( NULL,

ext/intl/calendar/gregoriancalendar_methods.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <unicode/locid.h>
2424
#include <unicode/calendar.h>
2525
#include <unicode/gregocal.h>
26+
#include <unicode/ustring.h>
27+
2628
extern "C" {
2729
#include "../php_intl.h"
2830
#include "../intl_common.h"
@@ -34,6 +36,11 @@ extern "C" {
3436
#include "zend_exceptions.h"
3537
}
3638

39+
using U_ICU_NAMESPACE::GregorianCalendar;
40+
using U_ICU_NAMESPACE::Locale;
41+
using U_ICU_NAMESPACE::UnicodeString;
42+
using U_ICU_NAMESPACE::StringPiece;
43+
3744
static inline GregorianCalendar *fetch_greg(Calendar_object *co) {
3845
return (GregorianCalendar*)co->ucal;
3946
}

ext/intl/common/common_date.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ extern "C" {
2525
#include <ext/date/php_date.h>
2626
}
2727

28+
using U_ICU_NAMESPACE::TimeZone;
29+
using U_ICU_NAMESPACE::UnicodeString;
30+
2831
#include "zend_portability.h"
2932

3033
/* {{{ timezone_convert_datetimezone

ext/intl/common/common_date.h

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ U_CDECL_END
2828

2929
#include <unicode/timezone.h>
3030

31+
using U_ICU_NAMESPACE::TimeZone;
32+
3133
U_CFUNC TimeZone *timezone_convert_datetimezone(int type, void *object, int is_datetime, intl_error *outside_error, const char *func);
3234
U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz,
3335
intl_error *err, const char *func);

ext/intl/common/common_enum.h

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ U_CFUNC zval *zoi_with_current_get_current_data(zend_object_iterator *iter);
7575
U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter);
7676

7777
#ifdef __cplusplus
78+
using U_ICU_NAMESPACE::StringEnumeration;
7879
U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *object);
7980
#endif
8081

ext/intl/dateformat/dateformat_format_object.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ extern "C" {
3333
#include "../common/common_date.h"
3434
}
3535

36+
using U_ICU_NAMESPACE::Locale;
37+
using U_ICU_NAMESPACE::DateFormat;
38+
using U_ICU_NAMESPACE::GregorianCalendar;
39+
using U_ICU_NAMESPACE::StringPiece;
40+
using U_ICU_NAMESPACE::SimpleDateFormat;
41+
3642
static const DateFormat::EStyle valid_styles[] = {
3743
DateFormat::kNone,
3844
DateFormat::kFull,

ext/intl/dateformat/dateformat_helpers.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ extern "C" {
2828
#include "../calendar/calendar_class.h"
2929
}
3030

31+
using U_ICU_NAMESPACE::GregorianCalendar;
32+
3133
int datefmt_process_calendar_arg(zval* calendar_zv,
3234
Locale const& locale,
3335
const char *func_name,

ext/intl/dateformat/dateformat_helpers.h

+5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@
2222
#endif
2323

2424
#include <unicode/calendar.h>
25+
#include <unicode/datefmt.h>
2526

2627
extern "C" {
2728
#include "../php_intl.h"
2829
}
2930

31+
using U_ICU_NAMESPACE::Locale;
32+
using U_ICU_NAMESPACE::Calendar;
33+
using U_ICU_NAMESPACE::DateFormat;
34+
3035
int datefmt_process_calendar_arg(zval* calendar_zv,
3136
Locale const& locale,
3237
const char *func_name,

ext/intl/intl_convertcpp.h

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include <unicode/unistr.h>
2727
#include <zend_types.h>
2828

29+
using U_ICU_NAMESPACE::UnicodeString;
30+
2931
int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status);
3032

3133
zend_string* intl_charFromString(const UnicodeString &from, UErrorCode *status);

ext/intl/msgformat/msgformat_helpers.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ MessageFormatAdapter::getMessagePattern(MessageFormat* m) {
7676
#endif
7777
U_NAMESPACE_END
7878

79+
using U_ICU_NAMESPACE::Formattable;
80+
using U_ICU_NAMESPACE::Format;
81+
using U_ICU_NAMESPACE::DateFormat;
82+
using U_ICU_NAMESPACE::MessageFormat;
83+
#ifdef HAS_MESSAGE_PATTERN
84+
using U_ICU_NAMESPACE::MessagePattern;
85+
#endif
86+
using U_ICU_NAMESPACE::MessageFormatAdapter;
87+
using U_ICU_NAMESPACE::FieldPosition;
88+
7989
U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt)
8090
{
8191
int32_t fmt_count = 0;

ext/intl/timezone/timezone_class.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ extern "C" {
3737
#include <ext/date/php_date.h>
3838
}
3939

40+
using U_ICU_NAMESPACE::Calendar;
41+
4042
/* {{{ Global variables */
4143
U_CDECL_BEGIN
4244
zend_class_entry *TimeZone_ce_ptr = NULL;

ext/intl/timezone/timezone_class.h

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
#ifndef USE_TIMEZONE_POINTER
3131
typedef void TimeZone;
32+
#else
33+
using U_ICU_NAMESPACE::TimeZone;
3234
#endif
3335

3436
typedef struct {

ext/intl/timezone/timezone_methods.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <unicode/locid.h>
2424
#include <unicode/timezone.h>
2525
#include <unicode/ustring.h>
26+
#include <unicode/calendar.h>
2627
#include "intl_convertcpp.h"
2728

2829
#include "../common/common_date.h"
@@ -37,6 +38,9 @@ extern "C" {
3738
}
3839
#include "common/common_enum.h"
3940

41+
using U_ICU_NAMESPACE::Locale;
42+
using U_ICU_NAMESPACE::Calendar;
43+
4044
U_CFUNC PHP_METHOD(IntlTimeZone, __construct)
4145
{
4246
zend_throw_exception( NULL,

0 commit comments

Comments
 (0)