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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 //! \brief Retrieves the string to be written. | 120 //! \brief Retrieves the string to be written. |
121 //! | 121 //! |
122 //! \note Valid in any state. | 122 //! \note Valid in any state. |
123 const std::string& UTF8() const { return string(); } | 123 const std::string& UTF8() const { return string(); } |
124 | 124 |
125 private: | 125 private: |
126 DISALLOW_COPY_AND_ASSIGN(MinidumpUTF8StringWriter); | 126 DISALLOW_COPY_AND_ASSIGN(MinidumpUTF8StringWriter); |
127 }; | 127 }; |
128 | 128 |
129 //! \cond | |
130 | |
131 struct MinidumpStringListWriterUTF16Traits { | |
132 using MinidumpStringWriterType = MinidumpUTF16StringWriter; | |
133 }; | |
134 | |
135 struct MinidumpStringListWriterUTF8Traits { | |
136 using MinidumpStringWriterType = MinidumpUTF8StringWriter; | |
137 }; | |
138 | |
139 //! \endcond | |
140 | |
141 //! \brief The writer for a MinidumpRVAList object in a minidump file, | 129 //! \brief The writer for a MinidumpRVAList object in a minidump file, |
142 //! containing a list of \a Traits::MinidumpStringWriterType objects. | 130 //! containing a list of \a MinidumpStringWriterType objects. |
143 template <typename Traits> | 131 template <typename MinidumpStringWriterType> |
144 class MinidumpStringListWriter : public MinidumpRVAListWriter { | 132 class MinidumpStringListWriter final : public MinidumpRVAListWriter { |
145 public: | 133 public: |
146 using MinidumpStringWriterType = typename Traits::MinidumpStringWriterType; | |
147 | |
148 MinidumpStringListWriter(); | 134 MinidumpStringListWriter(); |
149 ~MinidumpStringListWriter() override; | 135 ~MinidumpStringListWriter() override; |
150 | 136 |
151 //! \brief Adds a new \a Traits::MinidumpStringWriterType for each element in | 137 //! \brief Adds a new \a Traits::MinidumpStringWriterType for each element in |
152 //! \a vector to the MinidumpRVAList. | 138 //! \a vector to the MinidumpRVAList. |
153 //! | 139 //! |
154 //! \param[in] vector The vector to use as source data. Each string in the | 140 //! \param[in] vector The vector to use as source data. Each string in the |
155 //! vector is treated as a UTF-8 string, and a new string writer will be | 141 //! vector is treated as a UTF-8 string, and a new string writer will be |
156 //! created for each one and made a child of the MinidumpStringListWriter. | 142 //! created for each one and made a child of the MinidumpStringListWriter. |
157 //! | 143 //! |
158 //! \note Valid in #kStateMutable. No mutator methods may be called before | 144 //! \note Valid in #kStateMutable. No mutator methods may be called before |
159 //! this method, and it is not normally necessary to call any mutator | 145 //! this method, and it is not normally necessary to call any mutator |
160 //! methods after this method. | 146 //! methods after this method. |
161 void InitializeFromVector(const std::vector<std::string>& vector); | 147 void InitializeFromVector(const std::vector<std::string>& vector); |
162 | 148 |
163 //! \brief Creates a new \a Traits::MinidumpStringWriterType object and adds | 149 //! \brief Creates a new \a Traits::MinidumpStringWriterType object and adds |
164 //! it to the MinidumpRVAList. | 150 //! it to the MinidumpRVAList. |
165 //! | 151 //! |
166 //! This object creates a new string writer with string value \a string_utf8, | 152 //! This object creates a new string writer with string value \a string_utf8, |
167 //! takes ownership of it, and becomes its parent in the overall tree of | 153 //! takes ownership of it, and becomes its parent in the overall tree of |
168 //! internal::MinidumpWritable objects. | 154 //! MinidumpWritable objects. |
169 //! | 155 //! |
170 //! \note Valid in #kStateMutable. | 156 //! \note Valid in #kStateMutable. |
171 void AddStringUTF8(const std::string& string_utf8); | 157 void AddStringUTF8(const std::string& string_utf8); |
172 | 158 |
173 //! \brief Determines whether the object is useful. | 159 //! \brief Determines whether the object is useful. |
174 //! | 160 //! |
175 //! A useful object is one that carries data that makes a meaningful | 161 //! A useful object is one that carries data that makes a meaningful |
176 //! contribution to a minidump file. An object carrying entries would be | 162 //! contribution to a minidump file. An object carrying entries would be |
177 //! considered useful. | 163 //! considered useful. |
178 //! | 164 //! |
179 //! \return `true` if the object is useful, `false` otherwise. | 165 //! \return `true` if the object is useful, `false` otherwise. |
180 bool IsUseful() const; | 166 bool IsUseful() const; |
181 | 167 |
182 private: | 168 private: |
183 DISALLOW_COPY_AND_ASSIGN(MinidumpStringListWriter); | 169 DISALLOW_COPY_AND_ASSIGN(MinidumpStringListWriter); |
184 }; | 170 }; |
185 | 171 |
186 using MinidumpUTF16StringListWriter = | 172 } // namespace internal |
187 MinidumpStringListWriter<MinidumpStringListWriterUTF16Traits>; | |
188 using MinidumpUTF8StringListWriter = | |
189 MinidumpStringListWriter<MinidumpStringListWriterUTF8Traits>; | |
190 | 173 |
191 } // namespace internal | 174 using MinidumpUTF16StringListWriter = internal::MinidumpStringListWriter< |
| 175 internal::MinidumpUTF16StringWriter>; |
| 176 using MinidumpUTF8StringListWriter = internal::MinidumpStringListWriter< |
| 177 internal::MinidumpUTF8StringWriter>; |
| 178 |
192 } // namespace crashpad | 179 } // namespace crashpad |
193 | 180 |
194 #endif // CRASHPAD_MINIDUMP_MINIDUMP_STRING_WRITER_H_ | 181 #endif // CRASHPAD_MINIDUMP_MINIDUMP_STRING_WRITER_H_ |
OLD | NEW |