Namespace KiGfx->KIGFX.
template<> -> template <> Some more reformatting according to uncrustify results.
This commit is contained in:
@@ -7,39 +7,42 @@ using namespace std;
|
||||
|
||||
typedef COROUTINE<int, int> MyCoroutine;
|
||||
|
||||
class MyClass {
|
||||
class MyClass
|
||||
{
|
||||
public:
|
||||
int CountTo( int n )
|
||||
{
|
||||
printf( "%s: Coroutine says hi. I will count from 1 to %d and yield each value.\n",
|
||||
__FUNCTION__,
|
||||
n );
|
||||
|
||||
public:
|
||||
int CountTo(int n)
|
||||
for( int i = 1; i <= n; i++ )
|
||||
{
|
||||
printf("%s: Coroutine says hi. I will count from 1 to %d and yield each value.\n", __FUNCTION__, n);
|
||||
for(int i = 1; i <= n; i++)
|
||||
{
|
||||
printf("%s: Yielding %d\n", __FUNCTION__, i);
|
||||
cofunc.Yield(i);
|
||||
}
|
||||
printf( "%s: Yielding %d\n", __FUNCTION__, i );
|
||||
cofunc.Yield( i );
|
||||
}
|
||||
}
|
||||
|
||||
void Run()
|
||||
{
|
||||
cofunc = MyCoroutine( this, &MyClass::CountTo );
|
||||
printf( "%s: Calling coroutine that will count from 1 to 5.\n", __FUNCTION__ );
|
||||
cofunc.Call( 5 );
|
||||
|
||||
while( cofunc.Running() )
|
||||
{
|
||||
printf( "%s: Got value: %d\n", __FUNCTION__, cofunc.ReturnValue() );
|
||||
cofunc.Resume();
|
||||
}
|
||||
|
||||
void Run()
|
||||
{
|
||||
cofunc = MyCoroutine (this, &MyClass::CountTo);
|
||||
printf("%s: Calling coroutine that will count from 1 to 5.\n", __FUNCTION__);
|
||||
cofunc.Call(5);
|
||||
while (cofunc.Running())
|
||||
{
|
||||
printf("%s: Got value: %d\n", __FUNCTION__, cofunc.ReturnValue());
|
||||
cofunc.Resume();
|
||||
}
|
||||
printf( "%s: Done!\n", __FUNCTION__ );
|
||||
}
|
||||
|
||||
printf("%s: Done!\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
MyCoroutine cofunc;
|
||||
MyCoroutine cofunc;
|
||||
};
|
||||
|
||||
|
||||
main()
|
||||
{
|
||||
main() {
|
||||
MyClass obj;
|
||||
|
||||
obj.Run();
|
||||
|
||||
Reference in New Issue
Block a user