Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add zg_message_to_string to ZenGarden.h

  • Loading branch information...
commit 4196bf7815793801d74c9b7beb6e92a2e1a118ce 1 parent 5b190cd
@mhroth authored
Showing with 9 additions and 6 deletions.
  1. +2 −6 src/PdMessage.cpp
  2. +4 −0 src/ZenGarden.cpp
  3. +3 −0  src/ZenGarden.h
View
8 src/PdMessage.cpp
@@ -343,9 +343,7 @@ char *PdMessage::toString() {
lengths[i] = snprintf(NULL, 0, "%s", getSymbol(i));
break;
}
- default: {
- break;
- }
+ default: break;
}
// total length of our string is each atom plus a space, or \0 on the end
size += lengths[i] + 1;
@@ -373,9 +371,7 @@ char *PdMessage::toString() {
snprintf(&finalString[pos], lengths[i] + 1, "%s", getSymbol(i));
break;
}
- default: {
- break;
- }
+ default: break;
}
pos += lengths[i];
}
View
4 src/ZenGarden.cpp
@@ -476,3 +476,7 @@ float zg_message_get_float(PdMessage *message, unsigned int index) {
const char *zg_message_get_symbol(PdMessage *message, unsigned int index) {
return message->getSymbol(index);
}
+
+char *zg_message_to_string(ZGMessage *message) {
+ return message->toString();
+}
View
3  src/ZenGarden.h
@@ -319,6 +319,9 @@ typedef enum ZGConnectionType {
const char *zg_message_get_symbol(ZGMessage *message, unsigned int index);
+ /** Returns a string representation of the message. The string must be freed by the caller. */
+ char *zg_message_to_string(ZGMessage *message);
+
#ifdef __cplusplus
}
Please sign in to comment.
Something went wrong with that request. Please try again.