{
ZYpp::Ptr z = getZYpp();
- Pathname dbpath = Pathname(getenv("PWD"));
-
- //RepositoryImpl_Ptr repositoryImpl(new CachedRepositoryImpl(dbpath));
- //RepositoryFactory factory;
- //Repository_Ref repository = factory.createFrom(repositoryImpl);
- //ResStore dbres = repository.resolvables();
-
- //MIL << dbres.size() << " resolvables" << endl;
+ z->initializeTarget("/");
+ ResStore res = z->target()->resolvables();
+ MIL << res.size() << " resolvables" << endl;
}
catch ( const Exception &e )
{
InputStream is((Pathname(dir)+"/1.ini"));
IniDict dict(is);
+
+ //MIL << dict["homedmacvicar"]["type"] << endl;
+
+ for ( IniDict::const_iterator it = dict.begin(); it != dict.end(); ++it )
+ {
+ MIL << (*it).first << endl;
+ }
}
test_suite*
*
*/
#include <iostream>
-//#include "zypp/base/Logger.h"
+#include "zypp/base/Logger.h"
#include <map>
#include <string>
#include "zypp/parser/IniDict.h"
void IniDict::consume( const std::string §ion, const std::string &key, const std::string &value )
{
- _dict[section][key] = value;
+ //MIL << endl;
+ PropertySet keys = _dict[section];
+ keys[key] = value;
+ _dict[section] = keys;
+ //MIL << this->size() << endl;
}
// CLASS NAME : IniDict
//
/**
+ * Parses a INI file and offers its structure as a
+ * dictionary.
*
*/
class IniDict : public IniParser
{
friend std::ostream & operator<<( std::ostream & str, const IniDict & obj );
public:
+ typedef std::map<std::string, std::string> PropertySet;
+ typedef std::map<std::string, PropertySet> ConfigSet;
+ typedef ConfigSet::const_iterator const_iterator;
+
+ const_iterator begin() const { return _dict.begin(); }
+ const_iterator end() const { return _dict.end(); }
/** Default ctor */
IniDict( const InputStream &is );
/** Dtor */
~IniDict();
+
public:
/** Called when a section is found. */
virtual void consume( const std::string §ion, const std::string &key, const std::string &value );
private:
- std::map<std::string, std::map<std::string, std::string> > _dict;
+ ConfigSet _dict;
};
///////////////////////////////////////////////////////////////////