]> mj.ucw.cz Git - libucw.git/commitdiff
tableprinter: update of comments and code cleanup
authorRobert Kessl <kesslr@centrum.cz>
Tue, 29 Jul 2014 11:55:52 +0000 (13:55 +0200)
committerRobert Kessl <kesslr@centrum.cz>
Tue, 29 Jul 2014 11:55:52 +0000 (13:55 +0200)
ucw/table.c
ucw/table.h

index 1e2cabb8435e9f389f3d9f4c53312e24acf751d0..499b012426aff79c4dd64eb847afc651863bfb7a 100644 (file)
@@ -199,9 +199,9 @@ void table_set_col_order(struct table *tbl, const struct table_col_instance *col
 
 bool table_col_is_printed(struct table *tbl, uint col_def_idx)
 {
-  if(tbl->ll_headers[col_def_idx] == -1) return 0;
+  if(tbl->ll_headers[col_def_idx] == -1) return false;
 
-  return 1;
+  return true;
 }
 
 static char * table_parse_col_arg(char *col_def)
index cc8ba985c392e5c9ca9f1b7825c5836258054169..6bcc13343d37a64571995c4390f257f40add4b8d 100644 (file)
@@ -86,12 +86,19 @@ struct table_column {
        //     instance to which the @col_opt is set. Return value is the error string.
 };
 
+/**
+ * Definition of a column instance. The table_col_instance belongs to a struct table. col_def is
+ * pointing to a definition of the column in struct table::columns. The user can fill only the @idx
+ * and @fmt. The @col_def, @cell_content, @next_column are private fields.
+ *
+ * Please use only fields marked with `[*]`.
+ **/
 struct table_col_instance {
-  uint idx;                            // idx is a index into struct table::columns
+  uint idx;                            // [*] idx is a index into struct table::columns
   const struct table_column *col_def;  // this is pointer to the column definition, located in the array struct table::columns
   const char *cell_content;            // content of the cell of the current row
   int next_column;                     // index of next column in linked list of columns of the same type
-  uint fmt;                            // format of this column
+  uint fmt;                            // [*] format of this column
 };
 
 /**
@@ -344,7 +351,7 @@ void table_set_col_order(struct table *tbl, const struct table_col_instance *col
 const char *table_set_col_order_by_name(struct table *tbl, const char *col_order);
 
 /**
- * Returns true if col_idx will be printed, false otherwise.
+ * Returns true if @col_def_idx will be printed, false otherwise.
  **/
 bool table_col_is_printed(struct table *tbl, uint col_def_idx);