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> |
| 99 MinidumpStringListWriter<Traits>::MinidumpStringListWriter() |
| 100 : MinidumpRVAListWriter() { |
| 101 } |
| 102 |
| 103 template <typename Traits> |
| 104 MinidumpStringListWriter<Traits>::~MinidumpStringListWriter() { |
| 105 } |
| 106 |
| 107 template <typename Traits> |
| 108 void MinidumpStringListWriter<Traits>::InitializeFromVector( |
| 109 const std::vector<std::string>& vector) { |
| 110 DCHECK_EQ(state(), kStateMutable); |
| 111 DCHECK(IsEmpty()); |
| 112 |
| 113 for (const std::string& string : vector) { |
| 114 AddStringUTF8(string); |
| 115 } |
| 116 } |
| 117 |
| 118 template <typename Traits> |
| 119 void MinidumpStringListWriter<Traits>::AddStringUTF8( |
| 120 const std::string& string_utf8) { |
| 121 auto string_writer = make_scoped_ptr(new MinidumpStringWriterType()); |
| 122 string_writer->SetUTF8(string_utf8); |
| 123 AddChild(string_writer.Pass()); |
| 124 } |
| 125 |
| 126 template <typename Traits> |
| 127 bool MinidumpStringListWriter<Traits>::IsUseful() const { |
| 128 return !IsEmpty(); |
| 129 } |
| 130 |
| 131 // Explicit template instantiation of the forms of MinidumpStringListWriter<> |
| 132 // used as type aliases. |
| 133 template class MinidumpStringListWriter<MinidumpStringListWriterUTF16Traits>; |
| 134 template class MinidumpStringListWriter<MinidumpStringListWriterUTF8Traits>; |
| 135 |
98 } // namespace internal | 136 } // namespace internal |
99 } // namespace crashpad | 137 } // namespace crashpad |
OLD | NEW |