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 4809 of file mjsonrpc.cxx.

Member Function Documentation

◆ Clear()

void NestedOutput::Clear ( )
inline

Definition at line 4814 of file mjsonrpc.cxx.

4815 {
4816 fLines.clear();
4817 }
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 4819 of file mjsonrpc.cxx.

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

◆ Print()

std::string NestedOutput::Print ( )
inline

Definition at line 4831 of file mjsonrpc.cxx.

4832 {
4833 std::vector<int> tablen;
4834 std::vector<std::string> tab;
4835 std::vector<std::string> tabx;
4836
4837 tablen.push_back(0);
4838 tab.push_back("");
4839 tabx.push_back("");
4840
4841 std::string xtab = "";
4842 int maxlen = 0;
4843 for (int n=0; ; n++) {
4844 int len = -1;
4845 for (unsigned i=0; i<fLines.size(); i++) {
4846 int nn = fLines[i].nest;
4847 bool pp = fLines[i].span;
4848 if (pp)
4849 continue;
4850 if (nn != n)
4851 continue;
4852 int l = fLines[i].text.length();
4853 if (l>len)
4854 len = l;
4855 }
4856 //printf("nest %d len %d\n", n, len);
4857 if (len < 0)
4858 break; // nothing with this nest level
4859 tablen.push_back(len);
4860 tab.push_back(indent(len, " ") + " | ");
4861 xtab += indent(len, " ") + " | ";
4862 tabx.push_back(xtab);
4863 maxlen += 3+len;
4864 }
4865
4866 std::string s;
4867 int nest = 0;
4868
4869 for (unsigned i=0; i<fLines.size(); i++) {
4870 int n = fLines[i].nest;
4871 bool p = fLines[i].span;
4872
4873 std::string pad;
4874
4875 if (!p) {
4876 int ipad = tablen[n+1] - fLines[i].text.length();
4877 pad = indent(ipad, " ");
4878 }
4879
4880 std::string hr = indent(maxlen-tabx[n].length(), "-");
4881
4882 if (n > nest)
4883 s += std::string(" | ") + fLines[i].text + pad;
4884 else if (n == nest) {
4885 s += "\n";
4886 if (n == 0 || n == 1)
4887 s += tabx[n] + hr + "\n";
4888 s += tabx[n] + fLines[i].text + pad;
4889 } else {
4890 s += "\n";
4891 if (n == 0 || n == 1)
4892 s += tabx[n] + hr + "\n";
4893 s += tabx[n] + fLines[i].text + pad;
4894 }
4895
4896 nest = n;
4897 }
4898
4899 return s;
4900 }
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 4812 of file mjsonrpc.cxx.


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