Fixed string concat

This commit is contained in:
lganzzzo 2018-06-27 02:07:08 +03:00
parent 248452893a
commit 8b91751bbe
4 changed files with 16 additions and 40 deletions

View File

@ -269,28 +269,5 @@ void StrBuffer::upperCase(const void* data, v_int32 size) {
if(a >= 'a' && a <= 'z') ((p_char8) data)[i] = a & 223;
}
}
// Operator
/*
oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer> operator + (const char* a, const oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer>& b){
return StrBuffer::createSharedConcatenated(a, (v_int32) std::strlen(a), b->getData(), b->getSize());
}
oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer> operator + (const oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer>& b, const char* a){
return StrBuffer::createSharedConcatenated(b->getData(), b->getSize(), a, (v_int32) std::strlen(a));
}
oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer> operator + (const oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer>& a, const oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer>& b) {
return StrBuffer::createSharedConcatenated(a->getData(), a->getSize(), b->getData(), b->getSize());
}
std::shared_ptr<StrBuffer> operator + (const char* a, const std::shared_ptr<StrBuffer>& b){
return StrBuffer::createSharedConcatenated(a, (v_int32) std::strlen(a), b->getData(), b->getSize());
}
std::shared_ptr<StrBuffer> operator + (const std::shared_ptr<StrBuffer>& b, const char* a){
return StrBuffer::createSharedConcatenated(b->getData(), b->getSize(), a, (v_int32) std::strlen(a));
}
*/
}}

View File

@ -141,15 +141,6 @@ public:
};
/*
oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer> operator + (const char* a, const oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer>& b);
oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer> operator + (const oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer>& b, const char* a);
oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer> operator + (const oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer>& a, const oatpp::data::mapping::type::PolymorphicWrapper<StrBuffer>& b);
std::shared_ptr<StrBuffer> operator + (const char* a, const std::shared_ptr<StrBuffer>& b);
std::shared_ptr<StrBuffer> operator + (const std::shared_ptr<StrBuffer>& b, const char* a);
*/
}}
#endif /* oatpp_base_StrBuffer_hpp */

View File

@ -36,6 +36,18 @@ String::String(const std::shared_ptr<oatpp::base::StrBuffer>& ptr, const type::T
}
}
String operator + (const char* a, const String& b) {
return oatpp::base::StrBuffer::createSharedConcatenated(a, (v_int32) std::strlen(a), b->getData(), b->getSize());
}
String operator + (const String& b, const char* a) {
return oatpp::base::StrBuffer::createSharedConcatenated(b->getData(), b->getSize(), a, (v_int32) std::strlen(a));
}
String operator + (const String& a, const String& b) {
return oatpp::base::StrBuffer::createSharedConcatenated(a->getData(), a->getSize(), b->getData(), b->getSize());
}
namespace __class {
type::Int32 Int32::parseFromString(const oatpp::String& str, bool& success) {

View File

@ -100,14 +100,6 @@ public:
return *this;
}
String operator + (const char* str) const{
return oatpp::base::StrBuffer::createSharedConcatenated(m_ptr->getData(), m_ptr->getSize(), str, (v_int32) std::strlen(str));
}
String operator + (const String& other) const{
return oatpp::base::StrBuffer::createSharedConcatenated(m_ptr->getData(), m_ptr->getSize(), other->getData(), other->getSize());
}
static const String& empty(){
static String empty;
return empty;
@ -123,6 +115,10 @@ public:
};
String operator + (const char* a, const String& b);
String operator + (const String& b, const char* a);
String operator + (const String& a, const String& b);
template<typename ValueType, class Clazz>
class Primitive : public oatpp::base::Controllable {
public: