Coverage for /Syzygy/pdb/pdb_byte_stream.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%110.C++source

Line-by-line coverage:

   1    :  // Copyright 2012 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  
  15    :  #ifndef SYZYGY_PDB_PDB_BYTE_STREAM_H_
  16    :  #define SYZYGY_PDB_PDB_BYTE_STREAM_H_
  17    :  
  18    :  #include "base/memory/scoped_ptr.h"
  19    :  #include "syzygy/pdb/pdb_stream.h"
  20    :  
  21    :  namespace pdb {
  22    :  
  23    :  // Forward declare.
  24    :  class WritablePdbByteStream;
  25    :  
  26    :  // This class represents a PDB stream in memory.
  27    :  class PdbByteStream : public PdbStream {
  28    :   public:
  29    :    PdbByteStream();
  30    :  
  31    :    // Initializes the stream from the contents of a byte array.
  32    :    bool Init(const uint8* data, size_t length);
  33    :  
  34    :    // Initializes the stream from the contents of another PdbStream.
  35    :    bool Init(PdbStream* stream);
  36    :  
  37    :    // @name PdbStream implementation.
  38    :    // @{
  39    :    virtual bool ReadBytes(void* dest, size_t count, size_t* bytes_read) OVERRIDE;
  40    :    virtual scoped_refptr<WritablePdbStream> GetWritablePdbStream() OVERRIDE;
  41    :    // @}
  42    :  
  43    :    // Gets the stream's data pointer.
  44  E :    uint8* data() { return &data_[0]; }
  45    :  
  46    :   protected:
  47    :    // Our friend so it can access our internals.
  48    :    friend WritablePdbByteStream;
  49    :  
  50    :    // This is protected to enforce use of reference counted pointers.
  51    :    virtual ~PdbByteStream();
  52    :  
  53    :    // The stream's data.
  54    :    std::vector<uint8> data_;
  55    :  
  56    :    // This is a bit of a hack, allowing us to enforce single WritablePdbStream
  57    :    // semantics. This is most definitely *not* thread-safe.
  58    :    WritablePdbStream* writable_pdb_stream_;
  59    :  
  60    :    DISALLOW_COPY_AND_ASSIGN(PdbByteStream);
  61    :  };
  62    :  
  63    :  }  // namespace pdb
  64    :  
  65    :  #endif  // SYZYGY_PDB_PDB_BYTE_STREAM_H_

Coverage information generated Thu Jul 04 09:34:53 2013.