summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.h
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 14:34:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-16 20:05:19 (GMT)
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/cmSystemTools.h
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadCMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Source/cmSystemTools.h')
-rw-r--r--Source/cmSystemTools.h135
1 files changed, 60 insertions, 75 deletions
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index d311750..df2c1f7 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -25,7 +25,7 @@ class cmSystemToolsFileTime;
* cmSystemTools is a class that provides helper functions
* for the CMake build system.
*/
-class cmSystemTools: public cmsys::SystemTools
+class cmSystemTools : public cmsys::SystemTools
{
public:
typedef cmsys::SystemTools Superclass;
@@ -38,7 +38,7 @@ public:
std::vector<std::string>& argsOut);
static void ExpandListArgument(const std::string& arg,
std::vector<std::string>& argsOut,
- bool emptyArgs=false);
+ bool emptyArgs = false);
/**
* Look for and replace registry values in a string
@@ -64,64 +64,59 @@ public:
* title as a const char*, and a reference to bool that when
* set to false, will disable furthur messages (cancel).
*/
- static void SetMessageCallback(MessageCallback f, void* clientData=0);
+ static void SetMessageCallback(MessageCallback f, void* clientData = 0);
/**
* Display an error message.
*/
- static void Error(const char* m, const char* m2=0,
- const char* m3=0, const char* m4=0);
+ static void Error(const char* m, const char* m2 = 0, const char* m3 = 0,
+ const char* m4 = 0);
/**
* Display a message.
*/
- static void Message(const char* m, const char* title=0);
+ static void Message(const char* m, const char* title = 0);
typedef void (*OutputCallback)(const char*, size_t length, void*);
///! Send a string to stdout
static void Stdout(const char* s);
static void Stdout(const char* s, size_t length);
- static void SetStdoutCallback(OutputCallback, void* clientData=0);
+ static void SetStdoutCallback(OutputCallback, void* clientData = 0);
///! Send a string to stderr
static void Stderr(const char* s);
static void Stderr(const char* s, size_t length);
- static void SetStderrCallback(OutputCallback, void* clientData=0);
-
+ static void SetStderrCallback(OutputCallback, void* clientData = 0);
typedef bool (*InterruptCallback)(void*);
- static void SetInterruptCallback(InterruptCallback f, void* clientData=0);
+ static void SetInterruptCallback(InterruptCallback f, void* clientData = 0);
static bool GetInterruptFlag();
///! Return true if there was an error at any point.
static bool GetErrorOccuredFlag()
- {
- return cmSystemTools::s_ErrorOccured ||
- cmSystemTools::s_FatalErrorOccured ||
- GetInterruptFlag();
- }
+ {
+ return cmSystemTools::s_ErrorOccured ||
+ cmSystemTools::s_FatalErrorOccured || GetInterruptFlag();
+ }
///! If this is set to true, cmake stops processing commands.
static void SetFatalErrorOccured()
- {
- cmSystemTools::s_FatalErrorOccured = true;
- }
- static void SetErrorOccured()
- {
- cmSystemTools::s_ErrorOccured = true;
- }
- ///! Return true if there was an error at any point.
+ {
+ cmSystemTools::s_FatalErrorOccured = true;
+ }
+ static void SetErrorOccured() { cmSystemTools::s_ErrorOccured = true; }
+ ///! Return true if there was an error at any point.
static bool GetFatalErrorOccured()
- {
- return cmSystemTools::s_FatalErrorOccured || GetInterruptFlag();
- }
+ {
+ return cmSystemTools::s_FatalErrorOccured || GetInterruptFlag();
+ }
///! Set the error occurred flag and fatal error back to false
static void ResetErrorOccuredFlag()
- {
- cmSystemTools::s_FatalErrorOccured = false;
- cmSystemTools::s_ErrorOccured = false;
- }
+ {
+ cmSystemTools::s_FatalErrorOccured = false;
+ cmSystemTools::s_ErrorOccured = false;
+ }
/**
* Does a string indicates that CMake/CPack/CTest internally
@@ -150,8 +145,7 @@ public:
static bool IsPathToFramework(const char* value);
static bool DoesFileExistWithExtensions(
- const char *name,
- const std::vector<std::string>& sourceExts);
+ const char* name, const std::vector<std::string>& sourceExts);
/**
* Check if the given file exists in one of the parent directory of the
@@ -159,7 +153,8 @@ public:
* Toplevel specifies the top-most directory to where it will look.
*/
static std::string FileExistsInParentDirectories(const char* fname,
- const char* directory, const char* toplevel);
+ const char* directory,
+ const char* toplevel);
static void Glob(const std::string& directory, const std::string& regexp,
std::vector<std::string>& files);
@@ -176,13 +171,11 @@ public:
* files only. This method returns true if search was succesfull.
*/
static bool SimpleGlob(const std::string& glob,
- std::vector<std::string>& files,
- int type = 0);
+ std::vector<std::string>& files, int type = 0);
///! Copy a file.
static bool cmCopyFile(const char* source, const char* destination);
- static bool CopyFileIfDifferent(const char* source,
- const char* destination);
+ static bool CopyFileIfDifferent(const char* source, const char* destination);
/** Rename a file or directory within a single disk volume (atomic
if possible). */
@@ -219,17 +212,17 @@ public:
* it into this function or it will not work. The command must be correctly
* escaped for this to with spaces.
*/
- enum OutputOption
- {
- OUTPUT_NONE = 0,
- OUTPUT_MERGE,
- OUTPUT_FORWARD,
- OUTPUT_PASSTHROUGH
- };
+ enum OutputOption
+ {
+ OUTPUT_NONE = 0,
+ OUTPUT_MERGE,
+ OUTPUT_FORWARD,
+ OUTPUT_PASSTHROUGH
+ };
static bool RunSingleCommand(const char* command,
std::string* captureStdOut = 0,
- std::string* captureStdErr = 0,
- int* retVal = 0, const char* dir = 0,
+ std::string* captureStdErr = 0, int* retVal = 0,
+ const char* dir = 0,
OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0);
/**
@@ -239,8 +232,8 @@ public:
*/
static bool RunSingleCommand(std::vector<std::string> const& command,
std::string* captureStdOut = 0,
- std::string* captureStdErr = 0,
- int* retVal = 0, const char* dir = 0,
+ std::string* captureStdErr = 0, int* retVal = 0,
+ const char* dir = 0,
OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0);
@@ -261,14 +254,15 @@ public:
static void EnableMessages() { s_DisableMessages = false; }
static void DisableMessages() { s_DisableMessages = true; }
- static void DisableRunCommandOutput() {s_DisableRunCommandOutput = true; }
- static void EnableRunCommandOutput() {s_DisableRunCommandOutput = false; }
+ static void DisableRunCommandOutput() { s_DisableRunCommandOutput = true; }
+ static void EnableRunCommandOutput() { s_DisableRunCommandOutput = false; }
static bool GetRunCommandOutput() { return s_DisableRunCommandOutput; }
/**
* Some constants for different file formats.
*/
- enum FileFormat {
+ enum FileFormat
+ {
NO_FILE_FORMAT = 0,
C_FILE_FORMAT,
CXX_FILE_FORMAT,
@@ -284,7 +278,8 @@ public:
UNKNOWN_FILE_FORMAT
};
- enum CompareOp {
+ enum CompareOp
+ {
OP_LESS,
OP_GREATER,
OP_EQUAL
@@ -307,8 +302,8 @@ public:
/** Windows if this is true, the CreateProcess in RunCommand will
* not show new consol windows when running programs.
*/
- static void SetRunCommandHideConsole(bool v){s_RunCommandHideConsole = v;}
- static bool GetRunCommandHideConsole(){ return s_RunCommandHideConsole;}
+ static void SetRunCommandHideConsole(bool v) { s_RunCommandHideConsole = v; }
+ static bool GetRunCommandHideConsole() { return s_RunCommandHideConsole; }
/** Call cmSystemTools::Error with the message m, plus the
* result of strerror(errno)
*/
@@ -316,21 +311,14 @@ public:
/** a general output handler for cmsysProcess */
static int WaitForLine(cmsysProcess* process, std::string& line,
- double timeout,
- std::vector<char>& out,
+ double timeout, std::vector<char>& out,
std::vector<char>& err);
/** Split a string on its newlines into multiple lines. Returns
false only if the last line stored had no newline. */
static bool Split(const char* s, std::vector<std::string>& l);
- static void SetForceUnixPaths(bool v)
- {
- s_ForceUnixPaths = v;
- }
- static bool GetForceUnixPaths()
- {
- return s_ForceUnixPaths;
- }
+ static void SetForceUnixPaths(bool v) { s_ForceUnixPaths = v; }
+ static bool GetForceUnixPaths() { return s_ForceUnixPaths; }
// ConvertToOutputPath use s_ForceUnixPaths
static std::string ConvertToOutputPath(const char* path);
@@ -377,6 +365,7 @@ public:
public:
SaveRestoreEnvironment();
virtual ~SaveRestoreEnvironment();
+
private:
std::vector<std::string> Env;
};
@@ -393,8 +382,7 @@ public:
TarCompressXZ,
TarCompressNone
};
- static bool ListTar(const char* outFileName,
- bool verbose);
+ static bool ListTar(const char* outFileName, bool verbose);
static bool CreateTar(const char* outFileName,
const std::vector<std::string>& files,
cmTarCompression compressType, bool verbose,
@@ -434,8 +422,8 @@ public:
static std::string const& GetCMakeRoot();
/** Echo a message in color using KWSys's Terminal cprintf. */
- static void MakefileColorEcho(int color, const char* message,
- bool newLine, bool enabled);
+ static void MakefileColorEcho(int color, const char* message, bool newLine,
+ bool enabled);
/** Try to guess the soname of a shared library. */
static bool GuessLibrarySOName(std::string const& fullPath,
@@ -443,13 +431,11 @@ public:
/** Try to guess the install name of a shared library. */
static bool GuessLibraryInstallName(std::string const& fullPath,
- std::string& soname);
+ std::string& soname);
/** Try to set the RPATH in an ELF binary. */
- static bool ChangeRPath(std::string const& file,
- std::string const& oldRPath,
- std::string const& newRPath,
- std::string* emsg = 0,
+ static bool ChangeRPath(std::string const& file, std::string const& oldRPath,
+ std::string const& newRPath, std::string* emsg = 0,
bool* changed = 0);
/** Try to remove the RPATH from an ELF binary. */
@@ -458,8 +444,7 @@ public:
/** Check whether the RPATH in an ELF binary contains the path
given. */
- static bool CheckRPath(std::string const& file,
- std::string const& newRPath);
+ static bool CheckRPath(std::string const& file, std::string const& newRPath);
/** Remove a directory; repeat a few times in case of locked files. */
static bool RepeatedRemoveDirectory(const char* dir);