00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 class skTestIterator : public skExecutableIterator {
00023 int m_Count;
00024 public:
00025 skTestIterator() : m_Count(0){
00026 }
00027 bool next(skRValue& v){
00028 bool ret=false;
00029 if (m_Count<10){
00030 v=m_Count;
00031 skTracer::trace(skSTR("skTestIterator::next\n"));
00032 m_Count++;
00033 ret=true;
00034 }
00035 return ret;
00036 }
00037 };
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 class skTest : public skExecutable{
00048 public:
00049 skTest(){
00050 }
00051 skExecutableIterator * createIterator(const skString& qualifier){
00052 skTracer::trace(skSTR("skTest::createIterator qualified by ")+qualifier+skSTR("\n"));
00053 return new skTestIterator();
00054 }
00055 skExecutableIterator * createIterator(){
00056 skTracer::trace(skSTR("skTest::createIterator\n"));
00057 return new skTestIterator();
00058 }
00059 bool getValue(const skString& field_name,const skString& attribute,skRValue& value){
00060 skTracer::trace(skSTR("skTest::getValue field_name=")+field_name+skSTR(" attribute=")+attribute+skSTR("\n"));
00061 return true;
00062 }
00063 bool setValue(const skString& field_name,const skString& attribute,const skRValue& value){
00064 skTracer::trace(skSTR("skTest::setValue field_name=")+field_name+skSTR(" attribute=")+attribute+skSTR("\n"));
00065 return true;
00066 }
00067 bool setValueAt(const skRValue& array_index, const skString& attribute,const skRValue& value)
00068 {
00069 skTracer::trace(skSTR("skTest::setValueAt array_index")+array_index.str()+skSTR(" attribute=")+attribute+skSTR(" value=")+value.str()+skSTR("\n"));
00070 return true;
00071 }
00072
00073 bool getValueAt(const skRValue& array_index, const skString& attribute, skRValue& value)
00074 {
00075 skTracer::trace(skSTR("skTest::getValueAt array_index=")+array_index.str()+skSTR(" attribute=")+attribute+skSTR("\n"));
00076 return true;
00077 }
00078 bool method(const skString& method_name,skRValueArray& arguments,skRValue& return_value,skExecutableContext& ctxt)
00079 {
00080 skTracer::trace(skSTR("skTest::method method_name=")+method_name+skSTR("\n"));
00081 bool bRet=false;
00082 if (method_name==skSTR("createObject")){
00083 return_value=skRValue(new skTest(),true);
00084 bRet=true;
00085 }else{
00086 bRet=skExecutable::method(method_name,arguments,return_value,ctxt);
00087 }
00088 return bRet;
00089 }
00090 };
00091