| 2168 | } |
| 2169 | |
| 2170 | String String::operator+(const String &inRHS) const |
| 2171 | { |
| 2172 | if (!__s) return HX_CSTRING("null") + inRHS; |
| 2173 | if (!length) |
| 2174 | { |
| 2175 | if (!inRHS.__s) |
| 2176 | return HX_CSTRING("null"); |
| 2177 | return inRHS; |
| 2178 | } |
| 2179 | if (!inRHS.__s) return *this + HX_CSTRING("null"); |
| 2180 | if (!inRHS.length) return *this; |
| 2181 | |
| 2182 | int l = length + inRHS.length; |
| 2183 | |
| 2184 | #ifdef HX_SMART_STRINGS |
| 2185 | bool ws0 = isUTF16Encoded(); |
| 2186 | bool ws1 = inRHS.isUTF16Encoded(); |
| 2187 | if (ws0 || ws1) |
| 2188 | { |
| 2189 | char16_t *result = String::allocChar16Ptr(l); |
| 2190 | |
| 2191 | if (ws0) |
| 2192 | memcpy(result,__w,length*2); |
| 2193 | else |
| 2194 | for(int i=0;i<length;i++) |
| 2195 | result[i] = __s[i]; |
| 2196 | |
| 2197 | char16_t *r2 = result + length; |
| 2198 | if (ws1) |
| 2199 | memcpy(r2, inRHS.__w, inRHS.length*2); |
| 2200 | else |
| 2201 | for(int i=0;i<inRHS.length;i++) |
| 2202 | r2[i] = inRHS.__s[i]; |
| 2203 | |
| 2204 | return String(result,l); |
| 2205 | } |
| 2206 | #endif |
| 2207 | |
| 2208 | |
| 2209 | char *result = hx::NewString(l); |
| 2210 | memcpy(result,__s,length*sizeof(char)); |
| 2211 | memcpy(result+length,inRHS.__s,inRHS.length*sizeof(char)); |
| 2212 | result[l] = '\0'; |
| 2213 | return String(result,l); |
| 2214 | } |
| 2215 | |
| 2216 | |
| 2217 | String &String::operator+=(const String &inRHS) |
nothing calls this directly
no test coverage detected