summaryrefslogtreecommitdiff
path: root/automation
diff options
context:
space:
mode:
authorChristina Rossmanith <ChrRossmanith@web.de>2011-06-29 22:52:41 +0200
committerChristina Rossmanith <ChrRossmanith@web.de>2011-07-05 21:16:07 +0200
commit002da0a3abe9e60f5c07105839b53008182f171a (patch)
tree26aea13995d85bbfee2272e4866dde3684b39bf0 /automation
parent9e91dbca08056fc31f388f5642fdfa3d2b910990 (diff)
Replace ByteString with rtl::OString
Diffstat (limited to 'automation')
-rw-r--r--automation/source/testtool/httprequest.cxx41
-rw-r--r--automation/source/testtool/httprequest.hxx24
2 files changed, 34 insertions, 31 deletions
diff --git a/automation/source/testtool/httprequest.cxx b/automation/source/testtool/httprequest.cxx
index 99d1aee8c..6fc3478ea 100644
--- a/automation/source/testtool/httprequest.cxx
+++ b/automation/source/testtool/httprequest.cxx
@@ -38,8 +38,8 @@
void HttpRequest::Init()
{
nResultId = 0;
- aHeader.Erase();
- aContentType.Erase();
+ aHeader = rtl::OString();
+ aContentType = rtl::OString();
delete pStream;
pStream = NULL;
}
@@ -59,7 +59,7 @@ HttpRequest::~HttpRequest()
pOutSocket = NULL;
}
-void HttpRequest::SetRequest( ByteString aHost, ByteString aPath, sal_uInt16 nPort )
+void HttpRequest::SetRequest( rtl::OString aHost, rtl::OString aPath, sal_uInt16 nPort )
{
nStatus = HTTP_REQUEST_SET;
Init();
@@ -68,7 +68,7 @@ void HttpRequest::SetRequest( ByteString aHost, ByteString aPath, sal_uInt16 nPo
nRequestPort = nPort;
}
-void HttpRequest::SetProxy( ByteString aHost, sal_uInt16 nPort )
+void HttpRequest::SetProxy( rtl::OString aHost, sal_uInt16 nPort )
{
nStatus = HTTP_REQUEST_SET;
Init();
@@ -84,13 +84,13 @@ sal_Bool HttpRequest::Execute()
// Open channel to standard redir host
osl::SocketAddr aConnectAddr;
- if ( aProxyHost.Len() )
+ if ( aProxyHost.getLength() )
{
- aConnectAddr = osl::SocketAddr( rtl::OUString( UniString( aProxyHost, RTL_TEXTENCODING_UTF8 ) ), nProxyPort );
+ aConnectAddr = osl::SocketAddr( rtl::OStringToOUString( aProxyHost, RTL_TEXTENCODING_UTF8 ), nProxyPort );
}
else
{
- aConnectAddr = osl::SocketAddr( rtl::OUString( UniString( aRequestHost, RTL_TEXTENCODING_UTF8 ) ), nRequestPort );
+ aConnectAddr = osl::SocketAddr( rtl::OStringToOUString( aRequestHost, RTL_TEXTENCODING_UTF8 ), nRequestPort );
}
TimeValue aTV;
@@ -107,13 +107,13 @@ sal_Bool HttpRequest::Execute()
}
SendString( pOutSocket, "GET " );
- if ( aProxyHost.Len() )
+ if ( aProxyHost.getLength() )
{
//GET http://staroffice-doc.germany.sun.com/cgi-bin/htdig/binarycopy.sh?CopyIt=++CopyIt++ HTTP/1.0
SendString( pOutSocket, "http://" );
SendString( pOutSocket, aRequestHost );
SendString( pOutSocket, ":" );
- SendString( pOutSocket, ByteString::CreateFromInt32( nRequestPort ) );
+ SendString( pOutSocket, rtl::OString::valueOf( (sal_Int32) nRequestPort ) );
SendString( pOutSocket, aRequestPath );
SendString( pOutSocket, " HTTP/1.0\n" );
@@ -156,21 +156,24 @@ sal_Bool HttpRequest::Execute()
pStream->Seek( 0 );
- ByteString aLine;
+ rtl::OString aLine;
sal_Bool bInsideHeader = sal_True;
+ sal_Int32 nIndex;
while ( bInsideHeader )
{
pStream->ReadLine( aLine );
- if ( !aLine.Len() )
+ if ( !aLine.getLength() )
bInsideHeader = sal_False;
else
{
- if ( IsItem( "HTTP/", aLine ) )
- nResultId = (sal_uInt16)aLine.GetToken( 1, ' ' ).ToInt32();
+ if ( IsItem( "HTTP/", aLine ) ) {
+ nIndex = 0;
+ nResultId = (sal_uInt16)aLine.getToken( (sal_Int32)1, ' ', nIndex ).toInt32();
+ }
if ( IsItem( "Content-Type:", aLine ) )
{
- aContentType = aLine.Copy( 13 );
- aContentType.EraseLeadingAndTrailingChars();
+ aContentType = aLine.copy( 13 );
+ aContentType.trim();
}
aHeader += aLine;
aHeader += "\n";
@@ -200,15 +203,15 @@ Servlet-Engine: Tomcat Web Server/3.2.1 (JSP 1.1; Servlet 2.2; Java 1.3.0; Linux
Connection: close
Content-Type: text/xml; charset=ISO-8859-1
*/
-void HttpRequest::SendString( osl::StreamSocket* pSocket , ByteString aText )
+void HttpRequest::SendString( osl::StreamSocket* pSocket , rtl::OString aText )
{
if ( nStatus == HTTP_REQUEST_PENDING )
- pSocket->write( aText.GetBuffer(), aText.Len() );
+ pSocket->write( aText.getStr(), aText.getLength() );
}
-sal_Bool HttpRequest::IsItem( ByteString aItem, ByteString aLine )
+sal_Bool HttpRequest::IsItem( rtl::OString aItem, rtl::OString aLine )
{
- return aItem.Match( aLine ) == STRING_MATCH;
+ return aItem.match( aLine );
}
diff --git a/automation/source/testtool/httprequest.hxx b/automation/source/testtool/httprequest.hxx
index 3996a9c62..d4f0a722f 100644
--- a/automation/source/testtool/httprequest.hxx
+++ b/automation/source/testtool/httprequest.hxx
@@ -35,8 +35,8 @@
#define HTTP_REQUEST_DONE 3
#define HTTP_REQUEST_ERROR 4
-#include <tools/string.hxx>
#include <tools/stream.hxx>
+#include <rtl/string.hxx>
namespace osl
{
@@ -46,37 +46,37 @@ namespace osl
class HttpRequest
{
- ByteString aRequestPath;
- ByteString aRequestHost;
+ rtl::OString aRequestPath;
+ rtl::OString aRequestHost;
sal_uInt16 nRequestPort;
- ByteString aProxyHost;
+ rtl::OString aProxyHost;
sal_uInt16 nProxyPort;
sal_uInt16 nStatus;
osl::ConnectorSocket *pOutSocket;
- ByteString aHeader;
+ rtl::OString aHeader;
sal_uInt16 nResultId;
- ByteString aContentType;
+ rtl::OString aContentType;
SvMemoryStream* pStream;
- void SendString( osl::StreamSocket* pSocket, ByteString aText );
- sal_Bool IsItem( ByteString aItem, ByteString aLine );
+ void SendString( osl::StreamSocket* pSocket, ::rtl::OString aText );
+ sal_Bool IsItem( rtl::OString aItem, rtl::OString aLine );
void Init();
public:
HttpRequest();
~HttpRequest();
- void SetRequest( ByteString aHost, ByteString aPath, sal_uInt16 nPort );
- void SetProxy( ByteString aHost, sal_uInt16 nPort );
+ void SetRequest( rtl::OString aHost, rtl::OString aPath, sal_uInt16 nPort );
+ void SetProxy( rtl::OString aHost, sal_uInt16 nPort );
sal_Bool Execute();
void Abort();
- ByteString GetHeader() const { return aHeader; }
+ rtl::OString GetHeader() const { return aHeader; }
SvMemoryStream* GetBody();
- ByteString GetContentType() const { return aContentType; }
+ rtl::OString GetContentType() const { return aContentType; }
sal_uInt16 GetResultId() const { return nResultId; }
sal_uInt16 GetStatus();