Coverage for /Syzygy/msf/msf_file.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    :  // Declares MsfFile, which is an in-memory representation of an MSF file.
  16    :  // An MSF file consists of a collection of numbered MSF streams. The streams
  17    :  // themselves obey certain formats and conventions but these are not enforced
  18    :  // by this naive representation.
  19    :  
  20    :  #ifndef SYZYGY_MSF_MSF_FILE_H_
  21    :  #define SYZYGY_MSF_MSF_FILE_H_
  22    :  
  23    :  #include <vector>
  24    :  
  25    :  #include "base/memory/ref_counted.h"
  26    :  #include "syzygy/msf/msf_decl.h"
  27    :  #include "syzygy/msf/msf_stream.h"
  28    :  
  29    :  namespace msf {
  30    :  namespace detail {
  31    :  
  32    :  // A simple representation of an MSF file as a collection of numbered streams.
  33    :  // This object owns all of the streams referred to by it and maintains
  34    :  // responsibility for cleaning them up on destruction.
  35    :  template <MsfFileType T>
  36    :  class MsfFileImpl {
  37    :   public:
  38    :    MsfFileImpl();
  39    :    virtual ~MsfFileImpl();
  40    :  
  41    :    // Clears all streams. After calling this the MsfFileImpl is in the same state
  42    :    // as after construction.
  43    :    void Clear();
  44    :  
  45    :    // Accesses the nth stream.
  46    :    // @param index the index of the nth stream.
  47    :    // @returns a pointer to the stream, NULL if it does not exist.
  48    :    scoped_refptr<MsfStreamImpl<T>> GetStream(uint32 index) const;
  49    :  
  50    :    // Adds a new stream to this MSF file, returning the index of the newly
  51    :    // generated stream.
  52    :    // @param msf_stream a pointer to a heap allocated stream object This may be
  53    :    //     NULL, indicating that the nth stream exists but is empty.
  54    :    // @returns the index of the added stream.
  55    :    size_t AppendStream(MsfStreamImpl<T>* msf_stream);
  56    :  
  57    :    // Sets the nth stream. Overwrites an existing stream if there is one.
  58    :    // @param index the index of the stream. This must be >= 0, and must be
  59    :    //     a stream index that already exists.
  60    :    // @param msf_stream a pointer to the heap allocated stream to be placed at
  61    :    //     the given position. This may be NULL, which is equivalent to erasing
  62    :    //     the given stream.
  63    :    void ReplaceStream(uint32 index, MsfStreamImpl<T>* msf_stream);
  64    :  
  65    :    // Sets the nth stream. Overwrites an existing stream if there is one.
  66    :    // @param index the index of the stream.
  67    :    // @param msf_stream a pointer to the heap allocated stream to be placed at
  68    :    //     the given position. This may be NULL, which is equivalent to erasing
  69    :    //     the given stream.
  70    :    void SetStream(uint32 index, MsfStreamImpl<T>* msf_stream);
  71    :  
  72    :    // Returns the number of streams in the MSF file. There are streams with
  73    :    // IDs 0 through StreamCount() - 1.
  74    :    // @returns the number of streams in the MSF file.
  75  E :    size_t StreamCount() const { return streams_.size(); }
  76    :  
  77    :   private:
  78    :    // The streams are implicitly numbered simply by their position in this
  79    :    // vector.
  80    :    std::vector<scoped_refptr<MsfStreamImpl<T>>> streams_;
  81    :  
  82    :    DISALLOW_COPY_AND_ASSIGN(MsfFileImpl);
  83    :  };
  84    :  
  85    :  }  // namespace detail
  86    :  
  87    :  using MsfFile = detail::MsfFileImpl<kGenericMsfFileType>;
  88    :  
  89    :  }  // namespace msf
  90    :  
  91    :  #include "syzygy/msf/msf_file_impl.h"
  92    :  
  93    :  #endif  // SYZYGY_MSF_MSF_FILE_H_

Coverage information generated Thu Jan 14 17:40:38 2016.