FACT++  1.0
int ServiceList::PrintDescription ( std::ostream &  out,
const std::string &  serv = "",
const std::string &  svc = "" 
) const

Print the full available documentation (description) of all available services or comments to the the given stream.

Parameters
outostream to which the output is send.
servif a server is given, only the information for this server is printed
serviceif a service is given, only information for this service is printed

Definition at line 615 of file ServiceList.cc.

References fDescriptionList, fDescriptionMap, fServiceList, GetFormat(), i, if(), kBlue, kGreen, kRed, kReset, and kYellow.

Referenced by end().

616 {
617  int rc = 0;
618  for (ServiceMap::const_iterator i=fServiceList.begin(); i!=fServiceList.end(); i++)
619  {
620  const string &server = i->first;
621 
622  if (!serv.empty() && server!=serv)
623  continue;
624 
625  out << kRed << "----- " << server << " -----" << endl;
626 
627  const vector<string> &lst = i->second;
628  for (vector<string>::const_iterator s=lst.begin(); s!=lst.end(); s++)
629  {
630  if (!service.empty() && *s!=service)
631  continue;
632 
633  rc++;
634 
635  out << " " << *s;
636 
637  const string fmt = GetFormat(server, *s);
638  if (!fmt.empty())
639  out << '[' << fmt << ']';
640 
641  const string svc = server + '/' + *s;
642 
643  const DescriptionMap::const_iterator v = fDescriptionList.find(svc);
644  if (v==fDescriptionList.end())
645  {
646  out << endl;
647  continue;
648  }
649 
650  for (vector<Description>::const_iterator j=v->second.begin();
651  j!=v->second.end(); j++)
652  out << " <" << j->name << ">";
653  out << endl;
654 
655  const StringMap::const_iterator d = fDescriptionMap.find(svc);
656  if (d!=fDescriptionMap.end() && !d->second.empty())
657  out << " " << d->second << endl;
658 
659  for (vector<Description>::const_iterator j=v->second.begin();
660  j!=v->second.end(); j++)
661  {
662  out << " " << kGreen << j->name;
663  if (!j->comment.empty())
664  out << kReset << ": " << kBlue << j->comment;
665  if (!j->unit.empty())
666  out << kYellow << " [" << j->unit << "]";
667  out << endl;
668  }
669  }
670  out << endl;
671  }
672 
673  return rc;
674 }
int i
Definition: db_dim_client.c:21
Set color Green.
Definition: WindowLog.h:18
Set color Yellow.
Definition: WindowLog.h:19
Set color Red.
Definition: WindowLog.h:17
ServiceMap fServiceList
A map storing server names and a DimInfo for their SERVICE_LIST.
Definition: ServiceList.h:30
Definition: dis.c:69
std::string GetFormat(const std::string &server, const std::string &name) const
Definition: ServiceList.cc:388
Set color Blue.
Definition: WindowLog.h:20
DescriptionMap fDescriptionList
A map storing all descriptions for commands and services.
Definition: ServiceList.h:33
if(extraDns) new Dns
Reset all attributes.
Definition: WindowLog.h:29
StringMap fDescriptionMap
A map storing all commands and their format strings.
Definition: ServiceList.h:32

+ Here is the call graph for this function:

+ Here is the caller graph for this function: