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

Member Function Documentation

◆ Clear()

void NestedOutput::Clear ( )
inline

Definition at line 4912 of file mjsonrpc.cxx.

4913 {
4914 fLines.clear();
4915 }
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 4917 of file mjsonrpc.cxx.

4918 {
4919 if (text.length() < 1)
4920 return;
4921
4922 NestedLine l;
4923 l.nest = nest;
4924 l.span = span;
4925 l.text = text;
4926 fLines.push_back(l);
4927 };
std::string text
Here is the caller graph for this function:

◆ Print()

std::string NestedOutput::Print ( )
inline

Definition at line 4929 of file mjsonrpc.cxx.

4930 {
4931 std::vector<int> tablen;
4932 std::vector<std::string> tab;
4933 std::vector<std::string> tabx;
4934
4935 tablen.push_back(0);
4936 tab.push_back("");
4937 tabx.push_back("");
4938
4939 std::string xtab = "";
4940 int maxlen = 0;
4941 for (int n=0; ; n++) {
4942 int len = -1;
4943 for (unsigned i=0; i<fLines.size(); i++) {
4944 int nn = fLines[i].nest;
4945 bool pp = fLines[i].span;
4946 if (pp)
4947 continue;
4948 if (nn != n)
4949 continue;
4950 int l = fLines[i].text.length();
4951 if (l>len)
4952 len = l;
4953 }
4954 //printf("nest %d len %d\n", n, len);
4955 if (len < 0)
4956 break; // nothing with this nest level
4957 tablen.push_back(len);
4958 tab.push_back(indent(len, " ") + " | ");
4959 xtab += indent(len, " ") + " | ";
4960 tabx.push_back(xtab);
4961 maxlen += 3+len;
4962 }
4963
4964 std::string s;
4965 int nest = 0;
4966
4967 for (unsigned i=0; i<fLines.size(); i++) {
4968 int n = fLines[i].nest;
4969 bool p = fLines[i].span;
4970
4971 std::string pad;
4972
4973 if (!p) {
4974 int ipad = tablen[n+1] - fLines[i].text.length();
4975 pad = indent(ipad, " ");
4976 }
4977
4978 std::string hr = indent(maxlen-tabx[n].length(), "-");
4979
4980 if (n > nest)
4981 s += std::string(" | ") + fLines[i].text + pad;
4982 else if (n == nest) {
4983 s += "\n";
4984 if (n == 0 || n == 1)
4985 s += tabx[n] + hr + "\n";
4986 s += tabx[n] + fLines[i].text + pad;
4987 } else {
4988 s += "\n";
4989 if (n == 0 || n == 1)
4990 s += tabx[n] + hr + "\n";
4991 s += tabx[n] + fLines[i].text + pad;
4992 }
4993
4994 nest = n;
4995 }
4996
4997 return s;
4998 }
DWORD n[4]
Definition mana.cxx:247
INT i
Definition mdump.cxx:32
static std::string indent(int x, const char *p=" ")
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fLines

std::vector<NestedLine> NestedOutput::fLines

Definition at line 4910 of file mjsonrpc.cxx.


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