MIDAS
Loading...
Searching...
No Matches
NestedOutput Class Reference
Collaboration diagram for NestedOutput:

Public Member Functions

void Clear ()
 
void Output (int nest, bool span, std::string text)
 
std::string Print ()
 

Public Attributes

std::vector< NestedLinefLines
 

Detailed Description

Definition at line 4808 of file mjsonrpc.cxx.

Member Function Documentation

◆ Clear()

void NestedOutput::Clear ( )
inline

Definition at line 4813 of file mjsonrpc.cxx.

4814 {
4815 fLines.clear();
4816 }
std::vector< NestedLine > fLines
Here is the caller graph for this function:

◆ Output()

void NestedOutput::Output ( int  nest,
bool  span,
std::string  text 
)
inline

Definition at line 4818 of file mjsonrpc.cxx.

4819 {
4820 if (text.length() < 1)
4821 return;
4822
4823 NestedLine l;
4824 l.nest = nest;
4825 l.span = span;
4826 l.text = text;
4827 fLines.push_back(l);
4828 };
std::string text

◆ Print()

std::string NestedOutput::Print ( )
inline

Definition at line 4830 of file mjsonrpc.cxx.

4831 {
4832 std::vector<int> tablen;
4833 std::vector<std::string> tab;
4834 std::vector<std::string> tabx;
4835
4836 tablen.push_back(0);
4837 tab.push_back("");
4838 tabx.push_back("");
4839
4840 std::string xtab = "";
4841 int maxlen = 0;
4842 for (int n=0; ; n++) {
4843 int len = -1;
4844 for (unsigned i=0; i<fLines.size(); i++) {
4845 int nn = fLines[i].nest;
4846 bool pp = fLines[i].span;
4847 if (pp)
4848 continue;
4849 if (nn != n)
4850 continue;
4851 int l = fLines[i].text.length();
4852 if (l>len)
4853 len = l;
4854 }
4855 //printf("nest %d len %d\n", n, len);
4856 if (len < 0)
4857 break; // nothing with this nest level
4858 tablen.push_back(len);
4859 tab.push_back(indent(len, " ") + " | ");
4860 xtab += indent(len, " ") + " | ";
4861 tabx.push_back(xtab);
4862 maxlen += 3+len;
4863 }
4864
4865 std::string s;
4866 int nest = 0;
4867
4868 for (unsigned i=0; i<fLines.size(); i++) {
4869 int n = fLines[i].nest;
4870 bool p = fLines[i].span;
4871
4872 std::string pad;
4873
4874 if (!p) {
4875 int ipad = tablen[n+1] - fLines[i].text.length();
4876 pad = indent(ipad, " ");
4877 }
4878
4879 std::string hr = indent(maxlen-tabx[n].length(), "-");
4880
4881 if (n > nest)
4882 s += std::string(" | ") + fLines[i].text + pad;
4883 else if (n == nest) {
4884 s += "\n";
4885 if (n == 0 || n == 1)
4886 s += tabx[n] + hr + "\n";
4887 s += tabx[n] + fLines[i].text + pad;
4888 } else {
4889 s += "\n";
4890 if (n == 0 || n == 1)
4891 s += tabx[n] + hr + "\n";
4892 s += tabx[n] + fLines[i].text + pad;
4893 }
4894
4895 nest = n;
4896 }
4897
4898 return s;
4899 }
DWORD n[4]
Definition mana.cxx:247
INT i
Definition mdump.cxx:32
static std::string indent(int x, const char *p=" ")
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

Member Data Documentation

◆ fLines

std::vector<NestedLine> NestedOutput::fLines

Definition at line 4811 of file mjsonrpc.cxx.


The documentation for this class was generated from the following file: