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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 //! file, containing a list of MinidumpSimpleStringDictionaryEntry objects. | 84 //! file, containing a list of MinidumpSimpleStringDictionaryEntry objects. |
85 //! | 85 //! |
86 //! Because this class writes a representatin of a dictionary, the order of | 86 //! Because this class writes a representatin of a dictionary, the order of |
87 //! entries is insignificant. Entries may be written in any order. | 87 //! entries is insignificant. Entries may be written in any order. |
88 class MinidumpSimpleStringDictionaryWriter final | 88 class MinidumpSimpleStringDictionaryWriter final |
89 : public internal::MinidumpWritable { | 89 : public internal::MinidumpWritable { |
90 public: | 90 public: |
91 MinidumpSimpleStringDictionaryWriter(); | 91 MinidumpSimpleStringDictionaryWriter(); |
92 ~MinidumpSimpleStringDictionaryWriter() override; | 92 ~MinidumpSimpleStringDictionaryWriter() override; |
93 | 93 |
| 94 //! \brief Adds an initialized MinidumpSimpleStringDictionaryEntryWriter for |
| 95 //! each key-value pair in \a map to the MinidumpSimpleStringDictionary. |
| 96 //! |
| 97 //! \param[in] map The map to use as source data. |
| 98 //! |
| 99 //! \note Valid in #kStateMutable. No mutator methods may be called before |
| 100 //! this method, and it is not normally necessary to call any mutator |
| 101 //! methods after this method. |
| 102 void InitializeFromMap(const std::map<std::string, std::string>& map); |
| 103 |
94 //! \brief Adds a MinidumpSimpleStringDictionaryEntryWriter to the | 104 //! \brief Adds a MinidumpSimpleStringDictionaryEntryWriter to the |
95 //! MinidumpSimpleStringDictionary. | 105 //! MinidumpSimpleStringDictionary. |
96 //! | 106 //! |
97 //! This object takes ownership of \a entry and becomes its parent in the | 107 //! This object takes ownership of \a entry and becomes its parent in the |
98 //! overall tree of internal::MinidumpWritable objects. | 108 //! overall tree of internal::MinidumpWritable objects. |
99 //! | 109 //! |
100 //! If the key contained in \a entry duplicates the key of an entry already | 110 //! If the key contained in \a entry duplicates the key of an entry already |
101 //! present in the MinidumpSimpleStringDictionary, the new \a entry will | 111 //! present in the MinidumpSimpleStringDictionary, the new \a entry will |
102 //! replace the previous one. | 112 //! replace the previous one. |
103 //! | 113 //! |
104 //! \note Valid in #kStateMutable. | 114 //! \note Valid in #kStateMutable. |
105 void AddEntry(scoped_ptr<MinidumpSimpleStringDictionaryEntryWriter> entry); | 115 void AddEntry(scoped_ptr<MinidumpSimpleStringDictionaryEntryWriter> entry); |
106 | 116 |
| 117 //! \brief Determines whether the object is useful. |
| 118 //! |
| 119 //! A useful object is one that carries data that makes a meaningful |
| 120 //! contribution to a minidump file. An object carrying entries would be |
| 121 //! considered useful. |
| 122 //! |
| 123 //! \return `true` if the object is useful, `false` otherwise. |
| 124 bool IsUseful() const; |
| 125 |
107 protected: | 126 protected: |
108 // MinidumpWritable: | 127 // MinidumpWritable: |
109 | 128 |
110 bool Freeze() override; | 129 bool Freeze() override; |
111 size_t SizeOfObject() override; | 130 size_t SizeOfObject() override; |
112 std::vector<MinidumpWritable*> Children() override; | 131 std::vector<MinidumpWritable*> Children() override; |
113 bool WriteObject(FileWriterInterface* file_writer) override; | 132 bool WriteObject(FileWriterInterface* file_writer) override; |
114 | 133 |
115 private: | 134 private: |
116 MinidumpSimpleStringDictionary simple_string_dictionary_base_; | 135 MinidumpSimpleStringDictionary simple_string_dictionary_base_; |
117 | 136 |
118 // This object owns the MinidumpSimpleStringDictionaryEntryWriter objects. | 137 // This object owns the MinidumpSimpleStringDictionaryEntryWriter objects. |
119 std::map<std::string, MinidumpSimpleStringDictionaryEntryWriter*> entries_; | 138 std::map<std::string, MinidumpSimpleStringDictionaryEntryWriter*> entries_; |
120 | 139 |
121 DISALLOW_COPY_AND_ASSIGN(MinidumpSimpleStringDictionaryWriter); | 140 DISALLOW_COPY_AND_ASSIGN(MinidumpSimpleStringDictionaryWriter); |
122 }; | 141 }; |
123 | 142 |
124 } // namespace crashpad | 143 } // namespace crashpad |
125 | 144 |
126 #endif // CRASHPAD_MINIDUMP_MINIDUMP_SIMPLE_STRING_DICTIONARY_WRITER_H_ | 145 #endif // CRASHPAD_MINIDUMP_MINIDUMP_SIMPLE_STRING_DICTIONARY_WRITER_H_ |
OLD | NEW |