// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-// File: SketchPlugin_Validators.cpp
-// Created: 01 Aug 2014
-// Author: Vitaly SMETANNIKOV
+// File: ExchangePlugin_Validators.cpp
+// Created: Aug 01, 2014
+// Author: Sergey BELASH
#include <ExchangePlugin_Validators.h>
}
bool ExchangePlugin_FormatValidator::isValid(const AttributePtr& theAttribute,
- const std::list<std::string>& theArguments) const
+ const std::list<std::string>& theArguments,
+ std::string& theError) const
{
- if (!theAttribute->isInitialized())
+ if (!theAttribute->isInitialized()) {
+ theError = "Is not initialized.";
return false;
+ }
const AttributeStringPtr aStrAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
- if (!aStrAttr)
+ if (!aStrAttr) {
+ theError = "Is not a string attribute.";
return false;
+ }
std::string aFileName = aStrAttr->value();
- if (aFileName.empty())
+ if (aFileName.empty()) {
+ theError = "File name is empty.";
return false;
+ }
std::list<std::string> aFormats;
ExchangePlugin_FormatValidator::parseFormats(theArguments, aFormats);
}
}
}
+ theError = "File name does not end with any available format.";
return false;
}