/* * * ProLinga-Run * * Copyright (C) 2002-2009 Xobas Software. * All rights reserved. * * This file is part of ProLinga-Run. * * ProLinga-Run is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ProLinga-Run is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ProLinga-Run. If not, see . * * More information is available at the following addresses: * * Website : http://www.prolinga.org * * Email : prolinga-list@prolinga.org * * */ #include "RunCommon.h" #include "DataRef.hpp" #include "LogicCommandDef.hpp" extern LcResponsePtr lcResponsePtr; LcResponse::LcResponse() { responseType = 0; responseValue = NULL; } LcResponse::~LcResponse() { if (responseValue != NULL) delete responseValue; } int LcResponse::getResponseType(void) { return responseType; } char *LcResponse::getResponseValue(void) { return responseValue; } void LcResponse::setResponseType(int resType) { responseType = resType; } void LcResponse::setResponseValue(const char *resValue) { if (responseValue != NULL) delete responseValue; responseValue = new char[strlen(resValue)]; strcpy(responseValue, resValue); } /* Command : RESPONSE */ /* Syntax : RESPONSE DATAREF prefix-dataref */ /* RESPONSE FILE ext_file_name */ /* RESPONSE TEXT text_doc_name */ /* RESPONSE XML xml_doc_name */ void CmdResponse(const char **argList, int argHits, bool isMainThread) { /* Get Response Type */ if (strcmp(argList[1], LC_RESPONSE_DATAREF) == 0) { /* Set response type */ lcResponsePtr->setResponseType(LC_RESPONSE_TYPE_DATAREF); /* Set response value */ lcResponsePtr->setResponseValue(argList[2]); } else if (strcmp(argList[1], LC_RESPONSE_FILE) == 0) { /* Set response type */ lcResponsePtr->setResponseType(LC_RESPONSE_TYPE_FILE); /* Set response value */ lcResponsePtr->setResponseValue(argList[2]); } else if ((strcmp(argList[1], LC_RESPONSE_TEXT) == 0) || (strcmp(argList[1], "TXT") == 0)) { /* Set response type */ lcResponsePtr->setResponseType(LC_RESPONSE_TYPE_TEXT); /* Set response value */ lcResponsePtr->setResponseValue(argList[2]); } else if (strcmp(argList[1], LC_RESPONSE_XML) == 0) { /* Set response type */ lcResponsePtr->setResponseType(LC_RESPONSE_TYPE_XML); /* Set response value */ lcResponsePtr->setResponseValue(argList[2]); } else { /* Invalid option */ //ERROR } /* Return */ return; }