X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/1059e1cc0c2ecfa237406949aa26155b6a5b9154..66f23d4fabf89ad09adbd4dfc15ac6b5b2b7da83:/interpretor/preprocessor/faust-0.9.47mr3/architecture/osclib/faust/src/msg/Message.cpp diff --git a/interpretor/preprocessor/faust-0.9.47mr3/architecture/osclib/faust/src/msg/Message.cpp b/interpretor/preprocessor/faust-0.9.47mr3/architecture/osclib/faust/src/msg/Message.cpp deleted file mode 100644 index d130564..0000000 --- a/interpretor/preprocessor/faust-0.9.47mr3/architecture/osclib/faust/src/msg/Message.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - - INScore Project - - Copyright (C) 2011 Grame - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France - research@grame.fr - -*/ - -#include -#include - -#include "Message.h" -#include "OSCFError.h" - -using namespace std; - -namespace oscfaust -{ - -//-------------------------------------------------------------------------- -// Message implementation -//-------------------------------------------------------------------------- -Message::Message(const Message& msg) -{ - setAddress (msg.address()); - fArguments = msg.params(); -} - -//-------------------------------------------------------------------------- -static string escape (const string& str) -{ - string out; - const char *ptr = str.c_str(); - while (*ptr) { - char c = *ptr++; - if (c == '"') - out += "\\\""; - else out += c; - } - return out; -} - -//-------------------------------------------------------------------------- -void Message::print(std::ostream& out) const -{ - out << address() << " " ; - argslist::const_iterator i = params().begin(); - - ios::fmtflags f = out.flags ( ios::showpoint ); - while (i != params().end()) { - MsgParam* s = dynamic_cast*>((baseparam*)(*i)); - if (s) out << "\"" << escape(s->getValue()) << "\" "; - MsgParam* ip = dynamic_cast*>((baseparam*)(*i)); - if (ip) out << ip->getValue() << " "; - MsgParam* f = dynamic_cast*>((baseparam*)(*i)); - if (f) out << f->getValue() << " "; - i++; - } - out.flags ( f ); -} - -//-------------------------------------------------------------------------- -void Message::print(OSCStream& out) const -{ - out << OSCStart(address().c_str()); - printArgs(out); - out << OSCEnd(); -} - -//-------------------------------------------------------------------------- -void Message::printArgs(OSCStream& out) const -{ - for (int i=0; i < size(); i++) { - string str; float fv; int iv; - if (param(i, fv)) out << fv; - else if (param(i, iv)) out << iv; - else if (param(i, str)) out << str; - else OSCFErr << "Message::print(OSCStream& out): unknown message parameter type" << OSCFEndl; - } -} - -} // end namespoace