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

Side by Side Diff: tools/tool_support.h

Issue 1120383003: Get generate_dump compiling on Windows (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@tools
Patch Set: fix mac; no implicit conversion to std::string for StringPiece Created 5 years, 7 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
« no previous file with comments | « tools/generate_dump.cc ('k') | tools/tool_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_TOOLS_TOOL_SUPPORT_H_ 15 #ifndef CRASHPAD_TOOLS_TOOL_SUPPORT_H_
16 #define CRASHPAD_TOOLS_TOOL_SUPPORT_H_ 16 #define CRASHPAD_TOOLS_TOOL_SUPPORT_H_
17 17
18 #include <string> 18 #include <string>
19 19
20 #include "base/basictypes.h" 20 #include "base/basictypes.h"
21 #include "base/files/file_path.h" 21 #include "base/files/file_path.h"
22 #include "base/strings/string_piece.h"
22 #include "build/build_config.h" 23 #include "build/build_config.h"
23 24
24 namespace crashpad { 25 namespace crashpad {
25 26
26 //! \brief Common functions used by command line tools. 27 //! \brief Common functions used by command line tools.
27 class ToolSupport { 28 class ToolSupport {
28 public: 29 public:
29 //! \brief Handles `--version`. 30 //! \brief Handles `--version`.
30 //! 31 //!
31 //! \param[in] me The tool’s name, the basename of `argv[0]`. 32 //! \param[in] me The tool’s name, the basename of `argv[0]`.
(...skipping 14 matching lines...) Expand all
46 //! \copydoc Version 47 //! \copydoc Version
47 static void Version(const std::string& me); 48 static void Version(const std::string& me);
48 49
49 //! \copydoc UsageTail 50 //! \copydoc UsageTail
50 static void UsageTail(const std::string& me); 51 static void UsageTail(const std::string& me);
51 52
52 //! \copydoc UsageHint 53 //! \copydoc UsageHint
53 static void UsageHint(const std::string& me, const char* hint); 54 static void UsageHint(const std::string& me, const char* hint);
54 #endif // OS_POSIX 55 #endif // OS_POSIX
55 56
57 #if defined(OS_WIN) || DOXYGEN
58 //! \brief Converts \a argv `wchar_t` UTF-16 to UTF-8, and passes onwards to a
59 //! UTF-8 entry point.
60 //!
61 //! \return The return value of \a entry.
62 static int Wmain(int argc, wchar_t* argv[], int (*entry)(int, char*[]));
63 #endif // OS_WIN
64
65 //! \brief Converts a command line argument to the string type suitable for
66 //! base::FilePath.
67 //!
68 //! On POSIX, this is a no-op. On Windows, assumes that Wmain() was used, and
69 //! the input argument was converted from UTF-16 in a `wchar_t*` to UTF-8 in a
70 //! `char*`. This undoes that transformation.
71 //!
72 //! \sa Wmain()
73 static base::FilePath::StringType CommandLineArgumentToFilePathStringType(
74 const base::StringPiece& arg);
75
56 private: 76 private:
57 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolSupport); 77 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolSupport);
58 }; 78 };
59 79
60 } // namespace crashpad 80 } // namespace crashpad
61 81
62 #endif // CRASHPAD_TOOLS_TOOL_SUPPORT_H_ 82 #endif // CRASHPAD_TOOLS_TOOL_SUPPORT_H_
OLDNEW
« no previous file with comments | « tools/generate_dump.cc ('k') | tools/tool_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698