// rdmacro.cpp // // A container class for a Rivendell Macro Language Command // // (C) Copyright 2002-2004,2016 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // This program 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 this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // #include #include RDMacro::RDMacro() { clear(); } RDMacro::Role RDMacro::role() const { return rml_role; } void RDMacro::setRole(RDMacro::Role role) { rml_role=role; } RDMacro::Command RDMacro::command() const { return rml_cmd; } void RDMacro::setCommand(RDMacro::Command cmd) { rml_cmd=cmd; } QHostAddress RDMacro::address() const { return rml_addr; } void RDMacro::setAddress(QHostAddress addr) { rml_addr=addr; } Q_UINT16 RDMacro::port() const { return rml_port; } void RDMacro::setPort(Q_UINT16 port) { rml_port=port; } bool RDMacro::echoRequested() const { return rml_echo_requested; } void RDMacro::setEchoRequested(bool state) { rml_echo_requested=state; } QVariant RDMacro::arg(int n) const { if(n>=RD_RML_MAX_ARGS) { return QVariant(); } return rml_arg[n]; } void RDMacro::setArg(int n,QVariant arg) { if(n>=RD_RML_MAX_ARGS) { return; } rml_arg[n]=arg; } int RDMacro::argQuantity() const { return rml_arg_quantity; } void RDMacro::acknowledge(bool state) { rml_role=RDMacro::Reply; if(rml_arg_quantity=RD_RML_MAX_ARGS)||(argptr>=RD_RML_MAX_LENGTH)) { rml_arg_quantity=0; rml_cmd=RDMacro::NN; for(int j=0;j=n) { return -1; } sprintf(str,"%c%c",rml_cmd>>8,rml_cmd&0xFF); for(int i=0;i