Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

shell: refactor table data output method #220

Merged
merged 6 commits into from
Feb 11, 2019

Conversation

acelyc111
Copy link
Member

 A tool used to print data in a table form.

 Example usage 1:
    table_printer tp;
    tp.add_title("table_title");
    tp.add_column("column_name1");
    tp.add_column("column_name2");
    for (...) {
        tp.add_row("row_name_i");
        tp.append_data(int_data);
        tp.append_data(double_data);
    }

    std::ostream out(...);
    tp.output(out);

 Output looks like:
    table_title  column_name1  column_name2
    row_name_1   123           45.67
    row_name_2   456           45.68

 Example usage 2:
    table_printer tp;
    tp.add_row_name_and_data("row_name_1", int_value);
    tp.add_row_name_and_data("row_name_2", string_value);

    std::ostream out(...);
    tp.output(out, ": ");

 Output looks like:
    row_name_1 :  4567
    row_name_2 :  hello

@qinzuoyan qinzuoyan merged commit 38df49e into XiaoMi:master Feb 11, 2019
acelyc111 added a commit to acelyc111/rdsn that referenced this pull request Feb 11, 2019
acelyc111 added a commit to acelyc111/rdsn that referenced this pull request Feb 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants