LCOV - code coverage report
Current view: directory - xpcom/io - nsBinaryStream.h (source / functions) Found Hit Coverage
Test: app.info Lines: 4 4 100.0 %
Date: 2012-06-02 Functions: 6 6 100.0 %

       1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2                 :  * ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Mozilla Communicator client code, released
      16                 :  * March 31, 1998.
      17                 :  *
      18                 :  * The Initial Developer of the Original Code is
      19                 :  * Netscape Communications Corporation.
      20                 :  * Portions created by the Initial Developer are Copyright (C) 1998-2001
      21                 :  * the Initial Developer. All Rights Reserved.
      22                 :  *
      23                 :  * Contributor(s):
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef nsBinaryStream_h___
      40                 : #define nsBinaryStream_h___
      41                 : 
      42                 : #include "nsCOMPtr.h"
      43                 : #include "nsAString.h"
      44                 : #include "nsIObjectInputStream.h"
      45                 : #include "nsIObjectOutputStream.h"
      46                 : #include "nsIStreamBufferAccess.h"
      47                 : 
      48                 : #define NS_BINARYOUTPUTSTREAM_CID        \
      49                 : { /* 86c37b9a-74e7-4672-844e-6e7dd83ba484 */         \
      50                 :      0x86c37b9a,                                     \
      51                 :      0x74e7,                                         \
      52                 :      0x4672,                                         \
      53                 :     {0x84, 0x4e, 0x6e, 0x7d, 0xd8, 0x3b, 0xa4, 0x84} \
      54                 : }
      55                 : 
      56                 : #define NS_BINARYOUTPUTSTREAM_CONTRACTID "@mozilla.org/binaryoutputstream;1"
      57                 : #define NS_BINARYOUTPUTSTREAM_CLASSNAME "Binary Output Stream"
      58                 : 
      59                 : // Derive from nsIObjectOutputStream so this class can be used as a superclass
      60                 : // by nsObjectOutputStream.
      61                 : class nsBinaryOutputStream : public nsIObjectOutputStream
      62                 : {
      63                 : public:
      64            8253 :     nsBinaryOutputStream() {}
      65                 :     // virtual dtor since subclasses call our Release()
      66           33012 :     virtual ~nsBinaryOutputStream() {}
      67                 : 
      68                 : protected:
      69                 :     // nsISupports methods
      70                 :     NS_DECL_ISUPPORTS
      71                 : 
      72                 :     // nsIOutputStream methods
      73                 :     NS_DECL_NSIOUTPUTSTREAM
      74                 : 
      75                 :     // nsIBinaryOutputStream methods
      76                 :     NS_DECL_NSIBINARYOUTPUTSTREAM
      77                 : 
      78                 :     // nsIObjectOutputStream methods
      79                 :     NS_DECL_NSIOBJECTOUTPUTSTREAM
      80                 : 
      81                 :     // Call Write(), ensuring that all proffered data is written
      82                 :     nsresult WriteFully(const char *aBuf, PRUint32 aCount);
      83                 : 
      84                 :     nsCOMPtr<nsIOutputStream>       mOutputStream;
      85                 :     nsCOMPtr<nsIStreamBufferAccess> mBufferAccess;
      86                 : };
      87                 : 
      88                 : #define NS_BINARYINPUTSTREAM_CID        \
      89                 : { /* c521a612-2aad-46db-b6ab-3b821fb150b1 */         \
      90                 :      0xc521a612,                                     \
      91                 :      0x2aad,                                         \
      92                 :      0x46db,                                         \
      93                 :     {0xb6, 0xab, 0x3b, 0x82, 0x1f, 0xb1, 0x50, 0xb1} \
      94                 : }
      95                 : 
      96                 : #define NS_BINARYINPUTSTREAM_CONTRACTID "@mozilla.org/binaryinputstream;1"
      97                 : #define NS_BINARYINPUTSTREAM_CLASSNAME "Binary Input Stream"
      98                 : 
      99                 : // Derive from nsIObjectInputStream so this class can be used as a superclass
     100                 : // by nsObjectInputStream.
     101                 : class nsBinaryInputStream : public nsIObjectInputStream
     102                 : {
     103                 : public:
     104           17106 :     nsBinaryInputStream() {}
     105                 :     // virtual dtor since subclasses call our Release()
     106           68424 :     virtual ~nsBinaryInputStream() {}
     107                 : 
     108                 : protected:
     109                 :     // nsISupports methods
     110                 :     NS_DECL_ISUPPORTS
     111                 : 
     112                 :     // nsIInputStream methods
     113                 :     NS_DECL_NSIINPUTSTREAM
     114                 : 
     115                 :     // nsIBinaryInputStream methods
     116                 :     NS_DECL_NSIBINARYINPUTSTREAM
     117                 : 
     118                 :     // nsIObjectInputStream methods
     119                 :     NS_DECL_NSIOBJECTINPUTSTREAM
     120                 : 
     121                 :     nsCOMPtr<nsIInputStream>        mInputStream;
     122                 :     nsCOMPtr<nsIStreamBufferAccess> mBufferAccess;
     123                 : };
     124                 : 
     125                 : #endif // nsBinaryStream_h___

Generated by: LCOV version 1.7