* @draft ICU 59
*/
inline Char16Ptr(char16_t *p);
+#if !U_CHAR16_IS_TYPEDEF
/**
* Converts the pointer to char16_t *.
* @param p pointer to be converted
* @draft ICU 59
*/
inline Char16Ptr(uint16_t *p);
+#endif
#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
/**
* Converts the pointer to char16_t *.
*/
inline Char16Ptr(wchar_t *p);
#endif
+#if !U_NO_NULLPTR_T
/**
* nullptr constructor.
* @param p nullptr
* @draft ICU 59
*/
inline Char16Ptr(std::nullptr_t p);
+#endif
/**
* Destructor.
* @draft ICU 59
#ifdef U_ALIASING_BARRIER
Char16Ptr::Char16Ptr(char16_t *p) : p(p) {}
+#if !U_CHAR16_IS_TYPEDEF
Char16Ptr::Char16Ptr(uint16_t *p) : p(cast(p)) {}
+#endif
#if U_SIZEOF_WCHAR_T==2
Char16Ptr::Char16Ptr(wchar_t *p) : p(cast(p)) {}
#endif
+#if !U_NO_NULLPTR_T
Char16Ptr::Char16Ptr(std::nullptr_t p) : p(p) {}
+#endif
Char16Ptr::~Char16Ptr() {
U_ALIASING_BARRIER(p);
}
#else
Char16Ptr::Char16Ptr(char16_t *p) { u.cp = p; }
+#if !U_CHAR16_IS_TYPEDEF
Char16Ptr::Char16Ptr(uint16_t *p) { u.up = p; }
+#endif
#if U_SIZEOF_WCHAR_T==2
Char16Ptr::Char16Ptr(wchar_t *p) { u.wp = p; }
#endif
+#if !U_NO_NULLPTR_T
Char16Ptr::Char16Ptr(std::nullptr_t p) { u.cp = p; }
+#endif
Char16Ptr::~Char16Ptr() {}
char16_t *Char16Ptr::get() const { return u.cp; }
* @draft ICU 59
*/
inline ConstChar16Ptr(const char16_t *p);
+#if !U_CHAR16_IS_TYPEDEF
/**
* Converts the pointer to char16_t *.
* @param p pointer to be converted
* @draft ICU 59
*/
inline ConstChar16Ptr(const uint16_t *p);
+#endif
#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
/**
* Converts the pointer to char16_t *.
*/
inline ConstChar16Ptr(const wchar_t *p);
#endif
+#if !U_NO_NULLPTR_T
/**
* nullptr constructor.
* @param p nullptr
* @draft ICU 59
*/
inline ConstChar16Ptr(const std::nullptr_t p);
+#endif
/**
* Destructor.
* @draft ICU 59
#ifdef U_ALIASING_BARRIER
ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) : p(p) {}
+#if !U_CHAR16_IS_TYPEDEF
ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) : p(cast(p)) {}
+#endif
#if U_SIZEOF_WCHAR_T==2
ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p(cast(p)) {}
#endif
+#if !U_NO_NULLPTR_T
ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p(p) {}
+#endif
ConstChar16Ptr::~ConstChar16Ptr() {
U_ALIASING_BARRIER(p);
}
#else
ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) { u.cp = p; }
+#if !U_CHAR16_IS_TYPEDEF
ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) { u.up = p; }
+#endif
#if U_SIZEOF_WCHAR_T==2
ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u.wp = p; }
#endif
+#if !U_NO_NULLPTR_T
ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u.cp = p; }
+#endif
ConstChar16Ptr::~ConstChar16Ptr() {}
const char16_t *ConstChar16Ptr::get() const { return u.cp; }
# define U_CPLUSPLUS_VERSION 1
#endif
+#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
+# define U_NO_NULLPTR_T 1
+#else
+# define U_NO_NULLPTR_T 0
+#endif
+
/**
* \def U_HAVE_RVALUE_REFERENCES
* Set to 1 if the compiler supports rvalue references.
*/
#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
# include <uchar.h>
+# define U_CHAR16_IS_TYPEDEF 1
+#else
+# define U_CHAR16_IS_TYPEDEF 0
#endif
*/
UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text);
+#if !U_CHAR16_IS_TYPEDEF
/**
* uint16_t * constructor.
* Delegates to UnicodeString(const char16_t *).
*/
UNISTR_FROM_STRING_EXPLICIT UnicodeString(const uint16_t *text) :
UnicodeString(ConstChar16Ptr(text)) {}
+#endif
#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
/**
UnicodeString(ConstChar16Ptr(text)) {}
#endif
+#if !U_NO_NULLPTR_T
/**
* nullptr_t constructor.
* Effectively the same as the default constructor, makes an empty string object.
* @draft ICU 59
*/
UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text);
+#endif
/**
* char16_t* constructor.
UnicodeString(const char16_t *text,
int32_t textLength);
+#if !U_CHAR16_IS_TYPEDEF
/**
* uint16_t * constructor.
* Delegates to UnicodeString(const char16_t *, int32_t).
*/
UnicodeString(const uint16_t *text, int32_t length) :
UnicodeString(ConstChar16Ptr(text), length) {}
+#endif
#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
/**
UnicodeString(ConstChar16Ptr(text), length) {}
#endif
+#if !U_NO_NULLPTR_T
/**
* nullptr_t constructor.
* Effectively the same as the default constructor, makes an empty string object.
* @draft ICU 59
*/
inline UnicodeString(const std::nullptr_t text, int32_t length);
-
+#endif
/**
* Readonly-aliasing char16_t* constructor.
* The text will be used for the UnicodeString object, but
*/
UnicodeString(char16_t *buffer, int32_t buffLength, int32_t buffCapacity);
+#if !U_CHAR16_IS_TYPEDEF
/**
* Writable-aliasing uint16_t * constructor.
* Delegates to UnicodeString(const char16_t *, int32_t, int32_t).
*/
UnicodeString(uint16_t *buffer, int32_t buffLength, int32_t buffCapacity) :
UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}
+#endif
#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
/**
UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}
#endif
+#if !U_NO_NULLPTR_T
/**
* Writable-aliasing nullptr_t constructor.
* Effectively the same as the default constructor, makes an empty string object.
* @draft ICU 59
*/
inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity);
+#endif
#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
fUnion.fStackFields.fLengthAndFlags=kShortString;
}
+#if !U_NO_NULLPTR_T
inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) {
fUnion.fStackFields.fLengthAndFlags=kShortString;
}
inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) {
fUnion.fStackFields.fLengthAndFlags=kShortString;
}
+#endif
//========================================
// Read-only implementation methods
%.o: $(srcdir)/%.c
$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
-%.$(STATIC_O): $(srcdir)/%.cpp
- $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
+
+## C++ compilation rules.
+
+# This causes escapesrc to be built before other ICU targets.
+NEED_ESCAPING=YES
+
+ifneq ($(SKIP_ESCAPING),)
+# no escaping - bootstrap
%.o: $(srcdir)/%.cpp
$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
+else
+# convert *.cpp files to _*.cpp with \u / \U escaping
+CLEANFILES += _*.cpp
+# the actual escaping
+_%.cpp: $(srcdir)/%.cpp
+ @$(BINDIR)/escapesrc$(EXEEXT) $< $@
+
+# compilation for static obj
+%.$(STATIC_O): _%.cpp
+ $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
+# compilation for dynamic obj
+%.o: _%.cpp
+ $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
+endif
## Dependency rules
%.d : %.u
UBool RBBITest::testCaseIsKnownIssue(const UnicodeString &testCase, const char *fileName) {
static const UChar *badTestCases[] = { // Line Numbers from Unicode 7.0.0 file.
- u"\u200B\u0020\u007D", // Line 5198
- u"\u200B\u0020\u0029", // Line 5202
- u"\u200B\u0020\u0021", // Line 5214
- u"\u200B\u0020\u002c", // Line 5246
- u"\u200B\u0020\u002f", // Line 5298
+ u"\u200B\u0020}", // Line 5198
+ u"\u200B\u0020)", // Line 5202
+ u"\u200B\u0020!", // Line 5214
+ u"\u200B\u0020,", // Line 5246
+ u"\u200B\u0020/", // Line 5298
u"\u200B\u0020\u2060" // Line 5302
};
if (strcmp(fileName, "LineBreakTest.txt") != 0) {
return FALSE;
}
+#if (U_CPLUSPLUS_VERSION >= 11)
for (const UChar *badCase: badTestCases) {
+#else
+ for (const UChar *badCase = badTestCases[0]; badCase < badTestCases[UPRV_LENGTHOF(badTestCases)]; badCase++) {
+#endif
if (testCase == UnicodeString(badCase)) {
return logKnownIssue("7270");
}
std::ifstream inf;
- inf.open(infile, std::ios::in);
+ inf.open(infile.c_str(), std::ios::in);
if(!inf.is_open()) {
fprintf(stderr, "%s: could not open input file %s\n", prog.c_str(), infile.c_str());
std::ofstream outf;
- outf.open(outfile, std::ios::out);
+ outf.open(outfile.c_str(), std::ios::out);
if(!outf.is_open()) {
fprintf(stderr, "%s: could not open output file %s\n", prog.c_str(), outfile.c_str());
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-char16_t CH = u'•';
-
/*
*******************************************************************************
*
main(int argc, char* argv[]) {
UErrorCode errorCode = U_ZERO_ERROR;
UBool didSomething = FALSE;
-
- printf("U+%lx\n", CH); return 0;
/* preset then read command line options */
argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);