OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 void MinidumpUTF16StringWriter::SetUTF8(const std::string& string_utf8) { | 89 void MinidumpUTF16StringWriter::SetUTF8(const std::string& string_utf8) { |
90 DCHECK_EQ(state(), kStateMutable); | 90 DCHECK_EQ(state(), kStateMutable); |
91 | 91 |
92 set_string(MinidumpWriterUtil::ConvertUTF8ToUTF16(string_utf8)); | 92 set_string(MinidumpWriterUtil::ConvertUTF8ToUTF16(string_utf8)); |
93 } | 93 } |
94 | 94 |
95 MinidumpUTF8StringWriter::~MinidumpUTF8StringWriter() { | 95 MinidumpUTF8StringWriter::~MinidumpUTF8StringWriter() { |
96 } | 96 } |
97 | 97 |
98 template <typename Traits> | 98 template <typename MinidumpStringWriterType> |
99 MinidumpStringListWriter<Traits>::MinidumpStringListWriter() | 99 MinidumpStringListWriter<MinidumpStringWriterType>::MinidumpStringListWriter() |
100 : MinidumpRVAListWriter() { | 100 : MinidumpRVAListWriter() { |
101 } | 101 } |
102 | 102 |
103 template <typename Traits> | 103 template <typename MinidumpStringWriterType> |
104 MinidumpStringListWriter<Traits>::~MinidumpStringListWriter() { | 104 MinidumpStringListWriter< |
| 105 MinidumpStringWriterType>::~MinidumpStringListWriter() { |
105 } | 106 } |
106 | 107 |
107 template <typename Traits> | 108 template <typename MinidumpStringWriterType> |
108 void MinidumpStringListWriter<Traits>::InitializeFromVector( | 109 void MinidumpStringListWriter<MinidumpStringWriterType>::InitializeFromVector( |
109 const std::vector<std::string>& vector) { | 110 const std::vector<std::string>& vector) { |
110 DCHECK_EQ(state(), kStateMutable); | 111 DCHECK_EQ(state(), kStateMutable); |
111 DCHECK(IsEmpty()); | 112 DCHECK(IsEmpty()); |
112 | 113 |
113 for (const std::string& string : vector) { | 114 for (const std::string& string : vector) { |
114 AddStringUTF8(string); | 115 AddStringUTF8(string); |
115 } | 116 } |
116 } | 117 } |
117 | 118 |
118 template <typename Traits> | 119 template <typename MinidumpStringWriterType> |
119 void MinidumpStringListWriter<Traits>::AddStringUTF8( | 120 void MinidumpStringListWriter<MinidumpStringWriterType>::AddStringUTF8( |
120 const std::string& string_utf8) { | 121 const std::string& string_utf8) { |
121 auto string_writer = make_scoped_ptr(new MinidumpStringWriterType()); | 122 auto string_writer = make_scoped_ptr(new MinidumpStringWriterType()); |
122 string_writer->SetUTF8(string_utf8); | 123 string_writer->SetUTF8(string_utf8); |
123 AddChild(string_writer.Pass()); | 124 AddChild(string_writer.Pass()); |
124 } | 125 } |
125 | 126 |
126 template <typename Traits> | 127 template <typename MinidumpStringWriterType> |
127 bool MinidumpStringListWriter<Traits>::IsUseful() const { | 128 bool MinidumpStringListWriter<MinidumpStringWriterType>::IsUseful() const { |
128 return !IsEmpty(); | 129 return !IsEmpty(); |
129 } | 130 } |
130 | 131 |
131 // Explicit template instantiation of the forms of MinidumpStringListWriter<> | 132 // Explicit template instantiation of the forms of MinidumpStringListWriter<> |
132 // used as type aliases. | 133 // used as type aliases. |
133 template class MinidumpStringListWriter<MinidumpStringListWriterUTF16Traits>; | 134 template class MinidumpStringListWriter<MinidumpUTF16StringWriter>; |
134 template class MinidumpStringListWriter<MinidumpStringListWriterUTF8Traits>; | 135 template class MinidumpStringListWriter<MinidumpUTF8StringWriter>; |
135 | 136 |
136 } // namespace internal | 137 } // namespace internal |
137 } // namespace crashpad | 138 } // namespace crashpad |
OLD | NEW |