From 0a1148a96ecc9de28cc24d3dbc271212d9cb8fcb Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 10 Dec 2014 04:17:40 -0500 Subject: [PATCH] Python: document writer.StringFieldDeclaration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- bindings/python/writer.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/bindings/python/writer.py b/bindings/python/writer.py index e24631d4..0f57788e 100644 --- a/bindings/python/writer.py +++ b/bindings/python/writer.py @@ -1064,9 +1064,15 @@ class SequenceFieldDeclaration(FieldDeclaration): class StringFieldDeclaration(FieldDeclaration): + """ + String (NULL-terminated array of bytes) field declaration. + """ + def __init__(self): """ - Create a new string field declaration. + Creates a string field declaration. + + :exc:`ValueError` is raised on error. """ self._ft = nbt._bt_ctf_field_type_string_create() @@ -1075,17 +1081,18 @@ class StringFieldDeclaration(FieldDeclaration): @property def encoding(self): """ - Get a string declaration's encoding (a constant from the CTFStringEncoding class). + String encoding (one of + :class:`babeltrace.common.CTFStringEncoding` constants). + + Set this attribute to change this string's encoding. + + :exc:`ValueError` is raised on error. """ return nbt._bt_ctf_field_type_string_get_encoding(self._ft) @encoding.setter def encoding(self, encoding): - """ - Set a string declaration's encoding. Must be a constant from the CTFStringEncoding class. - """ - ret = nbt._bt_ctf_field_type_string_set_encoding(self._ft, encoding) if ret < 0: raise ValueError("Could not set string encoding.") -- 2.34.1