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 : #include "syzygy/pdb/pdb_file.h"
16 :
17 : namespace pdb {
18 :
19 E : PdbFile::PdbFile() {
20 E : }
21 :
22 E : PdbFile::~PdbFile() {
23 E : Clear();
24 E : }
25 :
26 E : void PdbFile::Clear() {
27 E : streams_.clear();
28 E : }
29 :
30 E : scoped_refptr<PdbStream> PdbFile::GetStream(uint32 index) const {
31 E : DCHECK_LT(index, streams_.size());
32 E : return streams_[index];
33 E : }
34 :
35 E : size_t PdbFile::AppendStream(PdbStream* pdb_stream) {
36 E : size_t index = streams_.size();
37 E : streams_.push_back(pdb_stream);
38 E : return index;
39 E : }
40 :
41 E : void PdbFile::ReplaceStream(uint32 index, PdbStream* pdb_stream) {
42 E : DCHECK_LT(index, streams_.size());
43 E : streams_[index] = pdb_stream;
44 E : }
45 :
46 E : void PdbFile::SetStream(uint32 index, PdbStream* pdb_stream) {
47 E : if (index >= streams_.size())
48 E : streams_.resize(index + 1);
49 :
50 E : streams_[index] = pdb_stream;
51 E : }
52 :
53 : } // namespace pdb
|