LCOV - code coverage report
Current view: top level - xpcom/io - nsBinaryStream.h (source / functions) Hit Total Coverage
Test: output.info Lines: 12 12 100.0 %
Date: 2017-07-14 16:53:18 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef nsBinaryStream_h___
       8             : #define nsBinaryStream_h___
       9             : 
      10             : #include "nsCOMPtr.h"
      11             : #include "nsAString.h"
      12             : #include "nsIObjectInputStream.h"
      13             : #include "nsIObjectOutputStream.h"
      14             : #include "nsIStreamBufferAccess.h"
      15             : 
      16             : #define NS_BINARYOUTPUTSTREAM_CID        \
      17             : { /* 86c37b9a-74e7-4672-844e-6e7dd83ba484 */         \
      18             :      0x86c37b9a,                                     \
      19             :      0x74e7,                                         \
      20             :      0x4672,                                         \
      21             :     {0x84, 0x4e, 0x6e, 0x7d, 0xd8, 0x3b, 0xa4, 0x84} \
      22             : }
      23             : 
      24             : #define NS_BINARYOUTPUTSTREAM_CONTRACTID "@mozilla.org/binaryoutputstream;1"
      25             : 
      26             : // Derive from nsIObjectOutputStream so this class can be used as a superclass
      27             : // by nsObjectOutputStream.
      28             : class nsBinaryOutputStream final : public nsIObjectOutputStream
      29             : {
      30             : public:
      31           4 :   nsBinaryOutputStream()
      32           4 :   {
      33           4 :   }
      34             : 
      35             : protected:
      36             :   // nsISupports methods
      37             :   NS_DECL_ISUPPORTS
      38             : 
      39             :   // nsIOutputStream methods
      40             :   NS_DECL_NSIOUTPUTSTREAM
      41             : 
      42             :   // nsIBinaryOutputStream methods
      43             :   NS_DECL_NSIBINARYOUTPUTSTREAM
      44             : 
      45             :   // nsIObjectOutputStream methods
      46             :   NS_DECL_NSIOBJECTOUTPUTSTREAM
      47             : 
      48             :   // Call Write(), ensuring that all proffered data is written
      49             :   nsresult WriteFully(const char* aBuf, uint32_t aCount);
      50             : 
      51             :   nsCOMPtr<nsIOutputStream>       mOutputStream;
      52             :   nsCOMPtr<nsIStreamBufferAccess> mBufferAccess;
      53             : 
      54             : private:
      55             :   // virtual dtor since subclasses call our Release()
      56           8 :   virtual ~nsBinaryOutputStream()
      57           4 :   {
      58          12 :   }
      59             : };
      60             : 
      61             : #define NS_BINARYINPUTSTREAM_CID        \
      62             : { /* c521a612-2aad-46db-b6ab-3b821fb150b1 */       \
      63             :    0xc521a612,                                     \
      64             :    0x2aad,                                         \
      65             :    0x46db,                                         \
      66             :   {0xb6, 0xab, 0x3b, 0x82, 0x1f, 0xb1, 0x50, 0xb1} \
      67             : }
      68             : 
      69             : #define NS_BINARYINPUTSTREAM_CONTRACTID "@mozilla.org/binaryinputstream;1"
      70             : 
      71             : class nsBinaryInputStream final : public nsIObjectInputStream
      72             : {
      73             : public:
      74          76 :   nsBinaryInputStream()
      75          76 :   {
      76          76 :   }
      77             : 
      78             : protected:
      79             :   // nsISupports methods
      80             :   NS_DECL_ISUPPORTS
      81             : 
      82             :   // nsIInputStream methods
      83             :   NS_DECL_NSIINPUTSTREAM
      84             : 
      85             :   // nsIBinaryInputStream methods
      86             :   NS_DECL_NSIBINARYINPUTSTREAM
      87             : 
      88             :   // nsIObjectInputStream methods
      89             :   NS_DECL_NSIOBJECTINPUTSTREAM
      90             : 
      91             :   nsCOMPtr<nsIInputStream>        mInputStream;
      92             :   nsCOMPtr<nsIStreamBufferAccess> mBufferAccess;
      93             : 
      94             : private:
      95             :   // virtual dtor since subclasses call our Release()
      96         152 :   virtual ~nsBinaryInputStream()
      97          76 :   {
      98         228 :   }
      99             : };
     100             : 
     101             : #endif // nsBinaryStream_h___

Generated by: LCOV version 1.13