Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2065)

Side by Side Diff: minidump/minidump_string_writer.h

Issue 656173003: Add MinidumpSimpleStringDictionaryWriter and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « minidump/minidump_simple_string_dictionary_writer_test.cc ('k') | minidump/minidump_string_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698