blob: f6c0a755e186fb9c59d013d7af30c1397547c321 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Impala: be/src/util/table-printer.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Impala
</div>
<div id="projectbrief">Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('table-printer_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Macros</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">table-printer.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="table-printer_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">// Copyright 2012 Cloudera Inc.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">// you may not use this file except in compliance with the License.</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">// You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment">// See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment">// limitations under the License.</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;</div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;</div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="preprocessor">#ifndef IMPALA_UTIL_TABLE_PRINTER_H</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define IMPALA_UTIL_TABLE_PRINTER_H</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#include &lt;boost/uuid/uuid.hpp&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;</div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &quot;gen-cpp/Types_types.h&quot;</span> <span class="comment">// for TUniqueId</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="keyword">namespace </span>impala {</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;</div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="classimpala_1_1TablePrinter.html"> 27</a></span>&#160;<span class="keyword">class </span><a class="code" href="classimpala_1_1TablePrinter.html">TablePrinter</a> {</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <a class="code" href="classimpala_1_1TablePrinter.html#a314533c11e98b516d294bdf8d85042c1">TablePrinter</a>();</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; <span class="keywordtype">void</span> <a class="code" href="classimpala_1_1TablePrinter.html#aa49c55fa11fb9bd5f350243e62a23189">AddColumn</a>(<span class="keyword">const</span> std::string&amp; label, <span class="keywordtype">bool</span> left_align);</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="keywordtype">void</span> <a class="code" href="classimpala_1_1TablePrinter.html#a598e27144597de4d87792b9f623c1a5a">set_max_output_width</a>(<span class="keywordtype">int</span> width);</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; <span class="keywordtype">void</span> <a class="code" href="classimpala_1_1TablePrinter.html#a91484130097f86a14ccad52d250eaa63">AddRow</a>(<span class="keyword">const</span> std::vector&lt;std::string&gt;&amp; row);</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; std::string <a class="code" href="classimpala_1_1TablePrinter.html#a2df6a5d532eda86dc50bab24e6e216b2">ToString</a>(<span class="keyword">const</span> std::string&amp; prefix = <span class="stringliteral">&quot;&quot;</span>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="classimpala_1_1TablePrinter.html#a9cb2c10738682b4796e5ac14e8ff6b38"> 46</a></span>&#160; std::vector&lt;std::string&gt; <a class="code" href="classimpala_1_1TablePrinter.html#a9cb2c10738682b4796e5ac14e8ff6b38">labels_</a>;</div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="classimpala_1_1TablePrinter.html#a43aba440a75d4c0574826035345f55fc"> 48</a></span>&#160; std::vector&lt;bool&gt; <a class="code" href="classimpala_1_1TablePrinter.html#a43aba440a75d4c0574826035345f55fc">left_align_</a>;</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;</div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="classimpala_1_1TablePrinter.html#a8ea17f211666085db52c9ee06f1f48be"> 51</a></span>&#160; <span class="keywordtype">int</span> <a class="code" href="classimpala_1_1TablePrinter.html#a8ea17f211666085db52c9ee06f1f48be">max_output_width_</a>;</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;</div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="classimpala_1_1TablePrinter.html#ad2caee38aea9ff35b45d0816aa04c8f1"> 53</a></span>&#160; std::vector&lt;std::vector&lt;std::string&gt; &gt; <a class="code" href="classimpala_1_1TablePrinter.html#ad2caee38aea9ff35b45d0816aa04c8f1">rows_</a>;</div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="classimpala_1_1TablePrinter.html#a02ae9a473041514a6e8ae3bcf5a0c717"> 54</a></span>&#160; std::vector&lt;int&gt; <a class="code" href="classimpala_1_1TablePrinter.html#a02ae9a473041514a6e8ae3bcf5a0c717">max_col_widths_</a>;</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <span class="keywordtype">void</span> <a class="code" href="classimpala_1_1TablePrinter.html#afef311b1f83dc9a175cc255ff285113b">PrintRow</a>(std::stringstream* ss, <span class="keyword">const</span> std::vector&lt;std::string&gt;&amp; row,</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; <span class="keyword">const</span> std::vector&lt;int&gt;&amp; widths) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;};</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;}</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_a2df6a5d532eda86dc50bab24e6e216b2"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#a2df6a5d532eda86dc50bab24e6e216b2">impala::TablePrinter::ToString</a></div><div class="ttdeci">std::string ToString(const std::string &amp;prefix=&quot;&quot;) const </div><div class="ttdoc">Print to a table with prefix coming before the output. </div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8cc_source.html#l00073">table-printer.cc:73</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_aa49c55fa11fb9bd5f350243e62a23189"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#aa49c55fa11fb9bd5f350243e62a23189">impala::TablePrinter::AddColumn</a></div><div class="ttdeci">void AddColumn(const std::string &amp;label, bool left_align)</div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8cc_source.html#l00031">table-printer.cc:31</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_ad2caee38aea9ff35b45d0816aa04c8f1"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#ad2caee38aea9ff35b45d0816aa04c8f1">impala::TablePrinter::rows_</a></div><div class="ttdeci">std::vector&lt; std::vector&lt; std::string &gt; &gt; rows_</div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8h_source.html#l00053">table-printer.h:53</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html"><div class="ttname"><a href="classimpala_1_1TablePrinter.html">impala::TablePrinter</a></div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8h_source.html#l00027">table-printer.h:27</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_a43aba440a75d4c0574826035345f55fc"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#a43aba440a75d4c0574826035345f55fc">impala::TablePrinter::left_align_</a></div><div class="ttdeci">std::vector&lt; bool &gt; left_align_</div><div class="ttdoc">For each column, true if the value should be left aligned, right aligned otherwise. </div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8h_source.html#l00048">table-printer.h:48</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_a9cb2c10738682b4796e5ac14e8ff6b38"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#a9cb2c10738682b4796e5ac14e8ff6b38">impala::TablePrinter::labels_</a></div><div class="ttdeci">std::vector&lt; std::string &gt; labels_</div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8h_source.html#l00046">table-printer.h:46</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_a8ea17f211666085db52c9ee06f1f48be"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#a8ea17f211666085db52c9ee06f1f48be">impala::TablePrinter::max_output_width_</a></div><div class="ttdeci">int max_output_width_</div><div class="ttdoc">-1 to indicate unlimited. </div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8h_source.html#l00051">table-printer.h:51</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_a02ae9a473041514a6e8ae3bcf5a0c717"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#a02ae9a473041514a6e8ae3bcf5a0c717">impala::TablePrinter::max_col_widths_</a></div><div class="ttdeci">std::vector&lt; int &gt; max_col_widths_</div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8h_source.html#l00054">table-printer.h:54</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_a314533c11e98b516d294bdf8d85042c1"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#a314533c11e98b516d294bdf8d85042c1">impala::TablePrinter::TablePrinter</a></div><div class="ttdeci">TablePrinter()</div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8cc_source.html#l00028">table-printer.cc:28</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_a91484130097f86a14ccad52d250eaa63"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#a91484130097f86a14ccad52d250eaa63">impala::TablePrinter::AddRow</a></div><div class="ttdeci">void AddRow(const std::vector&lt; std::string &gt; &amp;row)</div><div class="ttdoc">Add a row to the table. This must have the same width as labels. </div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8cc_source.html#l00042">table-printer.cc:42</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_a598e27144597de4d87792b9f623c1a5a"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#a598e27144597de4d87792b9f623c1a5a">impala::TablePrinter::set_max_output_width</a></div><div class="ttdeci">void set_max_output_width(int width)</div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8cc_source.html#l00037">table-printer.cc:37</a></div></div>
<div class="ttc" id="classimpala_1_1TablePrinter_html_afef311b1f83dc9a175cc255ff285113b"><div class="ttname"><a href="classimpala_1_1TablePrinter.html#afef311b1f83dc9a175cc255ff285113b">impala::TablePrinter::PrintRow</a></div><div class="ttdeci">void PrintRow(std::stringstream *ss, const std::vector&lt; std::string &gt; &amp;row, const std::vector&lt; int &gt; &amp;widths) const </div><div class="ttdoc">Helper function to print one row to ss. </div><div class="ttdef"><b>Definition:</b> <a href="table-printer_8cc_source.html#l00050">table-printer.cc:50</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_e5d120be6b5e8a44336cbfd013b25604.html">be</a></li><li class="navelem"><a class="el" href="dir_68cf7cafb51a962d5bc4848b83cab0de.html">src</a></li><li class="navelem"><a class="el" href="dir_6939c8639261a9303da2cde491b82898.html">util</a></li><li class="navelem"><a class="el" href="table-printer_8h.html">table-printer.h</a></li>
<li class="footer">Generated on Thu May 7 2015 16:10:38 for Impala by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
</ul>
</div>
</body>
</html>