Issue 4632 (#4803)

* Updated the Petstore samples

* This change uses std::stringstream for string conversions instead of std::to_string(). Android doesn't yet support std::to_string(). This should fix #4632
This commit is contained in:
Martin Brown
2017-04-24 10:27:51 -04:00
committed by wing328
parent 7282ad2d6a
commit fc2b3d49ea
33 changed files with 143 additions and 168 deletions

View File

@@ -33,11 +33,15 @@ utility::string_t ApiClient::parameterToString(utility::string_t value)
}
utility::string_t ApiClient::parameterToString(int64_t value)
{
return utility::conversions::to_string_t(std::to_string(value));
std::stringstream valueAsStringStream;
valueAsStringStream << value;
return utility::conversions::to_string_t(valueAsStringStream.str());
}
utility::string_t ApiClient::parameterToString(int32_t value)
{
return utility::conversions::to_string_t(std::to_string(value));
std::stringstream valueAsStringStream;
valueAsStringStream << value;
return utility::conversions::to_string_t(valueAsStringStream.str());
}
utility::string_t ApiClient::parameterToString(float value)

View File

@@ -118,7 +118,9 @@ std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t&
content->setName( name );
content->setContentDisposition( U("form-data") );
content->setContentType( contentType );
content->setData( std::shared_ptr<std::istream>( new std::stringstream( std::to_string( value ) ) ) );
std::stringstream* valueAsStringStream = new std::stringstream();
(*valueAsStringStream) << value;
content->setData( std::shared_ptr<std::istream>( valueAsStringStream ) );
return content;
}
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType )
@@ -127,7 +129,9 @@ std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t&
content->setName( name );
content->setContentDisposition( U("form-data") );
content->setContentType( contentType );
content->setData( std::shared_ptr<std::istream>( new std::stringstream( std::to_string( value ) ) ) );
std::stringstream* valueAsStringStream = new std::stringstream();
(*valueAsStringStream) << value;
content->setData( std::shared_ptr<std::istream>( valueAsStringStream) ) ;
return content;
}
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType )
@@ -136,7 +140,9 @@ std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t&
content->setName( name );
content->setContentDisposition( U("form-data") );
content->setContentType( contentType );
content->setData( std::shared_ptr<std::istream>( new std::stringstream( std::to_string( value ) ) ) );
std::stringstream* valueAsStringStream = new std::stringstream();
(*valueAsStringStream) << value;
content->setData( std::shared_ptr<std::istream>( valueAsStringStream ) );
return content;
}