bool exampleReceiver( ProgressData::value_type v )
{
- WAR << "got ->" << v << endl;
- return( v <= 100 ); // Abort if ( v > 100
+ WAR << "got ->" << v << "%" << endl;
+ return true;
}
- class Example
- {
- public:
-
- Example( const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() )
- : _fnc( fnc_r )
- {}
-
- void SendTo( const ProgressData::ReceiverFnc & fnc_r )
- { _fnc = fnc_r; }
-
- public:
-
- void action()
- {
- ProgressData tics( 10 ); // Expect range 0 -> 10
- tics.name( "test ticks" ); // Some arbitrary name
- tics.sendTo( _fnc ); // Send reports to _fnc
- tics.toMin(); // start sending min (0)
-
- for ( int i = 0; i < 10; ++i )
- {
- if ( ! tics.set( i ) )
- return; // user requested abort
- }
-
- tics.toMax(); // take care 100% are reported on success
- }
-
- void action2()
- {
- ProgressData tics; // Just send 'still alive' messages
- tics.name( "test ticks" ); // Some arbitrary name
- tics.sendTo( _fnc ); // Send reports to _fnc
- tics.toMin(); // start sending min (0)
-
- for ( int i = 0; i < 10; ++i )
- {
- if ( ! tics.set( i ) )
- return; // user requested abort
- }
-
- tics.toMax(); //
- }
-
- private:
- ProgressData::ReceiverFnc _fnc;
- };
-
-
- //ProgressData makeProgressData( const InputStream & input_r )
- //{
- // ProgressData ret;
- // ret.name( input_r.name() );
- // if ( input_r.size() > 0 )
- // ret.range( input_r.size() );
- // return ret;
- //}
-
- void simpleParser( const InputStream & input_r,
- const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() )
- {
- ProgressData ticks( makeProgressData( input_r ) );
- ticks.sendTo( fnc_r );
- ticks.toMin(); // start sending min (0)
-
- iostr::EachLine line( input_r );
- for( ; line; line.next() )
- {
- /* process the line */
-
- if ( ! ticks.set( input_r.stream().tellg() ) )
- return; // user requested abort
- }
-
- ticks.toMax(); // take care 100% are reported on success
- }
/////////////////////////////////////////////////////////////////
//zypp::base::LogControl::instance().logfile( "log.restrict" );
INT << "===[START]==========================================" << endl;
- TagParser c;
- c.parse( "packages.gz", exampleReceiver );
-
- return ( 0 );
-
//Pathname p( "lmd/suse/setup/descr/packages" );
Pathname p( "packages" );
PackagesFileReader tp;
tp.parse( p );
}
- if ( 1 ) {
+ if ( 0 ) {
Pathname p( "packages" );
Measure x( p.basename() );
PackagesFileReader tp;
tp.parse( p );
}
- if ( 1 ) {
+ if ( 0 ) {
Pathname p( "packages.gz" );
Measure x( p.basename() );
PackagesFileReader tp;