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

Member Function Documentation

◆ Clear()

void NestedOutput::Clear ( )
inline

Definition at line 4816 of file mjsonrpc.cxx.

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

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

◆ Print()

std::string NestedOutput::Print ( )
inline

Definition at line 4833 of file mjsonrpc.cxx.

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


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