Changeset 10339 for trunk/FACT++


Ignore:
Timestamp:
04/10/11 10:10:36 (13 years ago)
Author:
tbretz
Message:
Added server and service argument to PrintDescription.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/ServiceList.cc

    r10330 r10339  
    607607//!    ostream to which the output is send.
    608608//
    609 void ServiceList::PrintDescription(std::ostream &out) const
    610 {
     609int ServiceList::PrintDescription(std::ostream &out, const string &serv, const string &service) const
     610{
     611    int rc = 0;
    611612    for (ServiceMap::const_iterator i=fServiceList.begin(); i!=fServiceList.end(); i++)
    612613    {
    613614        const string &server = i->first;
     615
     616        if (!serv.empty() && server!=serv)
     617            continue;
     618
     619        out << "" << kRed << "----- " << server << " -----" << endl;
     620
    614621        const vector<string> &lst = i->second;
    615 
    616         out << "" << kRed << "----- " << server << " -----" << endl;
    617 
    618622        for (vector<string>::const_iterator s=lst.begin(); s!=lst.end(); s++)
    619623        {
     624            if (!service.empty() && *s!=service)
     625                continue;
     626
     627            rc++;
     628
    620629            out << " " << *s;
    621630
     
    655664        out << endl;
    656665    }
     666
     667    return rc;
    657668}
    658669
  • trunk/FACT++/src/ServiceList.h

    r10306 r10339  
    7777    void PrintServerList(std::ostream &out) const;
    7878    void PrintServiceList(std::ostream &out) const;
    79     void PrintDescription(std::ostream &out) const;
     79    int  PrintDescription(std::ostream &out, const std::string &serv="", const std::string &svc="") const;
    8080    void PrintServerList() const { PrintServerList(wout); }
    8181    void PrintServiceList() const { PrintServiceList(wout); }
    82     void PrintDescription() const { PrintDescription(wout); }
     82    int  PrintDescription(const std::string &serv="", const std::string &svc="") const { return PrintDescription(wout, serv, svc); }
    8383
    8484    static void DumpServiceList(std::ostream &out);
Note: See TracChangeset for help on using the changeset viewer.