| 598 | } |
| 599 | |
| 600 | int64_t CalculateHeaderSize(QuotingStyle quoting_style) const { |
| 601 | int64_t header_length = 0; |
| 602 | for (int col = 0; col < schema_->num_fields(); col++) { |
| 603 | const std::string& col_name = schema_->field(col)->name(); |
| 604 | header_length += col_name.size(); |
| 605 | switch (quoting_style) { |
| 606 | case QuotingStyle::None: |
| 607 | break; |
| 608 | case QuotingStyle::Needed: |
| 609 | case QuotingStyle::AllValid: |
| 610 | header_length += CountQuotes(col_name); |
| 611 | break; |
| 612 | } |
| 613 | } |
| 614 | header_length += kDelimiterCount * (schema_->num_fields() - 1) + options_.eol.size(); |
| 615 | switch (quoting_style) { |
| 616 | case QuotingStyle::None: |
| 617 | break; |
| 618 | case QuotingStyle::Needed: |
| 619 | case QuotingStyle::AllValid: |
| 620 | header_length += kQuoteCount * schema_->num_fields(); |
| 621 | break; |
| 622 | } |
| 623 | return header_length; |
| 624 | } |
| 625 | |
| 626 | Status WriteHeader() { |
| 627 | // Only called once, as part of initialization |
nothing calls this directly
no test coverage detected