[Libreoffice-commits] core.git: include/svtools svtools/source
Stephan Bergmann
sbergman at redhat.com
Fri Oct 7 16:30:33 UTC 2016
include/svtools/rtfout.hxx | 20 +++++------------
svtools/source/svrtf/rtfout.cxx | 47 +++++++++++++++++++++-------------------
2 files changed, 32 insertions(+), 35 deletions(-)
New commits:
commit e738e79d21c8f48784602efdd915aed3ef2a7c2d
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 7 18:27:43 2016 +0200
Clean up RTFOutFuncs interface
Change-Id: I934f2375474035504b4ba9612af4f45a7d05ce9b
diff --git a/include/svtools/rtfout.hxx b/include/svtools/rtfout.hxx
index 504a648..508414d 100644
--- a/include/svtools/rtfout.hxx
+++ b/include/svtools/rtfout.hxx
@@ -30,20 +30,14 @@ namespace rtl {
};
class SvStream;
-class SVT_DLLPUBLIC RTFOutFuncs
-{
-public:
- static SvStream& Out_Char( SvStream&, sal_Unicode cChar,
- int *pUCMode,
- rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- bool bWriteHelpFile = false );
- static SvStream& Out_String( SvStream&, const rtl::OUString&,
- rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- bool bWriteHelpFile = false );
-
- static SvStream& Out_Hex( SvStream&, sal_uLong nHex, sal_uInt8 nLen );
-};
+namespace RTFOutFuncs {
+
+SVT_DLLPUBLIC SvStream& Out_String(
+ SvStream&, const rtl::OUString&,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ bool bWriteHelpFile = false );
+}
#endif
diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx
index 68ccedd..405d2e4 100644
--- a/svtools/source/svrtf/rtfout.cxx
+++ b/svtools/source/svrtf/rtfout.cxx
@@ -24,7 +24,29 @@
#include <svtools/rtfkeywd.hxx>
#include <svtools/rtfout.hxx>
-SvStream& RTFOutFuncs::Out_Char(SvStream& rStream, sal_Unicode c,
+namespace {
+
+SvStream& Out_Hex( SvStream& rStream, sal_uLong nHex, sal_uInt8 nLen )
+{
+ sal_Char aNToABuf[] = "0000000000000000";
+
+ DBG_ASSERT( nLen < sizeof(aNToABuf), "zu viele Stellen" );
+ if( nLen >= sizeof(aNToABuf) )
+ nLen = (sizeof(aNToABuf)-1);
+
+ // set pointer to end of buffer
+ sal_Char* pStr = aNToABuf + (sizeof(aNToABuf)-1);
+ for( sal_uInt8 n = 0; n < nLen; ++n )
+ {
+ *(--pStr) = (sal_Char)(nHex & 0xf ) + 48;
+ if( *pStr > '9' )
+ *pStr += 39;
+ nHex >>= 4;
+ }
+ return rStream.WriteCharPtr( pStr );
+}
+
+SvStream& Out_Char(SvStream& rStream, sal_Unicode c,
int *pUCMode, rtl_TextEncoding eDestEnc, bool bWriteHelpFile)
{
const sal_Char* pStr = nullptr;
@@ -147,6 +169,8 @@ SvStream& RTFOutFuncs::Out_Char(SvStream& rStream, sal_Unicode c,
return rStream;
}
+}
+
SvStream& RTFOutFuncs::Out_String( SvStream& rStream, const OUString& rStr,
rtl_TextEncoding eDestEnc, bool bWriteHelpFile)
{
@@ -158,25 +182,4 @@ SvStream& RTFOutFuncs::Out_String( SvStream& rStream, const OUString& rStr,
return rStream;
}
-SvStream& RTFOutFuncs::Out_Hex( SvStream& rStream, sal_uLong nHex, sal_uInt8 nLen )
-{
- sal_Char aNToABuf[] = "0000000000000000";
-
- DBG_ASSERT( nLen < sizeof(aNToABuf), "zu viele Stellen" );
- if( nLen >= sizeof(aNToABuf) )
- nLen = (sizeof(aNToABuf)-1);
-
- // set pointer to end of buffer
- sal_Char* pStr = aNToABuf + (sizeof(aNToABuf)-1);
- for( sal_uInt8 n = 0; n < nLen; ++n )
- {
- *(--pStr) = (sal_Char)(nHex & 0xf ) + 48;
- if( *pStr > '9' )
- *pStr += 39;
- nHex >>= 4;
- }
- return rStream.WriteCharPtr( pStr );
-}
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list