diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-11-16 21:20:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-11-17 23:04:10 +0000 |
commit | c4927a1b76b728b2208c29d09dbf54e70bb26e13 (patch) | |
tree | c87d31d69e17414ad70da8b01249430612b2fbc4 /tools | |
parent | 7bab4645ce08e9cb41b38a983c57a514358b71ec (diff) |
ByteString->rtl::OString[Buffer]
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/inetmsg.hxx | 12 | ||||
-rw-r--r-- | tools/source/inet/inetmsg.cxx | 117 | ||||
-rw-r--r-- | tools/source/ref/errinf.cxx | 72 |
3 files changed, 92 insertions, 109 deletions
diff --git a/tools/inc/tools/inetmsg.hxx b/tools/inc/tools/inetmsg.hxx index b06541a8323d..610b804e7502 100644 --- a/tools/inc/tools/inetmsg.hxx +++ b/tools/inc/tools/inetmsg.hxx @@ -80,26 +80,16 @@ public: friend SvStream& operator<< ( SvStream& rStrm, const INetMessageHeader& rHdr) { -#ifdef ENABLE_BYTESTRING_STREAM_OPERATORS - rStrm << rHdr.m_aName; - rStrm << rHdr.m_aValue; -#else rStrm.WriteByteString (rHdr.m_aName); rStrm.WriteByteString (rHdr.m_aValue); -#endif return rStrm; } friend SvStream& operator>> ( SvStream& rStrm, INetMessageHeader& rHdr) { -#ifdef ENABLE_BYTESTRING_STREAM_OPERATORS - rStrm >> rHdr.m_aName; - rStrm >> rHdr.m_aValue; -#else rStrm.ReadByteString (rHdr.m_aName); rStrm.ReadByteString (rHdr.m_aValue); -#endif return rStrm; } }; @@ -160,7 +150,7 @@ protected: void SetHeaderField_Impl ( INetMIME::HeaderFieldType eType, - const ByteString &rName, + const rtl::OString &rName, const UniString &rValue, sal_uIntPtr &rnIndex); diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 11bd5dbcefd9..6cbbb20aab8d 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -110,7 +110,7 @@ void INetMessage::ListCopy (const INetMessage &rMsg) */ void INetMessage::SetHeaderField_Impl ( INetMIME::HeaderFieldType eType, - const ByteString &rName, + const rtl::OString &rName, const UniString &rValue, sal_uIntPtr &rnIndex) { @@ -194,33 +194,33 @@ namespace { struct ImplINetRFC822MessageHeaderDataImpl { - const ByteString* operator()() + const rtl::OString* operator()() { - static const ByteString _ImplINetRFC822MessageHeaderData[] = + static const rtl::OString _ImplINetRFC822MessageHeaderData[] = { - ByteString ("BCC"), - ByteString ("CC"), - ByteString ("Comments"), - ByteString ("Date"), - ByteString ("From"), - ByteString ("In-Reply-To"), - ByteString ("Keywords"), - ByteString ("Message-ID"), - ByteString ("References"), - ByteString ("Reply-To"), - ByteString ("Return-Path"), - ByteString ("Subject"), - ByteString ("Sender"), - ByteString ("To"), - ByteString ("X-Mailer"), - ByteString ("Return-Receipt-To") + rtl::OString(RTL_CONSTASCII_STRINGPARAM("BCC")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("CC")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Comments")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Date")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("From")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("In-Reply-To")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Keywords")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Message-ID")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("References")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Reply-To")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Return-Path")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Subject")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Sender")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("To")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("X-Mailer")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Return-Receipt-To")) }; return &_ImplINetRFC822MessageHeaderData[0]; } }; struct ImplINetRFC822MessageHeaderData - : public rtl::StaticAggregate< const ByteString, ImplINetRFC822MessageHeaderDataImpl > {}; + : public rtl::StaticAggregate< const rtl::OString, ImplINetRFC822MessageHeaderDataImpl > {}; } #define HDR(n) ImplINetRFC822MessageHeaderData::get()[(n)] @@ -305,28 +305,28 @@ static const sal_Char *months[12] = /* * ParseDateField and local helper functions. */ -static sal_uInt16 ParseNumber (const ByteString& rStr, sal_uInt16& nIndex) +static sal_uInt16 ParseNumber(const rtl::OString& rStr, sal_uInt16& nIndex) { sal_uInt16 n = nIndex; - while ((n < rStr.Len()) && ascii_isDigit(rStr.GetChar(n))) n++; + while ((n < rStr.getLength()) && ascii_isDigit(rStr[n])) n++; - rtl::OString aNum (rStr.Copy (nIndex, (n - nIndex))); + rtl::OString aNum(rStr.copy(nIndex, (n - nIndex))); nIndex = n; return (sal_uInt16)(aNum.toInt32()); } -static sal_uInt16 ParseMonth (const ByteString& rStr, sal_uInt16& nIndex) +static sal_uInt16 ParseMonth(const rtl::OString& rStr, sal_uInt16& nIndex) { sal_uInt16 n = nIndex; - while ((n < rStr.Len()) && ascii_isLetter(rStr.GetChar(n))) n++; + while ((n < rStr.getLength()) && ascii_isLetter(rStr[n])) n++; - ByteString aMonth (rStr.Copy (nIndex, 3)); + rtl::OString aMonth(rStr.copy(nIndex, 3)); nIndex = n; sal_uInt16 i; for (i = 0; i < 12; i++) - if (aMonth.CompareIgnoreCaseToAscii (months[i]) == 0) break; + if (aMonth.equalsIgnoreAsciiCase(months[i])) break; return (i + 1); } @@ -446,9 +446,9 @@ sal_Bool INetRFC822Message::ParseDateField ( sal_uIntPtr INetRFC822Message::SetHeaderField ( const INetMessageHeader &rHeader, sal_uIntPtr nNewIndex) { - ByteString aName (rHeader.GetName()); - const sal_Char *pData = aName.GetBuffer(); - const sal_Char *pStop = pData + aName.Len() + 1; + rtl::OString aName (rHeader.GetName()); + const sal_Char *pData = aName.getStr(); + const sal_Char *pStop = pData + aName.getLength() + 1; const sal_Char *check = ""; sal_uIntPtr nIdx = LIST_APPEND; @@ -716,23 +716,23 @@ namespace { struct ImplINetMIMEMessageHeaderDataImpl { - const ByteString* operator()() + const rtl::OString* operator()() { - static const ByteString _ImplINetMIMEMessageHeaderData[] = + static const rtl::OString _ImplINetMIMEMessageHeaderData[] = { - ByteString ("MIME-Version"), - ByteString ("Content-Description"), - ByteString ("Content-Disposition"), - ByteString ("Content-ID"), - ByteString ("Content-Type"), - ByteString ("Content-Transfer-Encoding") + rtl::OString(RTL_CONSTASCII_STRINGPARAM("MIME-Version")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Content-Description")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Content-Disposition")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Content-ID")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Content-Type")), + rtl::OString(RTL_CONSTASCII_STRINGPARAM("Content-Transfer-Encoding")) }; return &_ImplINetMIMEMessageHeaderData[0]; } }; struct ImplINetMIMEMessageHeaderData - : public rtl::StaticAggregate< const ByteString, ImplINetMIMEMessageHeaderDataImpl > {}; + : public rtl::StaticAggregate< const rtl::OString, ImplINetMIMEMessageHeaderDataImpl > {}; } #define MIMEHDR(n) ImplINetMIMEMessageHeaderData::get()[(n)] @@ -853,9 +853,9 @@ INetMIMEMessage *INetMIMEMessage::CreateMessage ( sal_uIntPtr INetMIMEMessage::SetHeaderField ( const INetMessageHeader &rHeader, sal_uIntPtr nNewIndex) { - ByteString aName (rHeader.GetName()); - const sal_Char *pData = aName.GetBuffer(); - const sal_Char *pStop = pData + aName.Len() + 1; + rtl::OString aName (rHeader.GetName()); + const sal_Char *pData = aName.getStr(); + const sal_Char *pStop = pData + aName.getLength() + 1; const sal_Char *check = ""; sal_uIntPtr nIdx = LIST_APPEND; @@ -1077,40 +1077,40 @@ sal_Bool INetMIMEMessage::EnableAttachChild (INetMessageContainerType eType) return sal_False; // Setup Content-Type header field. - ByteString aContentType; + rtl::OStringBuffer aContentType; switch (eType) { case INETMSG_MESSAGE_RFC822: - aContentType = "message/rfc822"; + aContentType.append(RTL_CONSTASCII_STRINGPARAM("message/rfc822")); break; case INETMSG_MULTIPART_ALTERNATIVE: - aContentType = "multipart/alternative"; + aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/alternative")); break; case INETMSG_MULTIPART_DIGEST: - aContentType = "multipart/digest"; + aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/digest")); break; case INETMSG_MULTIPART_PARALLEL: - aContentType = "multipart/parallel"; + aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/parallel")); break; case INETMSG_MULTIPART_RELATED: - aContentType = "multipart/related"; + aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/related")); break; case INETMSG_MULTIPART_FORM_DATA: - aContentType = "multipart/form-data"; + aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/form-data")); break; default: - aContentType = "multipart/mixed"; + aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/mixed")); break; } // Setup boundary for multipart types. - if (aContentType.CompareIgnoreCaseToAscii ("multipart/", 10) == 0) + if (aContentType.toString().equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("multipart/"))) { // Generate a unique boundary from current time. sal_Char sTail[16 + 1]; @@ -1124,13 +1124,13 @@ sal_Bool INetMIMEMessage::EnableAttachChild (INetMessageContainerType eType) m_aBoundary += sTail; // Append boundary as ContentType parameter. - aContentType += "; boundary="; - aContentType += m_aBoundary; + aContentType.append(RTL_CONSTASCII_STRINGPARAM("; boundary=")); + aContentType.append(m_aBoundary); } // Set header fields. SetMIMEVersion (String (CONSTASCII_STRINGPARAM("1.0"))); - SetContentType (String (aContentType, RTL_TEXTENCODING_ASCII_US)); + SetContentType (rtl::OStringToOUString(aContentType.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US)); SetContentTransferEncoding (String (CONSTASCII_STRINGPARAM("7bit"))); // Done. @@ -1163,11 +1163,7 @@ SvStream& INetMIMEMessage::operator<< (SvStream& rStrm) const for (sal_uInt16 i = 0; i < INETMSG_MIME_NUMHDR; i++) rStrm << static_cast<sal_uInt32>(m_nIndex[i]); -#ifdef ENABLE_BYTESTRING_STREAM_OPERATORS - rStrm << m_aBoundary; -#else rStrm.WriteByteString (m_aBoundary); -#endif rStrm << static_cast<sal_uInt32>(aChildren.size()); return rStrm; @@ -1187,11 +1183,8 @@ SvStream& INetMIMEMessage::operator>> (SvStream& rStrm) m_nIndex[i] = nTemp; } -#ifdef ENABLE_BYTESTRING_STREAM_OPERATORS - rStrm >> m_aBoundary; -#else rStrm.ReadByteString (m_aBoundary); -#endif + rStrm >> nTemp; return rStrm; diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx index cc8a18ce754f..c2921ea32d9f 100644 --- a/tools/source/ref/errinf.cxx +++ b/tools/source/ref/errinf.cxx @@ -203,17 +203,15 @@ class ErrHdl_Impl const ErrorInfo*, String&, sal_uInt16&); }; - static void aDspFunc(const String &rErr, const String &rAction) { - ByteString aErr("Aktion: "); - aErr+= ByteString( rAction, RTL_TEXTENCODING_ASCII_US ); - aErr+=" Fehler: "; - aErr+= ByteString( rErr, RTL_TEXTENCODING_ASCII_US ); - OSL_FAIL(aErr.GetBuffer()); + rtl::OStringBuffer aErr(RTL_CONSTASCII_STRINGPARAM("Aktion: ")); + aErr.append(rtl::OUStringToOString(rAction, RTL_TEXTENCODING_ASCII_US)); + aErr.append(RTL_CONSTASCII_STRINGPARAM(" Fehler: ")); + aErr.append(rtl::OUStringToOString(rErr, RTL_TEXTENCODING_ASCII_US)); + OSL_FAIL(aErr.getStr()); } - ErrorContext::ErrorContext(Window *pWinP) { EDcrData *pData=EDcrData::GetData(); @@ -327,45 +325,47 @@ sal_uInt16 ErrorHandler::HandleError_Impl( if(ErrHdl_Impl::CreateString(pData->pFirstHdl,pInfo,aErr,nErrFlags)) { - if (bJustCreateString) - { - rError = aErr; - return 1; - } - else - { - if(!pData->pDsp) + if (bJustCreateString) { - ByteString aStr("Action: "); - aStr += ByteString( aAction, RTL_TEXTENCODING_ASCII_US ); - aStr += ByteString("\nFehler: "); - aStr += ByteString( aErr, RTL_TEXTENCODING_ASCII_US ); - OSL_FAIL( aStr.GetBuffer() ); + rError = aErr; + return 1; } else { - delete pInfo; - if(!pData->bIsWindowDsp) - { - (*(BasicDisplayErrorFunc*)pData->pDsp)(aErr,aAction); - return 0; + if(!pData->pDsp) + { + rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Action: ")); + aStr.append(rtl::OUStringToOString(aAction, RTL_TEXTENCODING_ASCII_US)); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nFehler: ")); + aStr.append(rtl::OUStringToOString(aErr, RTL_TEXTENCODING_ASCII_US)); + OSL_FAIL(aStr.getStr()); + } + else + { + delete pInfo; + if(!pData->bIsWindowDsp) + { + (*(BasicDisplayErrorFunc*)pData->pDsp)(aErr,aAction); + return 0; + } + else + { + if( nFlags != USHRT_MAX ) + nErrFlags = nFlags; + return (*(WindowDisplayErrorFunc*)pData->pDsp)( + pParent, nErrFlags, aErr, aAction); + } + } } - else - { - if( nFlags != USHRT_MAX ) - nErrFlags = nFlags; - return (*(WindowDisplayErrorFunc*)pData->pDsp)( - pParent, nErrFlags, aErr, aAction); - } - } - } } OSL_FAIL("Error nicht behandelt"); // Error 1 ist General Error im Sfx - if(pInfo->GetErrorCode()!=1) { + if(pInfo->GetErrorCode()!=1) + { HandleError_Impl(1, USHRT_MAX, bJustCreateString, rError); } - else { + else + { OSL_FAIL("Error 1 nicht gehandeled"); } delete pInfo; |