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

Member Function Documentation

◆ Clear()

void NestedOutput::Clear ( )
inline

Definition at line 4826 of file mjsonrpc.cxx.

4827 {
4828 fLines.clear();
4829 }
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 4831 of file mjsonrpc.cxx.

4832 {
4833 if (text.length() < 1)
4834 return;
4835
4836 NestedLine l;
4837 l.nest = nest;
4838 l.span = span;
4839 l.text = text;
4840 fLines.push_back(l);
4841 };
std::string text

◆ Print()

std::string NestedOutput::Print ( )
inline

Definition at line 4843 of file mjsonrpc.cxx.

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


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