]> granicus.if.org Git - icu/commitdiff
ICU-12140 Pass StringPiece by value, externally.
authorFredrik Roubert <roubert@google.com>
Wed, 17 Aug 2016 19:07:15 +0000 (19:07 +0000)
committerFredrik Roubert <roubert@google.com>
Wed, 17 Aug 2016 19:07:15 +0000 (19:07 +0000)
R=markus.icu@gmail.com

Review URL: https://codereview.appspot.com/306850043 .

X-SVN-Rev: 39064

12 files changed:
icu4c/source/common/bytestriebuilder.cpp
icu4c/source/common/unicode/bytestriebuilder.h
icu4c/source/common/unicode/idna.h
icu4c/source/common/unicode/unistr.h
icu4c/source/common/unistr.cpp
icu4c/source/common/uts46.cpp
icu4c/source/i18n/decimfmt.cpp
icu4c/source/i18n/fmtable.cpp
icu4c/source/i18n/numfmt.cpp
icu4c/source/i18n/unicode/decimfmt.h
icu4c/source/i18n/unicode/fmtable.h
icu4c/source/i18n/unicode/numfmt.h

index 71fea8923cba8f89b5b417f26704b50e0fe7da88..f1e2001a69ea1dfa6f1e14509492fe5891af5f13 100644 (file)
@@ -145,7 +145,7 @@ BytesTrieBuilder::~BytesTrieBuilder() {
 }
 
 BytesTrieBuilder &
-BytesTrieBuilder::add(const StringPiece &s, int32_t value, UErrorCode &errorCode) {
+BytesTrieBuilder::add(StringPiece s, int32_t value, UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) {
         return *this;
     }
index 4e00e0f73ddb9946a563deb63eca9d12b56e72c3..aeec1dbda069f21692c8d6000e7cd24a7f348fcf 100644 (file)
@@ -66,7 +66,7 @@ public:
      * @return *this
      * @stable ICU 4.8
      */
-    BytesTrieBuilder &add(const StringPiece &s, int32_t value, UErrorCode &errorCode);
+    BytesTrieBuilder &add(StringPiece s, int32_t value, UErrorCode &errorCode);
 
     /**
      * Builds a BytesTrie for the add()ed data.
index 5a74b9a1bf378befca85ee7e4216f0dab92cd53a..23a1d7ca0e84411646a5971cf0542c6e172b3cf5 100644 (file)
@@ -200,7 +200,7 @@ public:
      * @stable ICU 4.6
      */
     virtual void
-    labelToASCII_UTF8(const StringPiece &label, ByteSink &dest,
+    labelToASCII_UTF8(StringPiece label, ByteSink &dest,
                       IDNAInfo &info, UErrorCode &errorCode) const;
 
     /**
@@ -218,7 +218,7 @@ public:
      * @stable ICU 4.6
      */
     virtual void
-    labelToUnicodeUTF8(const StringPiece &label, ByteSink &dest,
+    labelToUnicodeUTF8(StringPiece label, ByteSink &dest,
                        IDNAInfo &info, UErrorCode &errorCode) const;
 
     /**
@@ -236,7 +236,7 @@ public:
      * @stable ICU 4.6
      */
     virtual void
-    nameToASCII_UTF8(const StringPiece &name, ByteSink &dest,
+    nameToASCII_UTF8(StringPiece name, ByteSink &dest,
                      IDNAInfo &info, UErrorCode &errorCode) const;
 
     /**
@@ -254,7 +254,7 @@ public:
      * @stable ICU 4.6
      */
     virtual void
-    nameToUnicodeUTF8(const StringPiece &name, ByteSink &dest,
+    nameToUnicodeUTF8(StringPiece name, ByteSink &dest,
                       IDNAInfo &info, UErrorCode &errorCode) const;
 };
 
index 257f72e3608fd83abef55aafd15f3b8388ac1ea6..9657593667060620a26171866f13f8a7bdb025df 100644 (file)
@@ -3279,7 +3279,7 @@ public:
    * @see toUTF8String
    * @stable ICU 4.2
    */
-  static UnicodeString fromUTF8(const StringPiece &utf8);
+  static UnicodeString fromUTF8(StringPiece utf8);
 
   /**
    * Create a UnicodeString from a UTF-32 string.
index 2004a8ce420bdbb13e37ddb865e70dab8a3cdd33..b88ea77c4e8478ef76bc1319256726bbbdf4ab25 100644 (file)
@@ -417,7 +417,7 @@ UnicodeString::~UnicodeString()
 // Factory methods
 //========================================
 
-UnicodeString UnicodeString::fromUTF8(const StringPiece &utf8) {
+UnicodeString UnicodeString::fromUTF8(StringPiece utf8) {
   UnicodeString result;
   result.setToUTF8(utf8);
   return result;
index 7e9707712bd8886a5d0d3458e2acebc9114c2561..7bc4f925caca0ba26bababf5596f18423a571a5b 100644 (file)
@@ -70,7 +70,7 @@ isASCIIOkBiDi(const char *s, int32_t length);
 IDNA::~IDNA() {}
 
 void
-IDNA::labelToASCII_UTF8(const StringPiece &label, ByteSink &dest,
+IDNA::labelToASCII_UTF8(StringPiece label, ByteSink &dest,
                         IDNAInfo &info, UErrorCode &errorCode) const {
     if(U_SUCCESS(errorCode)) {
         UnicodeString destString;
@@ -80,7 +80,7 @@ IDNA::labelToASCII_UTF8(const StringPiece &label, ByteSink &dest,
 }
 
 void
-IDNA::labelToUnicodeUTF8(const StringPiece &label, ByteSink &dest,
+IDNA::labelToUnicodeUTF8(StringPiece label, ByteSink &dest,
                          IDNAInfo &info, UErrorCode &errorCode) const {
     if(U_SUCCESS(errorCode)) {
         UnicodeString destString;
@@ -90,7 +90,7 @@ IDNA::labelToUnicodeUTF8(const StringPiece &label, ByteSink &dest,
 }
 
 void
-IDNA::nameToASCII_UTF8(const StringPiece &name, ByteSink &dest,
+IDNA::nameToASCII_UTF8(StringPiece name, ByteSink &dest,
                        IDNAInfo &info, UErrorCode &errorCode) const {
     if(U_SUCCESS(errorCode)) {
         UnicodeString destString;
@@ -100,7 +100,7 @@ IDNA::nameToASCII_UTF8(const StringPiece &name, ByteSink &dest,
 }
 
 void
-IDNA::nameToUnicodeUTF8(const StringPiece &name, ByteSink &dest,
+IDNA::nameToUnicodeUTF8(StringPiece name, ByteSink &dest,
                         IDNAInfo &info, UErrorCode &errorCode) const {
     if(U_SUCCESS(errorCode)) {
         UnicodeString destString;
@@ -133,19 +133,19 @@ public:
                   IDNAInfo &info, UErrorCode &errorCode) const;
 
     virtual void
-    labelToASCII_UTF8(const StringPiece &label, ByteSink &dest,
+    labelToASCII_UTF8(StringPiece label, ByteSink &dest,
                       IDNAInfo &info, UErrorCode &errorCode) const;
 
     virtual void
-    labelToUnicodeUTF8(const StringPiece &label, ByteSink &dest,
+    labelToUnicodeUTF8(StringPiece label, ByteSink &dest,
                        IDNAInfo &info, UErrorCode &errorCode) const;
 
     virtual void
-    nameToASCII_UTF8(const StringPiece &name, ByteSink &dest,
+    nameToASCII_UTF8(StringPiece name, ByteSink &dest,
                      IDNAInfo &info, UErrorCode &errorCode) const;
 
     virtual void
-    nameToUnicodeUTF8(const StringPiece &name, ByteSink &dest,
+    nameToUnicodeUTF8(StringPiece name, ByteSink &dest,
                       IDNAInfo &info, UErrorCode &errorCode) const;
 
 private:
@@ -253,25 +253,25 @@ UTS46::nameToUnicode(const UnicodeString &name, UnicodeString &dest,
 }
 
 void
-UTS46::labelToASCII_UTF8(const StringPiece &label, ByteSink &dest,
+UTS46::labelToASCII_UTF8(StringPiece label, ByteSink &dest,
                          IDNAInfo &info, UErrorCode &errorCode) const {
     processUTF8(label, TRUE, TRUE, dest, info, errorCode);
 }
 
 void
-UTS46::labelToUnicodeUTF8(const StringPiece &label, ByteSink &dest,
+UTS46::labelToUnicodeUTF8(StringPiece label, ByteSink &dest,
                           IDNAInfo &info, UErrorCode &errorCode) const {
     processUTF8(label, TRUE, FALSE, dest, info, errorCode);
 }
 
 void
-UTS46::nameToASCII_UTF8(const StringPiece &name, ByteSink &dest,
+UTS46::nameToASCII_UTF8(StringPiece name, ByteSink &dest,
                         IDNAInfo &info, UErrorCode &errorCode) const {
     processUTF8(name, FALSE, TRUE, dest, info, errorCode);
 }
 
 void
-UTS46::nameToUnicodeUTF8(const StringPiece &name, ByteSink &dest,
+UTS46::nameToUnicodeUTF8(StringPiece name, ByteSink &dest,
                          IDNAInfo &info, UErrorCode &errorCode) const {
     processUTF8(name, FALSE, FALSE, dest, info, errorCode);
 }
index c35b527b193ce1f6e8ed73c7a4fbe33949927032..6ba57cff7606ace22103b62e58e64d7cf4c3bfe8 100644 (file)
@@ -830,7 +830,7 @@ DecimalFormat::format(  double number,
 
 
 UnicodeString&
-DecimalFormat::format(const StringPiece &number,
+DecimalFormat::format(StringPiece number,
                       UnicodeString &toAppendTo,
                       FieldPositionIterator *posIter,
                       UErrorCode &status) const
index 7513287a0abda0e8347b43a25904c9327484d0cc..4c736b4d5f386807ab7cbe10bf8b12211f378150 100644 (file)
@@ -157,7 +157,7 @@ Formattable::Formattable(int64_t value)
 // -------------------------------------
 // Creates a formattable object with a decimal number value from a string.
 
-Formattable::Formattable(const StringPiece &number, UErrorCode &status) {
+Formattable::Formattable(StringPiece number, UErrorCode &status) {
     init();
     setDecimalNumber(number, status);
 }
@@ -798,7 +798,7 @@ Formattable::adoptDigitList(DigitList *dl) {
 
 // ---------------------------------------
 void
-Formattable::setDecimalNumber(const StringPiece &numberString, UErrorCode &status) {
+Formattable::setDecimalNumber(StringPiece numberString, UErrorCode &status) {
     if (U_FAILURE(status)) {
         return;
     }
index b9f29e96ff016d4ce76a145ae8758a19a0877e57..ef0851911f6621ad36210794465af3bf721126e3 100644 (file)
@@ -452,7 +452,7 @@ NumberFormat::format(int64_t number,
 //       XXXFormat::format(double
 
 UnicodeString&
-NumberFormat::format(const StringPiece &decimalNum,
+NumberFormat::format(StringPiece decimalNum,
                      UnicodeString& toAppendTo,
                      FieldPositionIterator* fpi,
                      UErrorCode& status) const
index af440018d466b28d009747755cc32b16cbb680dd..ddb7e23e229bb65bb89a94eed9444ca81c899a8d 100644 (file)
@@ -1091,7 +1091,7 @@ public:
      * @return          Reference to 'appendTo' parameter.
      * @stable 4.4
      */
-    virtual UnicodeString& format(const StringPiece &number,
+    virtual UnicodeString& format(StringPiece number,
                                   UnicodeString& appendTo,
                                   FieldPositionIterator* posIter,
                                   UErrorCode& status) const;
index e3e37d084a4b4376d0d64ffacc6523f54b6664d0..ac5daba893646f794a83befc853ab9b338993edf 100644 (file)
@@ -136,7 +136,7 @@ public:
      *                decimal number.
      * @stable ICU 4.4
      */
-    Formattable(const StringPiece &number, UErrorCode &status);
+    Formattable(StringPiece number, UErrorCode &status);
 
     /**
      * Creates a Formattable object with a UnicodeString object to copy from.
@@ -583,7 +583,7 @@ public:
      *                      incoming string is not a valid decimal number.
      * @stable ICU 4.4
      */
-    void             setDecimalNumber(const StringPiece &numberString,
+    void             setDecimalNumber(StringPiece numberString,
                                       UErrorCode &status);
 
     /**
index 08e1773405ea3e5b12c424b1385c782aa701ab28..d0c63580bf4f966a1fb0214a11c1b4b5be38a9d4 100644 (file)
@@ -519,7 +519,7 @@ public:
      * @return          Reference to 'appendTo' parameter.
      * @stable 4.4
      */
-    virtual UnicodeString& format(const StringPiece &number,
+    virtual UnicodeString& format(StringPiece number,
                                   UnicodeString& appendTo,
                                   FieldPositionIterator* posIter,
                                   UErrorCode& status) const;