OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ | 5 #ifndef CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ |
6 #define CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ | 6 #define CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ |
7 | 7 |
8 #ifndef COMPILE_ASSERT | 8 #ifndef COMPILE_ASSERT |
9 // COMPILE_ASSERT macro borrowed from basictypes.h | 9 // COMPILE_ASSERT macro borrowed from macros.h |
10 template <bool> | 10 #define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg) |
11 struct CompileAssert {}; | |
12 #define COMPILE_ASSERT(expr, msg) \ | |
13 typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] | |
14 #endif | 11 #endif |
15 | 12 |
16 namespace mini_installer { | 13 namespace mini_installer { |
17 | 14 |
18 // NOTE: Do not assume that these string functions support UTF encoding. | 15 // NOTE: Do not assume that these string functions support UTF encoding. |
19 // This is fine for the purposes of the mini_installer, but you have | 16 // This is fine for the purposes of the mini_installer, but you have |
20 // been warned! | 17 // been warned! |
21 | 18 |
22 // Formats a sequence of |bytes| as hex. The |str| buffer must have room for | 19 // Formats a sequence of |bytes| as hex. The |str| buffer must have room for |
23 // at least 2*|size| + 1. | 20 // at least 2*|size| + 1. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 wchar_t buffer_[kCapacity + 1]; | 136 wchar_t buffer_[kCapacity + 1]; |
140 | 137 |
141 private: | 138 private: |
142 StackString(const StackString&); | 139 StackString(const StackString&); |
143 StackString& operator=(const StackString&); | 140 StackString& operator=(const StackString&); |
144 }; | 141 }; |
145 | 142 |
146 } // namespace mini_installer | 143 } // namespace mini_installer |
147 | 144 |
148 #endif // CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ | 145 #endif // CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ |
OLD | NEW |