summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/commands/command_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/commands/command_impl.cc')
-rw-r--r--src/components/application_manager/src/commands/command_impl.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc
index 8fa9cbe919..23b14184ad 100644
--- a/src/components/application_manager/src/commands/command_impl.cc
+++ b/src/components/application_manager/src/commands/command_impl.cc
@@ -330,5 +330,24 @@ uint32_t CommandImpl::CalcCommandInternalConsecutiveNumber(
return last_command_number + 1;
}
+bool CommandImpl::CheckSyntax(const std::string& str,
+ bool allow_empty_line) const {
+ if (std::string::npos != str.find_first_of("\t\n")) {
+ LOG4CXX_ERROR(logger_, "CheckSyntax failed! :" << str);
+ return false;
+ }
+ if (std::string::npos != str.find("\\n") ||
+ std::string::npos != str.find("\\t")) {
+ LOG4CXX_ERROR(logger_, "CheckSyntax failed! :" << str);
+ return false;
+ }
+ if (!allow_empty_line) {
+ if ((std::string::npos == str.find_first_not_of(' '))) {
+ return false;
+ }
+ }
+ return true;
+}
+
} // namespace commands
} // namespace application_manager