X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FExchangePlugin%2FExchangePlugin_Validators.cpp;h=a0117d84ef3131ef50cdd11088287c60c8fb31cc;hb=aee09da348319d21259bee81c45d00a08f657de0;hp=052140b8136f963bfb02118b346d0a8a06e4de56;hpb=1a0d48211014d96db9125fe973eacbae895c4490;p=modules%2Fshaper.git diff --git a/src/ExchangePlugin/ExchangePlugin_Validators.cpp b/src/ExchangePlugin/ExchangePlugin_Validators.cpp index 052140b81..a0117d84e 100644 --- a/src/ExchangePlugin/ExchangePlugin_Validators.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Validators.cpp @@ -8,6 +8,8 @@ #include +#include + #include #include #include @@ -24,7 +26,7 @@ bool ExchangePlugin_FormatValidator::parseFormats(const std::list& bool result = true; for (; it != theArguments.end(); ++it) { std::string anArg = *it; - int aSepPos = anArg.find(":"); + size_t aSepPos = anArg.find(":"); if (aSepPos == std::string::npos) { result = false; continue; @@ -38,19 +40,26 @@ bool ExchangePlugin_FormatValidator::parseFormats(const std::list& } bool ExchangePlugin_FormatValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const + const std::list& theArguments, + Events_InfoMessage& theError) const { - if (!theAttribute->isInitialized()) + if (!theAttribute->isInitialized()) { + theError = "Is not initialized."; return false; + } const AttributeStringPtr aStrAttr = std::dynamic_pointer_cast(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 aFormats; ExchangePlugin_FormatValidator::parseFormats(theArguments, aFormats); @@ -66,5 +75,6 @@ bool ExchangePlugin_FormatValidator::isValid(const AttributePtr& theAttribute, } } } + theError = "File name does not end with any available format."; return false; }