~thopiekar/zypper/libzypp-manual-import

« back to all changes in this revision

Viewing changes to zypp/parser/RepoindexFileReader.cc

  • Committer: Thomas-Karl Pietrowski
  • Date: 2015-08-15 15:59:50 UTC
  • Revision ID: thopiekar@googlemail.com-20150815155950-j66qn38efmvn289t
syncing with "changes 15.13.0 (11)"  #9a0aca7e3a21d768491b141a8ae86ef0c3fbc227
* https://github.com/openSUSE/libzypp/commit/9a0aca7e3a21d768491b141a8ae86ef0c3fbc227

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#include "zypp/base/Logger.h"
17
17
#include "zypp/base/Gettext.h"
18
18
#include "zypp/base/InputStream.h"
 
19
#include "zypp/base/DefaultIntegral.h"
19
20
 
20
21
#include "zypp/Pathname.h"
21
22
 
48
49
        /** */
49
50
        void setVar( const std::string & key_r, const std::string & val_r )
50
51
        {
51
 
          MIL << "*** Inject " << key_r << " = " << val_r;
 
52
          //MIL << "*** Inject " << key_r << " = " << val_r;
52
53
          _vars[key_r] = replace( val_r );
53
 
          MIL << " (" << _vars[key_r] << ")" << endl;
 
54
          //MIL << " (" << _vars[key_r] << ")" << endl;
54
55
        }
55
56
 
56
57
        std::string replace( const std::string & val_r ) const
112
113
     */
113
114
    bool consumeNode( Reader & reader_r );
114
115
 
 
116
    DefaultIntegral<Date::Duration,2> _ttl;
 
117
 
115
118
  private:
116
119
    bool getAttrValue( const std::string & key_r, Reader & reader_r, std::string & value_r )
117
120
    {
162
165
      if ( reader_r->name() == "repoindex" )
163
166
      {
164
167
        while ( reader_r.nextNodeAttribute() )
165
 
          _replacer.setVar( reader_r->localName().asString(), reader_r->value().asString() );
 
168
        {
 
169
          const std::string & name( reader_r->localName().asString() );
 
170
          const std::string & value( reader_r->value().asString() );
 
171
          _replacer.setVar( name, value );
 
172
          // xpath: /repoindex@ttl
 
173
          if ( name == "ttl" )
 
174
            _ttl = str::strtonum<Date::Duration>(value);
 
175
        }
166
176
        return true;
167
177
      }
168
178
 
252
262
  //
253
263
  ///////////////////////////////////////////////////////////////////
254
264
 
255
 
  RepoindexFileReader::RepoindexFileReader(
256
 
      const Pathname & repoindex_file, const ProcessResource & callback)
257
 
    :
258
 
      _pimpl(new Impl(InputStream(repoindex_file), callback))
 
265
  RepoindexFileReader::RepoindexFileReader( const Pathname & repoindex_file, const ProcessResource & callback )
 
266
  : _pimpl(new Impl(InputStream(repoindex_file), callback))
259
267
  {}
260
268
 
261
 
  RepoindexFileReader::RepoindexFileReader(
262
 
       const InputStream &is, const ProcessResource & callback )
263
 
    : _pimpl(new Impl(is, callback))
 
269
  RepoindexFileReader::RepoindexFileReader( const InputStream &is, const ProcessResource & callback )
 
270
  : _pimpl(new Impl(is, callback))
264
271
  {}
265
272
 
266
273
  RepoindexFileReader::~RepoindexFileReader()
267
274
  {}
268
275
 
 
276
  Date::Duration RepoindexFileReader::ttl() const       { return _pimpl->_ttl; }
269
277
 
270
278
  } // ns parser
271
279
} // ns zypp