diff options
author | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2017-05-09 14:02:28 (GMT) |
---|---|---|
committer | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2017-05-09 21:29:18 (GMT) |
commit | 543cf13406f478557c6ecf2279b6ab1fd3bdde30 (patch) | |
tree | 2204d09e3af6ed53f7e66b938ef5320c4dfd6d50 /Source/CPack/IFW/cmCPackIFWRepository.cxx | |
parent | b69e061b8073efbd2c356f4508ea401c85e8dae3 (diff) | |
download | CMake-543cf13406f478557c6ecf2279b6ab1fd3bdde30.zip CMake-543cf13406f478557c6ecf2279b6ab1fd3bdde30.tar.gz CMake-543cf13406f478557c6ecf2279b6ab1fd3bdde30.tar.bz2 |
CPackIFW: Access refactoring
Changes:
- Access members with this->;
- Access nested enum values with class name.
Diffstat (limited to 'Source/CPack/IFW/cmCPackIFWRepository.cxx')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWRepository.cxx | 172 |
1 files changed, 87 insertions, 85 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index 9190596..b115db0 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -11,7 +11,7 @@ #include <stddef.h> cmCPackIFWRepository::cmCPackIFWRepository() - : Update(None) + : Update(cmCPackIFWRepository::None) { } @@ -19,18 +19,18 @@ bool cmCPackIFWRepository::IsValid() const { bool valid = true; - switch (Update) { - case None: - valid = !Url.empty(); + switch (this->Update) { + case cmCPackIFWRepository::None: + valid = !this->Url.empty(); break; - case Add: - valid = !Url.empty(); + case cmCPackIFWRepository::Add: + valid = !this->Url.empty(); break; - case Remove: - valid = !Url.empty(); + case cmCPackIFWRepository::Remove: + valid = !this->Url.empty(); break; - case Replace: - valid = !OldUrl.empty() && !NewUrl.empty(); + case cmCPackIFWRepository::Replace: + valid = !this->OldUrl.empty() && !this->NewUrl.empty(); break; } @@ -40,74 +40,74 @@ bool cmCPackIFWRepository::IsValid() const bool cmCPackIFWRepository::ConfigureFromOptions() { // Name; - if (Name.empty()) { + if (this->Name.empty()) { return false; } std::string prefix = - "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_"; + "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(this->Name) + "_"; // Update - if (IsOn(prefix + "ADD")) { - Update = Add; + if (this->IsOn(prefix + "ADD")) { + this->Update = cmCPackIFWRepository::Add; } else if (IsOn(prefix + "REMOVE")) { - Update = Remove; + this->Update = cmCPackIFWRepository::Remove; } else if (IsOn(prefix + "REPLACE")) { - Update = Replace; + this->Update = cmCPackIFWRepository::Replace; } else { - Update = None; + this->Update = cmCPackIFWRepository::None; } // Url - if (const char* url = GetOption(prefix + "URL")) { - Url = url; + if (const char* url = this->GetOption(prefix + "URL")) { + this->Url = url; } else { - Url = ""; + this->Url = ""; } // Old url - if (const char* oldUrl = GetOption(prefix + "OLD_URL")) { - OldUrl = oldUrl; + if (const char* oldUrl = this->GetOption(prefix + "OLD_URL")) { + this->OldUrl = oldUrl; } else { - OldUrl = ""; + this->OldUrl = ""; } // New url - if (const char* newUrl = GetOption(prefix + "NEW_URL")) { - NewUrl = newUrl; + if (const char* newUrl = this->GetOption(prefix + "NEW_URL")) { + this->NewUrl = newUrl; } else { - NewUrl = ""; + this->NewUrl = ""; } // Enabled - if (IsOn(prefix + "DISABLED")) { - Enabled = "0"; + if (this->IsOn(prefix + "DISABLED")) { + this->Enabled = "0"; } else { - Enabled = ""; + this->Enabled = ""; } // Username - if (const char* username = GetOption(prefix + "USERNAME")) { - Username = username; + if (const char* username = this->GetOption(prefix + "USERNAME")) { + this->Username = username; } else { - Username = ""; + this->Username = ""; } // Password - if (const char* password = GetOption(prefix + "PASSWORD")) { - Password = password; + if (const char* password = this->GetOption(prefix + "PASSWORD")) { + this->Password = password; } else { - Password = ""; + this->Password = ""; } // DisplayName - if (const char* displayName = GetOption(prefix + "DISPLAY_NAME")) { - DisplayName = displayName; + if (const char* displayName = this->GetOption(prefix + "DISPLAY_NAME")) { + this->DisplayName = displayName; } else { - DisplayName = ""; + this->DisplayName = ""; } - return IsValid(); + return this->IsValid(); } /** \class cmCPackeIFWUpdatesPatcher @@ -130,8 +130,8 @@ public: protected: void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { - xout.StartElement(name); - StartFragment(atts); + this->xout.StartElement(name); + this->StartFragment(atts); } void StartFragment(const char** atts) @@ -139,23 +139,23 @@ protected: for (size_t i = 0; atts[i]; i += 2) { const char* key = atts[i]; const char* value = atts[i + 1]; - xout.Attribute(key, value); + this->xout.Attribute(key, value); } } void EndElement(const std::string& name) CM_OVERRIDE { - if (name == "Updates" && !patched) { - repository->WriteRepositoryUpdates(xout); - patched = true; + if (name == "Updates" && !this->patched) { + this->repository->WriteRepositoryUpdates(this->xout); + this->patched = true; } - xout.EndElement(); - if (patched) { + this->xout.EndElement(); + if (this->patched) { return; } if (name == "Checksum") { - repository->WriteRepositoryUpdates(xout); - patched = true; + this->repository->WriteRepositoryUpdates(this->xout); + this->patched = true; } } @@ -166,20 +166,21 @@ protected: content == "\n") { return; } - xout.Content(content); + this->xout.Content(content); } }; bool cmCPackIFWRepository::PatchUpdatesXml() { // Lazy directory initialization - if (Directory.empty() && Generator) { - Directory = Generator->toplevel; + if (this->Directory.empty() && this->Generator) { + this->Directory = this->Generator->toplevel; } // Filenames - std::string updatesXml = Directory + "/repository/Updates.xml"; - std::string updatesPatchXml = Directory + "/repository/UpdatesPatch.xml"; + std::string updatesXml = this->Directory + "/repository/Updates.xml"; + std::string updatesPatchXml = + this->Directory + "/repository/UpdatesPatch.xml"; // Output stream cmGeneratedFileStream fout(updatesPatchXml.data()); @@ -187,7 +188,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml() xout.StartDocument(); - WriteGeneratedByToStrim(xout); + this->WriteGeneratedByToStrim(xout); // Patch { @@ -207,22 +208,22 @@ void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) xout.StartElement("Repository"); // Url - xout.Element("Url", Url); + xout.Element("Url", this->Url); // Enabled - if (!Enabled.empty()) { - xout.Element("Enabled", Enabled); + if (!this->Enabled.empty()) { + xout.Element("Enabled", this->Enabled); } // Username - if (!Username.empty()) { - xout.Element("Username", Username); + if (!this->Username.empty()) { + xout.Element("Username", this->Username); } // Password - if (!Password.empty()) { - xout.Element("Password", Password); + if (!this->Password.empty()) { + xout.Element("Password", this->Password); } // DisplayName - if (!DisplayName.empty()) { - xout.Element("DisplayName", DisplayName); + if (!this->DisplayName.empty()) { + xout.Element("DisplayName", this->DisplayName); } xout.EndElement(); @@ -232,42 +233,43 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) { xout.StartElement("Repository"); - switch (Update) { - case None: + switch (this->Update) { + case cmCPackIFWRepository::None: break; - case Add: + case cmCPackIFWRepository::Add: xout.Attribute("action", "add"); break; - case Remove: + case cmCPackIFWRepository::Remove: xout.Attribute("action", "remove"); break; - case Replace: + case cmCPackIFWRepository::Replace: xout.Attribute("action", "replace"); break; } // Url - if (Update == Add || Update == Remove) { - xout.Attribute("url", Url); - } else if (Update == Replace) { - xout.Attribute("oldUrl", OldUrl); - xout.Attribute("newUrl", NewUrl); + if (this->Update == cmCPackIFWRepository::Add || + this->Update == cmCPackIFWRepository::Remove) { + xout.Attribute("url", this->Url); + } else if (Update == cmCPackIFWRepository::Replace) { + xout.Attribute("oldUrl", this->OldUrl); + xout.Attribute("newUrl", this->NewUrl); } // Enabled - if (!Enabled.empty()) { - xout.Attribute("enabled", Enabled); + if (!this->Enabled.empty()) { + xout.Attribute("enabled", this->Enabled); } // Username - if (!Username.empty()) { - xout.Attribute("username", Username); + if (!this->Username.empty()) { + xout.Attribute("username", this->Username); } // Password - if (!Password.empty()) { - xout.Attribute("password", Password); + if (!this->Password.empty()) { + xout.Attribute("password", this->Password); } // DisplayName - if (!DisplayName.empty()) { - xout.Attribute("displayname", DisplayName); + if (!this->DisplayName.empty()) { + xout.Attribute("displayname", this->DisplayName); } xout.EndElement(); @@ -275,10 +277,10 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout) { - if (!RepositoryUpdate.empty()) { + if (!this->RepositoryUpdate.empty()) { xout.StartElement("RepositoryUpdate"); - for (RepositoriesVector::iterator rit = RepositoryUpdate.begin(); - rit != RepositoryUpdate.end(); ++rit) { + for (RepositoriesVector::iterator rit = this->RepositoryUpdate.begin(); + rit != this->RepositoryUpdate.end(); ++rit) { (*rit)->WriteRepositoryUpdate(xout); } xout.EndElement(); |