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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 bool Freeze() override; | 63 bool Freeze() override; |
64 size_t SizeOfObject() override; | 64 size_t SizeOfObject() override; |
65 bool WriteObject(FileWriterInterface* file_writer) override; | 65 bool WriteObject(FileWriterInterface* file_writer) override; |
66 | 66 |
67 //! \brief Sets the string to be written. | 67 //! \brief Sets the string to be written. |
68 //! | 68 //! |
69 //! \note Valid in #kStateMutable. | 69 //! \note Valid in #kStateMutable. |
70 void set_string(const StringType& string) { string_.assign(string); } | 70 void set_string(const StringType& string) { string_.assign(string); } |
71 | 71 |
| 72 //! \brief Retrieves the string to be written. |
| 73 //! |
| 74 //! \note Valid in any state. |
| 75 const StringType& string() const { return string_; } |
| 76 |
72 private: | 77 private: |
73 MinidumpStringType string_base_; | 78 MinidumpStringType string_base_; |
74 StringType string_; | 79 StringType string_; |
75 | 80 |
76 DISALLOW_COPY_AND_ASSIGN(MinidumpStringWriter); | 81 DISALLOW_COPY_AND_ASSIGN(MinidumpStringWriter); |
77 }; | 82 }; |
78 | 83 |
79 //! \brief Writes a variable-length UTF-16-encoded MINIDUMP_STRING to a minidump | 84 //! \brief Writes a variable-length UTF-16-encoded MINIDUMP_STRING to a minidump |
80 //! file. | 85 //! file. |
81 //! | 86 //! |
(...skipping 24 matching lines...) Expand all Loading... |
106 : public MinidumpStringWriter<MinidumpStringWriterUTF8Traits> { | 111 : public MinidumpStringWriter<MinidumpStringWriterUTF8Traits> { |
107 public: | 112 public: |
108 MinidumpUTF8StringWriter() : MinidumpStringWriter() {} | 113 MinidumpUTF8StringWriter() : MinidumpStringWriter() {} |
109 ~MinidumpUTF8StringWriter() {} | 114 ~MinidumpUTF8StringWriter() {} |
110 | 115 |
111 //! \brief Sets the string to be written. | 116 //! \brief Sets the string to be written. |
112 //! | 117 //! |
113 //! \note Valid in #kStateMutable. | 118 //! \note Valid in #kStateMutable. |
114 void SetUTF8(const std::string& string_utf8) { set_string(string_utf8); } | 119 void SetUTF8(const std::string& string_utf8) { set_string(string_utf8); } |
115 | 120 |
| 121 //! \brief Retrieves the string to be written. |
| 122 //! |
| 123 //! \note Valid in any state. |
| 124 const std::string& UTF8() const { return string(); } |
| 125 |
116 private: | 126 private: |
117 DISALLOW_COPY_AND_ASSIGN(MinidumpUTF8StringWriter); | 127 DISALLOW_COPY_AND_ASSIGN(MinidumpUTF8StringWriter); |
118 }; | 128 }; |
119 | 129 |
120 } // namespace internal | 130 } // namespace internal |
121 } // namespace crashpad | 131 } // namespace crashpad |
122 | 132 |
123 #endif // CRASHPAD_MINIDUMP_MINIDUMP_STRING_WRITER_H_ | 133 #endif // CRASHPAD_MINIDUMP_MINIDUMP_STRING_WRITER_H_ |
OLD | NEW |