Mailinglist Archive: zypp-commit (223 mails)

< Previous Next >
[zypp-commit] r10695 - in /trunk/libzypp: tests/zypp/ zypp/ zypp/parser/ zypp/repo/
  • From: jkupec@xxxxxxxxxxxxxxxx
  • Date: Wed, 30 Jul 2008 10:42:03 -0000
  • Message-id: <20080730104203.5FA372E38A@xxxxxxxxxxxxxxxx>
Author: jkupec
Date: Wed Jul 30 12:42:02 2008
New Revision: 10695

URL: http://svn.opensuse.org/viewcvs/zypp?rev=10695&view=rev
Log:
- Service -> ServiceInfo derived from RepoInfoBase

Added:
trunk/libzypp/zypp/ServiceInfo.cc (contents, props changed)
- copied, changed from r10693, trunk/libzypp/zypp/Service.cc
trunk/libzypp/zypp/ServiceInfo.h (contents, props changed)
- copied, changed from r10693, trunk/libzypp/zypp/Service.h
Removed:
trunk/libzypp/zypp/Service.cc
trunk/libzypp/zypp/Service.h
Modified:
trunk/libzypp/tests/zypp/RepoManager_test.cc
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/RepoManager.cc
trunk/libzypp/zypp/RepoManager.h
trunk/libzypp/zypp/parser/RepoindexFileReader.cc
trunk/libzypp/zypp/parser/ServiceFileReader.cc
trunk/libzypp/zypp/parser/ServiceFileReader.h
trunk/libzypp/zypp/repo/RepoInfoBase.cc
trunk/libzypp/zypp/repo/RepoInfoBase.h
trunk/libzypp/zypp/repo/RepoInfoBaseImpl.h

Modified: trunk/libzypp/tests/zypp/RepoManager_test.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/RepoManager_test.cc?rev=10695&r1=10694&r2=10695&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/RepoManager_test.cc (original)
+++ trunk/libzypp/tests/zypp/RepoManager_test.cc Wed Jul 30 12:42:02 2008
@@ -10,7 +10,7 @@
#include "zypp/PublicKey.h"
#include "zypp/TmpPath.h"
#include "zypp/PathInfo.h"
-#include "zypp/Service.h"
+#include "zypp/ServiceInfo.h"

#include "zypp/RepoManager.h"

@@ -40,7 +40,8 @@

RepoManager manager(opts);

- list<RepoInfo> repos = manager.knownRepositories();
+ list<RepoInfo> repos;
+ repos.insert(repos.end(), manager.repoBegin(), manager.repoEnd());
BOOST_CHECK_EQUAL(repos.size(), (unsigned) 4);

// now add a .repo file with 2 repositories in it
@@ -54,7 +55,8 @@
BOOST_CHECK( PathInfo(opts.knownReposPath + "/proprietary.repo_1").isExist()
);

// now there should be 6 repos
- repos = manager.knownRepositories();
+ repos.clear();
+ repos.insert(repos.end(), manager.repoBegin(), manager.repoEnd());
BOOST_CHECK_EQUAL(repos.size(), (unsigned) 6);

RepoInfo office_dup;
@@ -66,7 +68,8 @@
office.setAlias("office");
manager.removeRepository(office);
// now there should be 5 repos
- repos = manager.knownRepositories();
+ repos.clear();
+ repos.insert(repos.end(), manager.repoBegin(), manager.repoEnd());
BOOST_CHECK_EQUAL(repos.size(), (unsigned) 5);
// the file still contained one repo, so it should still exists
BOOST_CHECK( PathInfo(opts.knownReposPath + "/proprietary.repo_1").isExist()
);
@@ -80,15 +83,17 @@
BOOST_CHECK( ! PathInfo(opts.knownReposPath +
"/proprietary.repo_1").isExist() );

//test service
+
Url urlS;
urlS.setPathName(DATADIR.asString());
urlS.setScheme("dir");
- Service service("test",urlS);
+
+ ServiceInfo service("test", urlS);
service.setEnabled(true);

manager.addService(service);
manager.refreshServices();
- BOOST_CHECK_EQUAL(manager.repoSize(), (unsigned) 7); //+3 from repoindex
+ BOOST_CHECK_EQUAL(manager.repoSize(), (unsigned) 7); // +3 from repoindex

//simulate change of repoindex.xml
urlS.setPathName((DATADIR+"second").asString());
@@ -98,12 +103,12 @@

manager.modifyService(service.alias(), service);
manager.refreshServices();
- BOOST_CHECK_EQUAL(manager.repoSize(), (unsigned) 6); //-1 from new repoindex
+ BOOST_CHECK_EQUAL(manager.repoSize(), (unsigned) 6); // -1 from new repoindex

std::list<RepoInfo> infos;
manager.getRepositoriesInService("test",
insert_iterator<std::list<RepoInfo> >(infos,infos.begin()));
- BOOST_CHECK_EQUAL(infos.size(), 2); //2 from new repoindex
+ BOOST_CHECK_EQUAL(infos.size(), 2); // 2 from new repoindex


// let test cache creation

Modified: trunk/libzypp/zypp/CMakeLists.txt
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=10695&r1=10694&r2=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Wed Jul 30 12:42:02 2008
@@ -58,7 +58,7 @@
ResPool.cc
ResPoolProxy.cc
ResStatus.cc
- Service.cc
+ ServiceInfo.cc
Signature.cc
SrcPackage.cc
SysContent.cc
@@ -150,7 +150,7 @@
ResPoolProxy.h
ResStatus.h
ResTraits.h
- Service.h
+ ServiceInfo.h
Signature.h
SrcPackage.h
SysContent.h

Modified: trunk/libzypp/zypp/RepoManager.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=10695&r1=10694&r2=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/RepoManager.cc (original)
+++ trunk/libzypp/zypp/RepoManager.cc Wed Jul 30 12:42:02 2008
@@ -24,7 +24,7 @@
#include "zypp/base/Regex.h"
#include "zypp/PathInfo.h"
#include "zypp/TmpPath.h"
-#include "zypp/Service.h"
+#include "zypp/ServiceInfo.h"

#include "zypp/repo/RepoException.h"
#include "zypp/RepoManager.h"
@@ -261,19 +261,19 @@
return _nullimpl;
}

- void saveService( const Service& service ) const;
+ void saveService( const ServiceInfo & service ) const;

Pathname generateNonExistingName( const Pathname &dir,
const std::string &basefilename ) const;

- std::string generateFilename( const RepoInfo &info ) const;
- std::string generateFilename( const Service &info ) const;
+ std::string generateFilename( const RepoInfo & info ) const;
+ std::string generateFilename( const ServiceInfo & info ) const;

struct ServiceCollector
{
ServiceCollector(ServiceSet & services_) : services(services_) {}

- bool collect(Service service) { services.insert(service); return true; }
+ bool collect(ServiceInfo service) { services.insert(service); return
true; }

private:
ServiceSet & services;
@@ -1017,7 +1017,7 @@
return filename;
}

- std::string RepoManager::Impl::generateFilename( const Service &info ) const
+ std::string RepoManager::Impl::generateFilename( const ServiceInfo & info )
const
{
std::string filename = info.alias();
// replace slashes with underscores
@@ -1309,17 +1309,19 @@

void RepoManager::addService( const std::string & alias, const Url & url )
{
- addService( Service(alias, url) );
+ addService( ServiceInfo(alias, url) );
}

- void RepoManager::addService( const Service & service )
+ void RepoManager::addService( const ServiceInfo & service )
{
- //check if service isn't already exist
- if( _pimpl->services.find(service)!= _pimpl->services.end() )
+ // check if service already exists
+ if( _pimpl->services.find(service) != _pimpl->services.end() )
return; //FIXME ZYPP_THROW(RepoAlreadyExistsException(service.name()));

//this is need to save location to correct service
- const Service& savedService = *(_pimpl->services.insert( service )).first;
+ const ServiceInfo & savedService = *(_pimpl->services.insert( service
)).first;
+
+ cout << "adde service " << savedService.alias() << endl;

_pimpl->saveService( savedService );
}
@@ -1328,9 +1330,9 @@
{
MIL << "Going to delete repo " << alias << endl;

- const Service & service = getService( alias );
+ const ServiceInfo & service = getService( alias );

- Pathname location = service.location();
+ Pathname location = service.filepath();
if( location.empty() )
{
ZYPP_THROW(RepoException("Can't figure where the service is stored"));
@@ -1362,7 +1364,7 @@
for_(it, tmpSet.begin(), tmpSet.end())
{
if( it->alias() != alias )
- it->dumpServiceOn(file);
+ it->dumpAsIniOn(file);
}

MIL << alias << " sucessfully deleted from file " << location << endl;
@@ -1379,11 +1381,11 @@
}


- void RepoManager::removeService( const Service & service )
+ void RepoManager::removeService( const ServiceInfo & service )
{ removeService(service.alias()); }


- void RepoManager::Impl::saveService( const Service & service ) const
+ void RepoManager::Impl::saveService( const ServiceInfo & service ) const
{
filesystem::assert_dir( options.knownServicesPath );

@@ -1397,18 +1399,18 @@
ZYPP_THROW (Exception( "Can't open " + servfile.asString() ) );
}

- service.dumpServiceOn( file );
+ service.dumpAsIniOn( file );

- const_cast<Service&>(service).setLocation( servfile );
+ const_cast<ServiceInfo&>(service).setFilepath( servfile );
MIL << "done" << endl;
}

- Service RepoManager::getService( const std::string & alias ) const
+ ServiceInfo RepoManager::getService( const std::string & alias ) const
{
for_ (it, serviceBegin(), serviceEnd())
if ( it->alias() == alias )
return *it;
- return Service::noService;
+ return ServiceInfo::noService;
}

bool RepoManager::serviceEmpty() const { return _pimpl->services.empty(); }
@@ -1431,7 +1433,7 @@
void RepoManager::refreshServices()
{
//cannot user for_, because it uses const version
- for (std::set<Service>::iterator it = _pimpl->services.begin();
+ for (std::set<ServiceInfo>::iterator it = _pimpl->services.begin();
it != _pimpl->services.end(); ++it)
{
if ( !it->enabled() )
@@ -1442,7 +1444,7 @@
}
}

- void RepoManager::refreshService( const Service & service )
+ void RepoManager::refreshService( const ServiceInfo & service )
{
//! \todo add callbacks for apps (start, end, repo removed, repo added,
repo changed)

@@ -1470,13 +1472,11 @@
it->setService( service.alias() );
}

- // compare old and new repositories (hope not to much, if it change
+ // compare old and new repositories (hope not too much, if it change
// then construct set and use set operation on it)
-
std::list<RepoInfo> oldRepos;
getRepositoriesInService(service.alias(),
- insert_iterator<std::list<RepoInfo> >
- (oldRepos,oldRepos.begin()));
+ insert_iterator<std::list<RepoInfo> > (oldRepos, oldRepos.begin()));

// find old to remove
for_( it, oldRepos.begin(), oldRepos.end() )
@@ -1511,13 +1511,13 @@
}
}

- void RepoManager::modifyService(const std::string & oldAlias, const Service
& service)
+ void RepoManager::modifyService(const std::string & oldAlias, const
ServiceInfo & service)
{
MIL << "Going to modify service " << oldAlias << endl;

- const Service& oldService = getService(oldAlias);
+ const ServiceInfo & oldService = getService(oldAlias);

- Pathname location = oldService.location();
+ Pathname location = oldService.filepath();
if( location.empty() )
{
ZYPP_THROW(RepoException(
@@ -1537,10 +1537,10 @@
for_(it, tmpSet.begin(), tmpSet.end())
{
if( *it != oldAlias )
- it->dumpServiceOn(file);
+ it->dumpAsIniOn(file);
}

- service.dumpServiceOn(file);
+ service.dumpAsIniOn(file);

file.close();


Modified: trunk/libzypp/zypp/RepoManager.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.h?rev=10695&r1=10694&r2=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/RepoManager.h (original)
+++ trunk/libzypp/zypp/RepoManager.h Wed Jul 30 12:42:02 2008
@@ -29,7 +29,7 @@
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
- class Service; //predef
+ class ServiceInfo; //predef

/**
* Parses \a repo_file and returns a list of \ref RepoInfo objects
@@ -98,7 +98,7 @@
class Impl;

/** service typedefs */
- typedef std::set<Service> ServiceSet;
+ typedef std::set<ServiceInfo> ServiceSet;
typedef ServiceSet::const_iterator ServiceConstIterator;
typedef ServiceSet::size_type ServiceSizeType;

@@ -462,24 +462,24 @@
*
* \throws FIXME RepoAlreadyExistException and as reponame is service name
*/
- void addService( const Service & service );
+ void addService( const ServiceInfo & service );

/**
* Removes service specified by its name
*
* \param alias unique indientifier of the service to remove
*
- * \throws RepoException if service is not found or file with Service
cannot be deleted
+ * \throws RepoException if service is not found or file with ServiceInfo
cannot be deleted
* \throws Exception if file contain more services and rewrite file failed
*/
void removeService( const std::string & alias );

- void removeService( const Service & service );
+ void removeService( const ServiceInfo & service );

/**
* Gets true if no service is in RepoManager (so no one in specified
location)
*
- * \return true if any Service is in RepoManager
+ * \return true if any ServiceInfo is in RepoManager
*/
bool serviceEmpty() const;

@@ -492,7 +492,7 @@

/**
* Iterator to first service in internal storage.
- * \note Iterator is immutable, so you cannot change pointed Service
+ * \note Iterator is immutable, so you cannot change pointed ServiceInfo
* \return Iterator to first service
*/
ServiceConstIterator serviceBegin() const;
@@ -504,17 +504,17 @@
ServiceConstIterator serviceEnd() const;

/**
- * Finds Service by alias or return noService
+ * Finds ServiceInfo by alias or return noService
*
* \param alias unique identifier of service
- * \return information about Service
+ * \return information about service
*/
- Service getService( const std::string & alias ) const;
+ ServiceInfo getService( const std::string & alias ) const;

/**
* Refreshes all enabled services.
*
- * \see refreshService(Service)
+ * \see refreshService(ServiceInfo)
*/
void refreshServices();

@@ -524,7 +524,7 @@
* \param name service structure
* \throws MediaException If there's a problem downloading the repo index
file.
*/
- void refreshService( const Service & service );
+ void refreshService( const ServiceInfo & service );

/**
* Modifies service file (rewrites it with new values) and underlying
@@ -532,17 +532,17 @@
*
* Modifications of a service can lead to rewrite of all .repo files of
* contained repositories. Particularily, disabling a service (changing
- * Service::enabled() from true to false) will disable all contained
+ * ServiceInfo::enabled() from true to false) will disable all contained
* repositories. Renaming of a service will modify the "service" key
* of all contained repositories.
*
* \param oldAlias Old alias of the service
- * \param service Service object containing new data
+ * \param service ServiceInfo object containing new data
*
* \throws RepoException if sservice with oldAlias is not known
* \throws Exception if have problems with files
*/
- void modifyService(const std::string & oldAlias, const Service & service);
+ void modifyService(const std::string & oldAlias, const ServiceInfo &
service);

private:
/**

Copied: trunk/libzypp/zypp/ServiceInfo.cc (from r10693,
trunk/libzypp/zypp/Service.cc)
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ServiceInfo.cc?p2=trunk/libzypp/zypp/ServiceInfo.cc&p1=trunk/libzypp/zypp/Service.cc&r1=10693&r2=10695&rev=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/Service.cc (original)
+++ trunk/libzypp/zypp/ServiceInfo.cc Wed Jul 30 12:42:02 2008
@@ -6,18 +6,17 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zypp/Service.cc
+/** \file zypp/ServiceInfo.cc
*
*/
-#include "zypp/Service.h"
-
#include <ostream>
+#include <iostream>

-#include "zypp/base/DefaultIntegral.h"
-#include "zypp/Url.h"
#include "zypp/RepoInfo.h"
-#include "zypp/media/MediaManager.h"
#include "zypp/parser/RepoindexFileReader.h"
+#include "zypp/repo/RepoInfoBaseImpl.h"
+
+#include "zypp/ServiceInfo.h"

using namespace std;

@@ -29,26 +28,26 @@
struct RepoInfoCollector
{
vector<RepoInfo> repos;
- bool collect(const RepoInfo& info)
+ bool collect(const RepoInfo & info)
{
repos.push_back(info);
return true;
}
};

-
- class Service::Impl
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ServiceInfo::Impl
+ //
+ struct ServiceInfo::Impl : public repo::RepoInfoBase::Impl
{
public:
- string alias;
- string name;
Url url;
- DefaultIntegral<bool,false> enabled;
- Pathname loc;

- Impl() {}
- Impl(const string & alias_) : alias(alias_) {}
- Impl(const string & alias_, const Url& url_) : alias(alias_), url(url_) {}
+ public:
+ Impl() : repo::RepoInfoBase::Impl() {}
+
+ Impl(const Url & url_) : url(url_) {}

private:
friend Impl * rwcowClone<Impl>( const Impl * rhs );
@@ -57,52 +56,39 @@
Impl * clone() const
{ return new Impl( *this ); }
};
+ ///////////////////////////////////////////////////////////////////


- const Service Service::noService;
-
- Service::Service() : _pimpl( new Impl() ) {}
-
- Service::Service(const string & alias) : _pimpl( new Impl(alias) ) {}
- Service::Service(const string & alias, const Url & url)
- : _pimpl( new Impl(alias, url) ) {}
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ServiceInfo::Impl
+ //
+ ///////////////////////////////////////////////////////////////////

+ const ServiceInfo ServiceInfo::noService;
+
+ ServiceInfo::ServiceInfo() : _pimpl( new Impl() ) {}

- string Service::alias() const { return _pimpl->alias; }
- void Service::setAlias( const std::string & alias ) { _pimpl->alias = alias;
}
+ ServiceInfo::ServiceInfo(const string & alias)
+ : repo::RepoInfoBase(alias), _pimpl( new Impl() )
+ {}

- string Service::name() const
- { if (_pimpl->name.empty()) return _pimpl->alias; return _pimpl->name; }
- void Service::setName( const std::string& name ) { _pimpl->name = name; }
+ ServiceInfo::ServiceInfo(const string & alias, const Url & url)
+ : repo::RepoInfoBase(alias), _pimpl( new Impl(url) )
+ {}

- Url Service::url() const { return _pimpl->url; }
- void Service::setUrl( const Url& url ) { _pimpl->url = url; }
+ Url ServiceInfo::url() const { return _pimpl->url; }
+ void ServiceInfo::setUrl( const Url& url ) { _pimpl->url = url; }

- bool Service::enabled() const { return _pimpl->enabled; }
- void Service::setEnabled( const bool enabled ) { _pimpl->enabled = enabled;
}
-
- void Service::dumpServiceOn( std::ostream& str ) const
- {
- str << "[" << alias() << "]" << endl;
- str << "name = " << name() << endl;
- str << "url = " << url() << endl;
- str << "enabled = " << ( enabled() ? "1" : "0") << endl;
- }
-
- Pathname Service::location() const
- {
- return _pimpl->loc;
- }

- void Service::setLocation( const Pathname& location )
+ std::ostream & ServiceInfo::dumpAsIniOn( std::ostream & str ) const
{
- _pimpl->loc = location;
+ return RepoInfoBase::dumpAsIniOn(str) << "url = " << url() << endl;
}

- std::ostream & operator<<( std::ostream& str, const Service &obj )
+ std::ostream & operator<<( std::ostream& str, const ServiceInfo &obj )
{
- obj.dumpServiceOn(str);
- return str;
+ return obj.dumpAsIniOn(str);
}



Copied: trunk/libzypp/zypp/ServiceInfo.h (from r10693,
trunk/libzypp/zypp/Service.h)
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ServiceInfo.h?p2=trunk/libzypp/zypp/ServiceInfo.h&p1=trunk/libzypp/zypp/Service.h&r1=10693&r2=10695&rev=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/Service.h (original)
+++ trunk/libzypp/zypp/ServiceInfo.h Wed Jul 30 12:42:02 2008
@@ -6,16 +6,17 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zypp/Service.h
+/** \file zypp/ServiceInfo.h
*
-*/
+ */
#ifndef ZYPP_SERVICE_H
#define ZYPP_SERVICE_H

#include <string>

#include "zypp/Url.h"
-#include "zypp/Pathname.h"
+
+#include "zypp/repo/RepoInfoBase.h"


///////////////////////////////////////////////////////////////////
@@ -24,48 +25,35 @@

///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : Service
+ // CLASS NAME : ServiceInfo
//
/** */
- class Service
+ class ServiceInfo : public repo::RepoInfoBase
{
public:
/** Default ctor creates \ref noService.*/
- Service();
+ ServiceInfo();

/**
- * Service with this name.
+ * Creates ServiceInfo with specified alias.
*
- * \param name unique name of service
+ * \param alias unique short name of service
*/
- Service( const std::string& name );
+ ServiceInfo( const std::string & alias );

/**
- * Service with name and its URL
+ * ServiceInfo with alias and its URL
*
- * \param name unique name of service
+ * \param alias unique shortname of service
* \param url url to service
*/
- Service( const std::string& name, const Url& url );
+ ServiceInfo( const std::string & alias, const Url& url );

public:
- /** Represents no \ref Service. */
- static const Service noService;
+ /** Represents an empty service. */
+ static const ServiceInfo noService;

public:
- /**
- * Gets unique alias.
- *
- * \return alias as string
- */
- std::string alias() const;
-
- /**
- * Gets unique name
- *
- * \return name of service
- */
- std::string name() const;

/**
* Gets url to service
@@ -74,42 +62,8 @@
*/
Url url() const;

- /**
- * Returns 'enabled' flag of the services.
- *
- * Disabled services imply disabled repositories of these services
- * and they won't be refreshed by \ref RepoManager::refreshServices().
- *
- * Enabled services will be refreshed by \ref
RepoManager::refreshServices().
- */
- bool enabled() const;
-
- /**
- * Gets from which file is this service loaded or saved.
- *
- * \note this is empty for newly created file until it is saved
- * \return path to file storing this service
- */
- Pathname location() const;
-
public:

- /**
- * Sets alias for this service
- *
- * \param alias new alias of this service
- */
- void setAlias( const std::string & alias );
-
- /**
- * Sets file where this service is stored.
- *
- * \warning don't use this function, only parses and serializer can
- * use it
- * \param location path where service is stored
- */
- void setLocation( const Pathname& location );
-
/**
* Sets url for this service
*
@@ -117,26 +71,13 @@
*/
void setUrl( const Url& url );

- /**
- * Sets name for this service
- *
- * \param name new name of this service
- */
- void setName( const std::string& name );
-
- /**
- * Sets enabled status of the services.
- * \param enabled The desired status.
- */
- void setEnabled( const bool enabled );
-
public:
/**
- * Writes Service to stream in ".service" format
+ * Writes ServiceInfo to stream in ".service" format
*
* \param str stream where serialized version service is written
*/
- void dumpServiceOn( std::ostream & str ) const;
+ virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;

class Impl;

@@ -145,20 +86,20 @@
};
///////////////////////////////////////////////////////////////////

- /** \relates Service Stream output */
- std::ostream & operator<<( std::ostream & str, const Service & obj );
+ /** \relates ServiceInfo Stream output */
+ std::ostream & operator<<( std::ostream & str, const ServiceInfo & obj );

- /** \relates Service */
- inline bool operator==( const Service & lhs, const Service & rhs )
- { return lhs.name() == rhs.name(); }
-
- /** \relates Service */
- inline bool operator!=( const Service & lhs, const Service & rhs )
- { return lhs.name() != rhs.name(); }
-
- /** \relates Service */
- inline bool operator<( const Service & lhs, const Service & rhs )
- { return lhs.name() < rhs.name(); }
+ /** \relates ServiceInfo */
+ inline bool operator==( const ServiceInfo & lhs, const ServiceInfo & rhs )
+ { return lhs.alias() == rhs.alias(); }
+
+ /** \relates ServiceInfo */
+ inline bool operator!=( const ServiceInfo & lhs, const ServiceInfo & rhs )
+ { return lhs.alias() != rhs.alias(); }
+
+ /** \relates ServiceInfo */
+ inline bool operator<( const ServiceInfo & lhs, const ServiceInfo & rhs )
+ { return lhs.alias() < rhs.alias(); }

/////////////////////////////////////////////////////////////////
} // namespace zypp

Modified: trunk/libzypp/zypp/parser/RepoindexFileReader.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/RepoindexFileReader.cc?rev=10695&r1=10694&r2=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/RepoindexFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/RepoindexFileReader.cc Wed Jul 30 12:42:02 2008
@@ -100,9 +100,9 @@
info.setAlias(reader_r->getAttribute("alias").asString());
info.setType(repo::RepoType::RPMMD_e); //TODO hardwired rpmmd???
XmlString s = reader_r->getAttribute("name");
- if (s.get()) //name setted so also set it
+ if (s.get()) // name available so store it
info.setName(s.asString());
- //ignore rest
+ // ignore the rest
_callback(info);
return true;
}

Modified: trunk/libzypp/zypp/parser/ServiceFileReader.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/ServiceFileReader.cc?rev=10695&r1=10694&r2=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/ServiceFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/ServiceFileReader.cc Wed Jul 30 12:42:02 2008
@@ -17,7 +17,7 @@

#include "zypp/parser/IniDict.h"
#include "zypp/parser/ServiceFileReader.h"
-#include "zypp/Service.h"
+#include "zypp/ServiceInfo.h"

using std::endl;
using zypp::parser::IniDict;
@@ -36,8 +36,8 @@
const ServiceFileReader::ProcessService & callback );
};

- void ServiceFileReader::Impl::parseServices( const Pathname &file,
- const ServiceFileReader::ProcessService
&callback/*,
+ void ServiceFileReader::Impl::parseServices( const Pathname & file,
+ const ServiceFileReader::ProcessService &
callback/*,
const ProgressData::ReceiverFnc &progress*/ )
{
InputStream is(file);
@@ -53,7 +53,7 @@
{
MIL << (*its) << endl;

- Service service(*its);
+ ServiceInfo service(*its);

for ( IniDict::entry_const_iterator it = dict.entriesBegin(*its);
it != dict.entriesEnd(*its);
@@ -66,12 +66,14 @@
service.setUrl( Url (it->second) );
else if ( it->first == "enabled" )
service.setEnabled( str::strToTrue( it->second ) );
+ else if ( it->first == "autorefresh" )
+ service.setAutorefresh( str::strToTrue( it->second ) );
else
ERR << "Unknown attribute " << it->second << " ignored" << endl;
}

- MIL << "Linking Service with file " << file << endl;
- service.setLocation(file);
+ MIL << "Linking ServiceInfo with file " << file << endl;
+ service.setFilepath(file);

// add it to the list.
if ( !callback(service) )

Modified: trunk/libzypp/zypp/parser/ServiceFileReader.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/ServiceFileReader.h?rev=10695&r1=10694&r2=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/ServiceFileReader.h (original)
+++ trunk/libzypp/zypp/parser/ServiceFileReader.h Wed Jul 30 12:42:02 2008
@@ -22,7 +22,7 @@
namespace zypp
{ /////////////////////////////////////////////////////////////////

- class Service;
+ class ServiceInfo;
///////////////////////////////////////////////////////////////////
namespace parser
{ /////////////////////////////////////////////////////////////////
@@ -30,7 +30,7 @@
/**
* \short Read service data from a .service file
*
- * After each service is read, a \ref Service is prepared and \ref
_callback
+ * After each service is read, a \ref ServiceInfo is prepared and \ref
_callback
* is called with the object passed in.
*
* The \ref _callback is provided on construction.
@@ -47,12 +47,12 @@

/**
* Callback definition.
- * First parameter is a \ref Service object with the resource.
+ * First parameter is a \ref ServiceInfo object with the resource.
*
* Return false from the callback to get a \ref AbortRequestException
* to be thrown and the processing to be cancelled.
*/
- typedef function< bool( const Service & )> ProcessService;
+ typedef function< bool( const ServiceInfo & )> ProcessService;

/** Implementation */
class Impl;

Modified: trunk/libzypp/zypp/repo/RepoInfoBase.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoInfoBase.cc?rev=10695&r1=10694&r2=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepoInfoBase.cc (original)
+++ trunk/libzypp/zypp/repo/RepoInfoBase.cc Wed Jul 30 12:42:02 2008
@@ -25,6 +25,11 @@
namespace repo
{ /////////////////////////////////////////////////////////////////

+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : RepoInfoBase::Impl
+ //
+ ///////////////////////////////////////////////////////////////////

/** \relates RepoInfo::Impl Stream output */
inline std::ostream & operator<<( std::ostream & str, const
RepoInfoBase::Impl & obj )
@@ -32,6 +37,22 @@
return str << "RepoInfo::Impl";
}

+ void RepoInfoBase::Impl::setAlias(const string & alias_)
+ {
+ this->alias = alias_;
+ // replace slashes with underscores
+ std::string fnd="/";
+ std::string rep="_";
+ std::string escaped_alias = alias_;
+ size_t pos = escaped_alias.find(fnd);
+ while (pos != string::npos)
+ {
+ escaped_alias.replace(pos, fnd.length(), rep);
+ pos = escaped_alias.find(fnd, pos+rep.length());
+ }
+ this->escaped_alias = escaped_alias;
+ }
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : RepoInfoBase
@@ -40,11 +61,20 @@

///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : RepoInfo::RepoInfo
+ // METHOD NAME : RepoInfoBase::RepoInfoBase
// METHOD TYPE : Ctor
//
RepoInfoBase::RepoInfoBase()
- : _pimpl( new Impl() )
+ : _pimpl( new Impl() )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : RepoInfoBase::RepoInfoBase
+ // METHOD TYPE : Ctor
+ //
+ RepoInfoBase::RepoInfoBase(const string & alias)
+ : _pimpl( new Impl(alias) )
{}

///////////////////////////////////////////////////////////////////
@@ -69,18 +99,7 @@

RepoInfoBase & RepoInfoBase::setAlias( const std::string &alias )
{
- _pimpl->alias = alias;
- // replace slashes with underscores
- std::string fnd="/";
- std::string rep="_";
- std::string escaped_alias = alias;
- size_t pos = escaped_alias.find(fnd);
- while(pos!=string::npos)
- {
- escaped_alias.replace(pos,fnd.length(),rep);
- pos = escaped_alias.find(fnd,pos+rep.length());
- }
- _pimpl->escaped_alias = escaped_alias;
+ _pimpl->setAlias(alias);
return *this;
}

@@ -151,6 +170,7 @@
{
return obj.dumpOn(str);
}
+ ///////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////
} // namespace repo

Modified: trunk/libzypp/zypp/repo/RepoInfoBase.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoInfoBase.h?rev=10695&r1=10694&r2=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepoInfoBase.h (original)
+++ trunk/libzypp/zypp/repo/RepoInfoBase.h Wed Jul 30 12:42:02 2008
@@ -40,6 +40,7 @@

public:
RepoInfoBase();
+ RepoInfoBase(const std::string & alias);
~RepoInfoBase();

/**

Modified: trunk/libzypp/zypp/repo/RepoInfoBaseImpl.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoInfoBaseImpl.h?rev=10695&r1=10694&r2=10695&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepoInfoBaseImpl.h (original)
+++ trunk/libzypp/zypp/repo/RepoInfoBaseImpl.h Wed Jul 30 12:42:02 2008
@@ -35,6 +35,11 @@
, autorefresh (indeterminate)
{}

+ Impl(const std::string & alias_)
+ : enabled(indeterminate)
+ , autorefresh(indeterminate)
+ { setAlias(alias_); }
+
~Impl()
{}

@@ -47,6 +52,8 @@
Pathname filepath;
public:

+ void setAlias(const std::string & alias_);
+
private:
friend Impl * rwcowClone<Impl>( const Impl * rhs );
/** clone for RWCOW_pointer */

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages