Input string type
UTF-16: std::u16string_view or UnicodeString ?
UTF-8: std::string_view or StringPiece ?
Return type: Classic ICU or modern C++?
Classic ICU: return a pointer, and by convention the caller takes ownership.
Modern C++: Return a smart pointer -> clearly indicated ownership
If modern C++ return type: which style?
ICU style: return LocalPointer<Segments>
Standard C++ style: std::unique_ptr<Segments>
class U_COMMON_API_CLASS Segmenter : public UObject {
public:
~Segmenter() override;
virtual std::unique_ptr<Segments> segment(std::u16string_view s, UErrorCode &errorCode);
virtual std::unique_ptr<SegmentsUTF8> segment(StringPiece s, UErrorCode &errorCode);
};
--
You received this message because you are subscribed to the Google Groups "icu-design" group.
To unsubscribe from this group and stop receiving emails from it, send an email to icu-design+...@unicode.org.
To view this discussion visit https://groups.google.com/a/unicode.org/d/msgid/icu-design/CAPLBv_Po-bn1z5woAvwiSpUS7%2BPtbRQJ8rd7St_2UH59Voo4Xw%40mail.gmail.com.
For more options, visit https://groups.google.com/a/unicode.org/d/optout.
It is not clear to me that returning a pointer (even a unique_ptr), presumably to do user-visible polymorphism on Segments, is the modern C++ way to go here; this feels like a translation of the Java rather than a modern C++ design.I would expect some kind of range-like object, like we did for the UTF iterators.
Personally I have a preference for the modern C++ approach too. It makes it easier to integrate with other C++ libraries and traditional C++ lint scanner tools. Though I’m not adamant about this preference.
The rest of this email is about an alternate implementation that already tries to overcome the shortcomings of the current RBBI implementation. It’s informational, and I’m not proposing changes to the design proposal.
--
You received this message because you are subscribed to the Google Groups "icu-design" group.
To unsubscribe from this group and stop receiving emails from it, send an email to icu-design+...@unicode.org.
To view this discussion visit https://groups.google.com/a/unicode.org/d/msgid/icu-design/CAN49p6qesgHBngu4HmHKCns%2Be5HjkFSOBcw0t9A9qS%3D_Bg91ww%40mail.gmail.com.
For more options, visit https://groups.google.com/a/unicode.org/d/optout.
--
You received this message because you are subscribed to the Google Groups "ICU - Team" group.
To unsubscribe from this group and stop receiving emails from it, send an email to icu-team+u...@unicode.org.
To view this discussion visit https://groups.google.com/a/unicode.org/d/msgid/icu-team/CAN49p6qesgHBngu4HmHKCns%2Be5HjkFSOBcw0t9A9qS%3D_Bg91ww%40mail.gmail.com.
To view this discussion visit https://groups.google.com/a/unicode.org/d/msgid/icu-design/CABxsp%3DkR0JZm4kJkD9ULWvJ2RG4QMFZiCOEqsG5vi_jexP%2B5Ww%40mail.gmail.com.
For more options, visit https://groups.google.com/a/unicode.org/d/optout.
--
You received this message because you are subscribed to the Google Groups "ICU - Team" group.
To unsubscribe from this group and stop receiving emails from it, send an email to icu-team+u...@unicode.org.