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

Member Function Documentation

◆ Clear()

void NestedOutput::Clear ( )
inline

Definition at line 4918 of file mjsonrpc.cxx.

4919 {
4920 fLines.clear();
4921 }
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 4923 of file mjsonrpc.cxx.

4924 {
4925 if (text.length() < 1)
4926 return;
4927
4928 NestedLine l;
4929 l.nest = nest;
4930 l.span = span;
4931 l.text = text;
4932 fLines.push_back(l);
4933 };
std::string text
Here is the caller graph for this function:

◆ Print()

std::string NestedOutput::Print ( )
inline

Definition at line 4935 of file mjsonrpc.cxx.

4936 {
4937 std::vector<int> tablen;
4938 std::vector<std::string> tab;
4939 std::vector<std::string> tabx;
4940
4941 tablen.push_back(0);
4942 tab.push_back("");
4943 tabx.push_back("");
4944
4945 std::string xtab = "";
4946 int maxlen = 0;
4947 for (int n=0; ; n++) {
4948 int len = -1;
4949 for (unsigned i=0; i<fLines.size(); i++) {
4950 int nn = fLines[i].nest;
4951 bool pp = fLines[i].span;
4952 if (pp)
4953 continue;
4954 if (nn != n)
4955 continue;
4956 int l = fLines[i].text.length();
4957 if (l>len)
4958 len = l;
4959 }
4960 //printf("nest %d len %d\n", n, len);
4961 if (len < 0)
4962 break; // nothing with this nest level
4963 tablen.push_back(len);
4964 tab.push_back(indent(len, " ") + " | ");
4965 xtab += indent(len, " ") + " | ";
4966 tabx.push_back(xtab);
4967 maxlen += 3+len;
4968 }
4969
4970 std::string s;
4971 int nest = 0;
4972
4973 for (unsigned i=0; i<fLines.size(); i++) {
4974 int n = fLines[i].nest;
4975 bool p = fLines[i].span;
4976
4977 std::string pad;
4978
4979 if (!p) {
4980 int ipad = tablen[n+1] - fLines[i].text.length();
4981 pad = indent(ipad, " ");
4982 }
4983
4984 std::string hr = indent(maxlen-tabx[n].length(), "-");
4985
4986 if (n > nest)
4987 s += std::string(" | ") + fLines[i].text + pad;
4988 else if (n == nest) {
4989 s += "\n";
4990 if (n == 0 || n == 1)
4991 s += tabx[n] + hr + "\n";
4992 s += tabx[n] + fLines[i].text + pad;
4993 } else {
4994 s += "\n";
4995 if (n == 0 || n == 1)
4996 s += tabx[n] + hr + "\n";
4997 s += tabx[n] + fLines[i].text + pad;
4998 }
4999
5000 nest = n;
5001 }
5002
5003 return s;
5004 }
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 4916 of file mjsonrpc.cxx.


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