Python: document writer.StructureFieldDeclaration
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 10 Dec 2014 01:27:27 +0000 (20:27 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 Feb 2015 21:07:25 +0000 (16:07 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bindings/python/writer.py

index 7c6627e0d8ca8b9b880f073ca0e5806a38ffe9c5..9bf9e688ecc18b23dea35c010272026cf88b3144 100644 (file)
@@ -745,9 +745,16 @@ class FloatFieldDeclaration(FloatingPointFieldDeclaration):
 
 
 class StructureFieldDeclaration(FieldDeclaration):
+    """
+    Structure field declaration, i.e. an ordered mapping from field
+    names to field declarations.
+    """
+
     def __init__(self):
         """
-        Create a new structure field declaration.
+        Creates an empty structure field declaration.
+
+        :exc:`ValueError` is raised on error.
         """
 
         self._ft = nbt._bt_ctf_field_type_structure_create()
@@ -755,7 +762,10 @@ class StructureFieldDeclaration(FieldDeclaration):
 
     def add_field(self, field_type, field_name):
         """
-        Add a field of type "field_type" to the structure.
+        Appends one :class:`FieldDeclaration` *field_type* named
+        *field_name* to the structure's ordered map.
+
+        :exc:`ValueError` is raised on error.
         """
 
         ret = nbt._bt_ctf_field_type_structure_add_field(self._ft,
@@ -768,7 +778,10 @@ class StructureFieldDeclaration(FieldDeclaration):
     @property
     def fields(self):
         """
-        Generator returning the structure's field as tuples of (field name, field declaration).
+        Generates the (field name, :class:`FieldDeclaration`) pairs
+        of this structure.
+
+        :exc:`TypeError` is raised on error.
         """
 
         count = nbt._bt_ctf_field_type_structure_get_field_count(self._ft)
@@ -794,7 +807,10 @@ class StructureFieldDeclaration(FieldDeclaration):
 
     def get_field_by_name(self, name):
         """
-        Get a field declaration by name (FieldDeclaration).
+        Returns the :class:`FieldDeclaration` mapped to the field name
+        *name* in this structure.
+
+        :exc:`TypeError` is raised on error.
         """
 
         field_type_native = nbt._bt_ctf_field_type_structure_get_field_type_by_name(self._ft, name)
This page took 0.025991 seconds and 4 git commands to generate.