use empty method to check for emptyness

This commit is contained in:
Daniel Pfeifer 2016-09-15 23:59:29 +02:00
parent 6e06a53ebf
commit 73f648f167
44 changed files with 46 additions and 46 deletions

View File

@ -14,7 +14,7 @@
bool cmAddCompileOptionsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
return true;
}

View File

@ -18,7 +18,7 @@
bool cmAddCustomTargetCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -16,7 +16,7 @@ bool cmAddDefinitionsCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
// it is OK to have no arguments
if (args.size() < 1) {
if (args.empty()) {
return true;
}

View File

@ -18,7 +18,7 @@
bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -15,7 +15,7 @@
bool cmAddSubDirectoryCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -27,7 +27,7 @@ bool cmBuildCommand::InitialPass(std::vector<std::string> const& args,
bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("requires at least one argument naming a CMake variable");
return false;
}

View File

@ -22,7 +22,7 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
"The build_name command should not be called; see CMP0036.")) {
return true;
}
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -17,7 +17,7 @@
bool cmCMakePolicyCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("requires at least one argument.");
return false;
}

View File

@ -85,7 +85,7 @@ bool cmConditionEvaluator::IsTrue(
errorString = "";
// handle empty invocation
if (args.size() < 1) {
if (args.empty()) {
return false;
}

View File

@ -17,7 +17,7 @@
bool cmDefinePropertyCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -17,7 +17,7 @@ bool cmEnableLanguageCommand::InitialPass(std::vector<std::string> const& args,
{
bool optional = false;
std::vector<std::string> languages;
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -19,7 +19,7 @@
bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -31,7 +31,7 @@ void cmExecuteProcessCommandAppend(std::vector<char>& output, const char* data,
bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -69,7 +69,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
const ImportPropertyMap& properties)
{
std::string config = "";
if (this->Configurations.size()) {
if (!this->Configurations.empty()) {
config = this->Configurations[0];
}
cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(

View File

@ -76,7 +76,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode(
os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/";
os << target->Target->GetProperty("__dest") << "/";
std::string config = "";
if (this->Configurations.size()) {
if (!this->Configurations.empty()) {
config = this->Configurations[0];
}
os << target->GetFullName(config) << "\n";
@ -103,7 +103,7 @@ void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties(
const ImportPropertyMap& properties)
{
std::string config = "";
if (this->Configurations.size()) {
if (!this->Configurations.empty()) {
config = this->Configurations[0];
}
cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(

View File

@ -27,7 +27,7 @@ bool cmExportLibraryDependenciesCommand::InitialPass(
"see CMP0033.")) {
return true;
}
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -89,7 +89,7 @@ void cmFindPackageCommand::AppendSearchPathGroups()
bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -113,7 +113,7 @@ bool cmForEachFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
bool cmForEachCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -202,7 +202,7 @@ bool cmFunctionFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
bool cmFunctionCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -15,7 +15,7 @@
bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1 || args.size() > 4) {
if (args.empty() || args.size() > 4) {
this->SetError("called with wrong number of arguments. "
"include() only takes one file.");
return false;

View File

@ -15,7 +15,7 @@
bool cmIncludeDirectoryCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
return true;
}

View File

@ -15,7 +15,7 @@
bool cmIncludeRegularExpressionCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
if ((args.size() < 1) || (args.size() > 2)) {
if ((args.empty()) || (args.size() > 2)) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -15,7 +15,7 @@
bool cmLinkDirectoriesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
return true;
}

View File

@ -15,7 +15,7 @@
bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
return true;
}
// add libraries, nothe that there is an optional prefix

View File

@ -167,10 +167,10 @@ public:
iterator Truncate()
{
assert(this->UpPositions.size() > 0);
assert(!this->UpPositions.empty());
this->UpPositions.erase(this->UpPositions.begin() + 1,
this->UpPositions.end());
assert(this->Data.size() > 0);
assert(!this->Data.empty());
this->Data.erase(this->Data.begin() + 1, this->Data.end());
return iterator(this, 1);
}

View File

@ -18,7 +18,7 @@
bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with wrong number of arguments.");
}

View File

@ -183,7 +183,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
"The load_command command should not be called; see CMP0031.")) {
return true;
}
if (args.size() < 1) {
if (args.empty()) {
return true;
}

View File

@ -236,7 +236,7 @@ bool cmMacroFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
bool cmMacroCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -15,7 +15,7 @@
bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -16,7 +16,7 @@
bool cmMathCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("must be called with at least one argument.");
return false;
}

View File

@ -17,7 +17,7 @@
bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -15,7 +15,7 @@
bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("PROJECT called with incorrect number of arguments");
return false;
}

View File

@ -15,7 +15,7 @@
bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
return true;
}

View File

@ -16,7 +16,7 @@ bool cmRemoveDefinitionsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
// it is OK to have no arguments
if (args.size() < 1) {
if (args.empty()) {
return true;
}

View File

@ -15,7 +15,7 @@
bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -17,7 +17,7 @@
bool cmSetDirectoryPropertiesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -18,7 +18,7 @@
bool cmSetTestsPropertiesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -15,7 +15,7 @@
bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -26,7 +26,7 @@
bool cmStringCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("must be called with at least one argument.");
return false;
}

View File

@ -15,7 +15,7 @@
bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -22,7 +22,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
// must have one argument
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -15,7 +15,7 @@
bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1 || args.size() > 2) {
if (args.empty() || args.size() > 2) {
this->SetError("called with incorrect number of arguments");
return false;
}

View File

@ -104,7 +104,7 @@ cmVariableWatchCommand::~cmVariableWatchCommand()
bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("must be called with at least one argument.");
return false;
}

View File

@ -133,7 +133,7 @@ bool cmWhileFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
bool cmWhileCommand::InvokeInitialPass(
const std::vector<cmListFileArgument>& args, cmExecutionStatus&)
{
if (args.size() < 1) {
if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}