From: Philippe Proulx Date: Wed, 10 Dec 2014 09:17:40 +0000 (-0500) Subject: Python: document writer.StringFieldDeclaration X-Git-Tag: v2.0.0-pre1~1364 X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=0a1148a96ecc9de28cc24d3dbc271212d9cb8fcb;p=babeltrace.git Python: document writer.StringFieldDeclaration Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- 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.")