| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BIN_UTILS_WIN_H_ | 5 #ifndef BIN_UTILS_WIN_H_ |
| 6 #define BIN_UTILS_WIN_H_ | 6 #define BIN_UTILS_WIN_H_ |
| 7 | 7 |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 namespace bin { | 11 namespace bin { |
| 12 | 12 |
| 13 void FormatMessageIntoBuffer(DWORD code, wchar_t* buffer, int buffer_length); | 13 void FormatMessageIntoBuffer(DWORD code, wchar_t* buffer, int buffer_length); |
| 14 | 14 |
| 15 // These string utility functions return strings that have been allocated with |
| 16 // Dart_ScopeAllocate(). They should be used only when we are inside an API |
| 17 // scope. If a string returned by one of these functions must persist beyond |
| 18 // the scope, then copy the results into a suitable buffer that you have |
| 19 // allocated. |
| 15 class StringUtilsWin { | 20 class StringUtilsWin { |
| 16 public: | 21 public: |
| 17 static char* WideToUtf8(wchar_t* wide, | 22 static char* WideToUtf8(wchar_t* wide, |
| 18 intptr_t len = -1, | 23 intptr_t len = -1, |
| 19 intptr_t* result_len = NULL); | 24 intptr_t* result_len = NULL); |
| 20 static const char* WideToUtf8(const wchar_t* wide, | 25 static const char* WideToUtf8(const wchar_t* wide, |
| 21 intptr_t len = -1, | 26 intptr_t len = -1, |
| 22 intptr_t* result_len = NULL); | 27 intptr_t* result_len = NULL); |
| 23 static wchar_t* Utf8ToWide(char* utf8, | 28 static wchar_t* Utf8ToWide(char* utf8, |
| 24 intptr_t len = -1, | 29 intptr_t len = -1, |
| 25 intptr_t* result_len = NULL); | 30 intptr_t* result_len = NULL); |
| 26 static const wchar_t* Utf8ToWide(const char* utf8, | 31 static const wchar_t* Utf8ToWide(const char* utf8, |
| 27 intptr_t len = -1, | 32 intptr_t len = -1, |
| 28 intptr_t* result_len = NULL); | 33 intptr_t* result_len = NULL); |
| 29 }; | 34 }; |
| 30 | 35 |
| 31 } // namespace bin | 36 } // namespace bin |
| 32 } // namespace dart | 37 } // namespace dart |
| 33 | 38 |
| 34 #endif // BIN_UTILS_WIN_H_ | 39 #endif // BIN_UTILS_WIN_H_ |
| OLD | NEW |