LCOV - code coverage report
Current view: top level - include/tools - inetstrm.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 8 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_TOOLS_INETSTRM_HXX
      20             : #define INCLUDED_TOOLS_INETSTRM_HXX
      21             : 
      22             : #include <tools/toolsdllapi.h>
      23             : #include <sal/types.h>
      24             : #include <rtl/ustring.hxx>
      25             : 
      26             : class INetMIMEMessage;
      27             : class SvMemoryStream;
      28             : class SvStream;
      29             : 
      30             : enum INetStreamStatus
      31             : {
      32             :     INETSTREAM_STATUS_LOADED     = -4,
      33             :     INETSTREAM_STATUS_WOULDBLOCK = -3,
      34             :     INETSTREAM_STATUS_OK         = -2,
      35             :     INETSTREAM_STATUS_ERROR      = -1
      36             : };
      37             : 
      38             : enum INetMessageStreamState
      39             : {
      40             :     INETMSG_EOL_BEGIN,
      41             :     INETMSG_EOL_DONE,
      42             :     INETMSG_EOL_SCR,
      43             :     INETMSG_EOL_FCR,
      44             :     INETMSG_EOL_FLF,
      45             :     INETMSG_EOL_FSP,
      46             :     INETMSG_EOL_FESC
      47             : };
      48             : 
      49             : /// Message Generator Interface.
      50             : class INetMessageIStream
      51             : {
      52             :     INetMIMEMessage *pSourceMsg;
      53             :     bool            bHeaderGenerated;
      54             : 
      55             :     sal_uIntPtr           nBufSiz;
      56             :     sal_Char       *pBuffer;
      57             :     sal_Char       *pRead;
      58             :     sal_Char       *pWrite;
      59             : 
      60             :     SvStream       *pMsgStrm;
      61             :     SvMemoryStream *pMsgBuffer;
      62             :     sal_Char       *pMsgRead;
      63             :     sal_Char       *pMsgWrite;
      64             : 
      65             :     INetMessageIStream (const INetMessageIStream& rStrm) SAL_DELETED_FUNCTION;
      66             :     INetMessageIStream& operator= (const INetMessageIStream& rStrm) SAL_DELETED_FUNCTION;
      67             : 
      68             : protected:
      69             :     virtual int GetMsgLine (sal_Char *pData, sal_uIntPtr nSize);
      70             : 
      71             : public:
      72             :     INetMessageIStream (sal_uIntPtr nBufferSize = 2048);
      73             :     virtual ~INetMessageIStream();
      74             : 
      75             :     TOOLS_DLLPUBLIC int Read (sal_Char *pData, sal_uIntPtr nSize);
      76             : 
      77           0 :     INetMIMEMessage *GetSourceMessage() const { return pSourceMsg; }
      78           0 :     void SetSourceMessage (INetMIMEMessage *pMsg) { pSourceMsg = pMsg; }
      79             : 
      80           0 :     void SetHeaderGenerated() { bHeaderGenerated = true; }
      81           0 :     bool IsHeaderGenerated() const { return bHeaderGenerated; }
      82             : };
      83             : 
      84             : /// Message Parser Interface.
      85             : class INetMessageOStream
      86             : {
      87             :     INetMIMEMessage        *pTargetMsg;
      88             :     bool                    bHeaderParsed;
      89             : 
      90             :     INetMessageStreamState  eOState;
      91             : 
      92             :     SvMemoryStream         *pMsgBuffer;
      93             : 
      94             :     INetMessageOStream (const INetMessageOStream& rStrm) SAL_DELETED_FUNCTION;
      95             :     INetMessageOStream& operator= (const INetMessageOStream& rStrm) SAL_DELETED_FUNCTION;
      96             : 
      97             : protected:
      98             :     virtual int PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize);
      99             : 
     100             : public:
     101             :     INetMessageOStream();
     102             :     virtual ~INetMessageOStream();
     103             : 
     104             :     int Write (const sal_Char *pData, sal_uIntPtr nSize);
     105             : 
     106           0 :     INetMIMEMessage *GetTargetMessage() const { return pTargetMsg; }
     107           0 :     void SetTargetMessage (INetMIMEMessage *pMsg) { pTargetMsg = pMsg; }
     108             : 
     109           0 :     void ParseHeader (bool bParse = true) { bHeaderParsed = !bParse; }
     110           0 :     bool IsHeaderParsed() const { return bHeaderParsed; }
     111             : };
     112             : 
     113             : enum INetMessageEncoding
     114             : {
     115             :     INETMSG_ENCODING_7BIT,
     116             :     INETMSG_ENCODING_BINARY,
     117             :     INETMSG_ENCODING_QUOTED,
     118             :     INETMSG_ENCODING_BASE64
     119             : };
     120             : 
     121             : class TOOLS_DLLPUBLIC INetMIMEMessageStream
     122             :     : public INetMessageIStream,
     123             :       public INetMessageOStream
     124             : {
     125             :     int                    eState;
     126             : 
     127             :     sal_uIntPtr                  nChildIndex;
     128             :     INetMIMEMessageStream *pChildStrm;
     129             : 
     130             :     INetMessageEncoding    eEncoding;
     131             :     INetMessageIStream    *pEncodeStrm;
     132             :     INetMessageOStream    *pDecodeStrm;
     133             : 
     134             :     SvMemoryStream        *pMsgBuffer;
     135             : 
     136             :     static INetMessageEncoding GetMsgEncoding (
     137             :         const OUString& rContentType);
     138             : 
     139             :     INetMIMEMessageStream (const INetMIMEMessageStream& rStrm) SAL_DELETED_FUNCTION;
     140             :     INetMIMEMessageStream& operator= (const INetMIMEMessageStream& rStrm) SAL_DELETED_FUNCTION;
     141             : 
     142             : protected:
     143             :     virtual int GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) SAL_OVERRIDE;
     144             :     virtual int PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) SAL_OVERRIDE;
     145             : 
     146             : public:
     147             :     INetMIMEMessageStream (sal_uIntPtr nBufferSize = 2048);
     148             :     virtual ~INetMIMEMessageStream();
     149             : };
     150             : 
     151             : #endif
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11