OSCMessage.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version. See the file
12  COPYING included with this distribution for more information.
13 */
14 
15 /*
16  This is a modified version of a source file from the
17  Rosegarden MIDI and audio sequencer and notation editor.
18  This file copyright 2000-2006 Chris Cannam.
19 */
20 
21 #ifndef SV_OSC_MESSAGE_H
22 #define SV_OSC_MESSAGE_H
23 
24 #include <QString>
25 #include <QVariant>
26 
27 #include <vector>
28 #include <map>
29 
30 #include "base/Debug.h"
31 
33 {
34 public:
36  ~OSCMessage();
37 
38  void setTarget(const int &target) { m_target = target; }
39  int getTarget() const { return m_target; }
40 
41  void setTargetData(const int &targetData) { m_targetData = targetData; }
42  int getTargetData() const { return m_targetData; }
43 
44  void setMethod(QString method) { m_method = method; }
45  QString getMethod() const { return m_method; }
46 
47  void clearArgs();
48  void addArg(QVariant arg);
49 
50  int getArgCount() const;
51  const QVariant &getArg(int i) const;
52 
53  // For debugging purposes, not for interchange
54  QString toString() const {
55  QString s = QString("[%1][%2] %3")
56  .arg(m_target)
57  .arg(m_targetData)
58  .arg(m_method);
59  for (auto a: m_args) {
60  s.push_back(" \"" + a.toString() + "\"");
61  }
62  return s;
63  }
64 
65 private:
66  int m_target;
68  QString m_method;
69  std::vector<QVariant> m_args;
70 };
71 
72 #endif
int m_targetData
Definition: OSCMessage.h:67
QString getMethod() const
Definition: OSCMessage.h:45
void addArg(QVariant arg)
Definition: OSCMessage.cpp:36
const QVariant & getArg(int i) const
Definition: OSCMessage.cpp:48
int getTarget() const
Definition: OSCMessage.h:39
void clearArgs()
Definition: OSCMessage.cpp:30
QString m_method
Definition: OSCMessage.h:68
int m_target
Definition: OSCMessage.h:66
QString toString() const
Definition: OSCMessage.h:54
void setMethod(QString method)
Definition: OSCMessage.h:44
void setTarget(const int &target)
Definition: OSCMessage.h:38
int getArgCount() const
Definition: OSCMessage.cpp:42
void setTargetData(const int &targetData)
Definition: OSCMessage.h:41
std::vector< QVariant > m_args
Definition: OSCMessage.h:69
int getTargetData() const
Definition: OSCMessage.h:42