FACT++  1.0
int DimServiceInfoList::PrintDescription ( std::ostream &  out,
bool  iscmd,
const std::string &  serv = "",
const std::string &  service = "" 
) 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.
iscmdtrue if all commands should be printed, false for services.
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
Returns
the number of descriptions found

Definition at line 516 of file DimServiceInfoList.cc.

References i, if(), kBlue, kGreen, kRed, kReset, kYellow, and t.

Referenced by DimServiceInfoListImp::PrintDescription(), and ~DimServiceInfoList().

517 {
518  int rc = 0;
519  for (ServiceList::const_iterator i=fServiceList.begin(); i!=fServiceList.end(); i++)
520  {
521  const string &server = i->first;
522 
523  if (!serv.empty() && server!=serv)
524  continue;
525 
526  out << kRed << "----- " << server << " -----" << endl;
527 
528  const TypeList &types = i->second.first;
529  const DescriptionList &descs = i->second.second;
530 
531  for (TypeList::const_iterator t=types.begin(); t!=types.end(); t++)
532  {
533  if (!service.empty() && t->first!=service)
534  continue;
535 
536  if (t->second.second!=iscmd)
537  continue;
538 
539  rc++;
540 
541  out << " " << t->first;
542 
543  // Check t->second->first for command or service
544  const string fmt = t->second.first;
545  if (!fmt.empty())
546  out << '[' << fmt << ']';
547 
548  const DescriptionList::const_iterator d = descs.find(t->first);
549  if (d==descs.end())
550  {
551  out << endl;
552  continue;
553  }
554 
555  const string comment = d->second.first;
556  const vector<Description> &v = d->second.second;
557 
558  for (vector<Description>::const_iterator j=v.begin(); j!=v.end(); j++)
559  out << " <" << j->name << ">";
560  out << endl;
561 
562  if (!comment.empty())
563  out << " " << comment << endl;
564 
565  for (vector<Description>::const_iterator j=v.begin(); j!=v.end(); j++)
566  {
567  out << " " << kGreen << j->name;
568  if (!j->comment.empty())
569  out << kReset << ": " << kBlue << j->comment;
570  if (!j->unit.empty())
571  out << kYellow << " [" << j->unit << "]";
572  out << endl;
573  }
574  }
575  out << endl;
576  }
577 
578  return rc;
579 }
std::map< const std::string, ServiceType > TypeList
ServiceList fServiceList
A map storing the service description to retrieve all informations.
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
std::map< const std::string, std::pair< std::string, std::vector< Description > > > DescriptionList
Definition: dis.c:69
Set color Blue.
Definition: WindowLog.h:20
TT t
Definition: test_client.c:26
if(extraDns) new Dns
Reset all attributes.
Definition: WindowLog.h:29

+ Here is the call graph for this function:

+ Here is the caller graph for this function: