Skip to content

Instantly share code, notes, and snippets.

@paddor
Last active November 24, 2015 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paddor/8e574f008970036705f1 to your computer and use it in GitHub Desktop.
Save paddor/8e574f008970036705f1 to your computer and use it in GitHub Desktop.
diff --git a/include/zarmour.h b/include/zarmour.h
index 12dbd10..8aff6af 100644
--- a/include/zarmour.h
+++ b/include/zarmour.h
@@ -18,26 +18,24 @@
extern "C" {
#endif
+// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT!
+// @warning Please edit the model at "api/zarmour.xml" to make changes.
// @interface
-
-// Enumeration defining different encoding modes
+// Enumeration defining different encoding modes
typedef enum {
- ZARMOUR_MODE_BASE64_STD // Standard base 64
- , ZARMOUR_MODE_BASE64_URL // URL and filename friendly base 64
- , ZARMOUR_MODE_BASE32_STD // Standard base 32
- , ZARMOUR_MODE_BASE32_HEX // Extended hex base 32
- , ZARMOUR_MODE_BASE16 // Standard base 16
-#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (3, 3, 0))
- , ZARMOUR_MODE_Z85 // Z85 from ZeroMQ RFC 32
-#endif
+ ZARMOUR_MODE_BASE64_STD = 0, // Standard base 64
+ ZARMOUR_MODE_BASE64_URL = 1, // URL and filename friendly base 64
+ ZARMOUR_MODE_BASE32_STD = 2, // Standard base 32
+ ZARMOUR_MODE_BASE32_HEX = 3, // Extended hex base 32
+ ZARMOUR_MODE_BASE16_HEX = 4, // Standard base 16
+ ZARMOUR_MODE_Z85 = 5 // Z85 from ZeroMQ RFC 32
} zarmour_mode_t;
-
-// Create a new zarmour
+// Create a new zarmour.
CZMQ_EXPORT zarmour_t *
zarmour_new ();
-// Destroy the zarmour
+// Destroy the zarmour.
CZMQ_EXPORT void
zarmour_destroy (zarmour_t **self_p);
@@ -45,47 +43,59 @@ CZMQ_EXPORT void
CZMQ_EXPORT void
zarmour_print (zarmour_t *self);
-// Get printable string for mode
+// Get printable string for mode.
CZMQ_EXPORT const char *
zarmour_mode_str (zarmour_t *self);
// Encode a stream of bytes into an armoured string.
+// The caller is responsible for destroying the return value when finished with it.
CZMQ_EXPORT char *
zarmour_encode (zarmour_t *self, const byte *data, size_t data_size);
-// Decode an armoured string into a string of bytes.
+// Decode an armoured string into a string of bytes.
// The decoded output is null-terminated, so it may be treated
-// as a string, if that's what it was prior to encoding.
+// as a string, if that's what it was prior to encoding.
+// The caller is responsible for destroying the return value when finished with it.
CZMQ_EXPORT byte *
zarmour_decode (zarmour_t *self, const char *data, size_t *decode_size);
-// Get/set the mode property
+// Get the mode property.
CZMQ_EXPORT zarmour_mode_t
zarmour_mode (zarmour_t *self);
+
+// Set the mode property.
CZMQ_EXPORT void
zarmour_set_mode (zarmour_t *self, zarmour_mode_t mode);
-// Get/set the pad property
+// Return true if padding is turned on.
CZMQ_EXPORT bool
zarmour_pad (zarmour_t *self);
+
+// Turn padding on or off. Default is on.
CZMQ_EXPORT void
zarmour_set_pad (zarmour_t *self, bool pad);
-// Get/set the pad_char property
+// Get the padding character.
CZMQ_EXPORT char
zarmour_pad_char (zarmour_t *self);
+
+// Set the padding character.
CZMQ_EXPORT void
zarmour_set_pad_char (zarmour_t *self, char pad_char);
-// Get/set the line_breaks property
+// Return if splitting output into lines is turned on. Default is off.
CZMQ_EXPORT bool
zarmour_line_breaks (zarmour_t *self);
+
+// Turn splitting output into lines on or off.
CZMQ_EXPORT void
zarmour_set_line_breaks (zarmour_t *self, bool line_breaks);
-// Get/set the line_length property
+// Get the line length used for splitting lines.
CZMQ_EXPORT size_t
zarmour_line_length (zarmour_t *self);
+
+// Set the line length used for splitting lines.
CZMQ_EXPORT void
zarmour_set_line_length (zarmour_t *self, size_t line_length);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment