summaryrefslogtreecommitdiff
path: root/Source/cmArchiveWrite.h
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 10:34:04 -0400
committerBrad King <brad.king@kitware.com>2016-05-16 16:05:19 -0400
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/cmArchiveWrite.h
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadcmake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
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/cmArchiveWrite.h')
-rw-r--r--Source/cmArchiveWrite.h63
1 files changed, 32 insertions, 31 deletions
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 8dbbb83728..72d8f3a6d1 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -15,20 +15,24 @@
#include "cmStandardIncludes.h"
#if !defined(CMAKE_BUILD_WITH_CMAKE)
-# error "cmArchiveWrite not allowed during bootstrap build!"
+#error "cmArchiveWrite not allowed during bootstrap build!"
#endif
-template<typename T>
+template <typename T>
class cmArchiveWriteOptional
{
public:
- cmArchiveWriteOptional() {this->Clear();}
- explicit cmArchiveWriteOptional(T val) {this->Set(val);}
+ cmArchiveWriteOptional() { this->Clear(); }
+ explicit cmArchiveWriteOptional(T val) { this->Set(val); }
- void Set(T val) {this->IsValueSet = true; this->Value=val;}
- void Clear() {this->IsValueSet = false;}
- bool IsSet() const {return this->IsValueSet;}
- T Get() const {return Value;}
+ void Set(T val)
+ {
+ this->IsValueSet = true;
+ this->Value = val;
+ }
+ void Clear() { this->IsValueSet = false; }
+ bool IsSet() const { return this->IsValueSet; }
+ T Get() const { return Value; }
private:
T Value;
bool IsValueSet;
@@ -40,7 +44,7 @@ private:
*/
class cmArchiveWrite
{
- typedef void (cmArchiveWrite::* safe_bool)();
+ typedef void (cmArchiveWrite::*safe_bool)();
void safe_bool_true() {}
public:
/** Compression type. */
@@ -56,7 +60,7 @@ public:
/** Construct with output stream to which to write archive. */
cmArchiveWrite(std::ostream& os, Compress c = CompressNone,
- std::string const& format = "paxr");
+ std::string const& format = "paxr");
~cmArchiveWrite();
@@ -68,14 +72,14 @@ public:
* skip. The remaining part of the input path is appended to the
* "prefix" value to construct the final name in the archive.
*/
- bool Add(std::string path,
- size_t skip = 0,
- const char* prefix = 0,
- bool recursive = true);
+ bool Add(std::string path, size_t skip = 0, const char* prefix = 0,
+ bool recursive = true);
/** Returns true if there has been no error. */
operator safe_bool() const
- { return this->Okay()? &cmArchiveWrite::safe_bool_true : 0; }
+ {
+ return this->Okay() ? &cmArchiveWrite::safe_bool_true : 0;
+ }
/** Returns true if there has been an error. */
bool operator!() const { return !this->Okay(); }
@@ -91,9 +95,9 @@ public:
//! Sets the permissions of the added files/folders
void SetPermissions(mode_t permissions_)
- {
+ {
this->Permissions.Set(permissions_);
- }
+ }
//! Clears permissions - default is used instead
void ClearPermissions() { this->Permissions.Clear(); }
@@ -104,44 +108,41 @@ public:
//! or folder. The mask will then be applied to unset
//! some of them
void SetPermissionsMask(mode_t permissionsMask_)
- {
+ {
this->PermissionsMask.Set(permissionsMask_);
- }
+ }
//! Clears permissions mask - default is used instead
- void ClearPermissionsMask()
- {
- this->PermissionsMask.Clear();
- }
+ void ClearPermissionsMask() { this->PermissionsMask.Clear(); }
//! Sets UID and GID to be used in the tar file
void SetUIDAndGID(int uid_, int gid_)
- {
+ {
this->Uid.Set(uid_);
this->Gid.Set(gid_);
- }
+ }
//! Clears UID and GID to be used in the tar file - default is used instead
void ClearUIDAndGID()
- {
+ {
this->Uid.Clear();
this->Gid.Clear();
- }
+ }
//! Sets UNAME and GNAME to be used in the tar file
void SetUNAMEAndGNAME(const std::string& uname_, const std::string& gname_)
- {
+ {
this->Uname = uname_;
this->Gname = gname_;
- }
+ }
//! Clears UNAME and GNAME to be used in the tar file
//! default is used instead
void ClearUNAMEAndGNAME()
- {
+ {
this->Uname = "";
this->Gname = "";
- }
+ }
private:
bool Okay() const { return this->Error.empty(); }