OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // *** File comments | |
6 | |
7 #include "courgette/ensemble.h" | 5 #include "courgette/ensemble.h" |
8 | 6 |
9 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
10 #include "base/logging.h" | 8 #include "base/logging.h" |
11 #include "base/string_util.h" | 9 #include "base/string_number_conversions.h" |
12 | 10 |
13 #include "courgette/image_info.h" | 11 #include "courgette/image_info.h" |
14 #include "courgette/region.h" | 12 #include "courgette/region.h" |
15 #include "courgette/streams.h" | 13 #include "courgette/streams.h" |
16 #include "courgette/simple_delta.h" | 14 #include "courgette/simple_delta.h" |
17 | 15 |
18 namespace courgette { | 16 namespace courgette { |
19 | 17 |
20 Element::Element(Kind kind, Ensemble* ensemble, const Region& region) | 18 Element::Element(Kind kind, Ensemble* ensemble, const Region& region) |
21 : kind_(kind), ensemble_(ensemble), region_(region) { | 19 : kind_(kind), ensemble_(ensemble), region_(region) { |
22 } | 20 } |
23 | 21 |
24 std::string Element::Name() const { | 22 std::string Element::Name() const { |
25 return ensemble_->name() + "(" | 23 return ensemble_->name() + "(" |
26 + IntToString(kind()) + "," | 24 + base::IntToString(kind()) + "," |
27 + Uint64ToString(offset_in_ensemble()) + "," | 25 + base::Uint64ToString(offset_in_ensemble()) + "," |
28 + Uint64ToString(region().length()) + ")"; | 26 + base::Uint64ToString(region().length()) + ")"; |
29 } | 27 } |
30 | 28 |
31 // A subclass of Element that has a PEInfo. | 29 // A subclass of Element that has a PEInfo. |
32 class ElementWinPE : public Element { | 30 class ElementWinPE : public Element { |
33 public: | 31 public: |
34 ElementWinPE(Kind kind, Ensemble* ensemble, const Region& region, | 32 ElementWinPE(Kind kind, Ensemble* ensemble, const Region& region, |
35 PEInfo* info) | 33 PEInfo* info) |
36 : Element(kind, ensemble, region), | 34 : Element(kind, ensemble, region), |
37 pe_info_(info) { | 35 pe_info_(info) { |
38 } | 36 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 94 } |
97 return C_OK; | 95 return C_OK; |
98 } | 96 } |
99 | 97 |
100 Ensemble::~Ensemble() { | 98 Ensemble::~Ensemble() { |
101 for (size_t i = 0; i < owned_elements_.size(); ++i) | 99 for (size_t i = 0; i < owned_elements_.size(); ++i) |
102 delete owned_elements_[i]; | 100 delete owned_elements_[i]; |
103 } | 101 } |
104 | 102 |
105 } // namespace | 103 } // namespace |
OLD | NEW |