• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            隨心動(dòng)

            自處理list

            一個(gè)自處理的list 用途多多
              1
               1 //子項(xiàng)
              2   2 class autoItem
              3   3 {
              4   4 public:
              5   5     //處理
              6   6     virtual bool  proces() = 0;
              7   7     //彈出
              8   8     virtual bool  ok() = 0; 
              9   9     //處理順序
             10  10     virtual int   Order(){return 0;}
             11  11 };
             12  12 enum sortType
             13  13 {
             14  14     ST_Input,
             15  15     ST_Custom
             16  16 };
             17  17 //自處理list
             18  18 class _autolist
             19  19 {
             20  20 public:
             21  21     _autolist( sortType _type );
             22  22     ~_autolist();
             23  23 
             24  24     //繼承函數(shù)
             25  25 public:
             26  26     //加入處理序列
             27  27     virtual bool  push(autoItem *p);
             28  28     //執(zhí)行處理序列
             29  29     virtual bool  go();
             30  30     //清理所有
             31  31     virtual bool  clear(); 
             32  32 
             33  33     //
             34  34 protected:
             35  35     std::list<autoItem*> itemList;
             36  36     sortType _sortType;
             37  37 };
             38  38 
             39  39 
             40  40 _autolist::_autolist( sortType _type )
             41  41 {
             42  42     _sortType = _type;
             43  43 }
             44  44 
             45  45 _autolist::~_autolist()
             46  46 {
             47  47     clear();
             48  48 }
             49  49 
             50  50 bool _autolist::push( autoItem *p )
             51  51 {
             52  53     if (p == NULL) return false;
             53  54     switch (_sortType)
             54  55     {
             55  56     case ST_Input:
             56  57         {
             57  58             itemList.insert(itemList.end(),p);
             58  59             return true;
             59  60         }
             60  61     case ST_Custom:
             61  62         {
             62  63             if (itemList.size() == 0)
             63  64             {
             64  65                 itemList.push_back(p);
             65  66                 return true;
             66  67             }
             67  68             static std::list<autoItem*>::iterator it;
             68  69             it= itemList.begin();
             69  70             for (; it != itemList.end();it++)
             70  71             {
             71  72                 if ((*it)->Order() < p->Order())continue;
             72  73                 itemList.insert(it,p);
             73  74                 break;
             74  75             }
             75  76             return true;
             76  77         }
             77  78     default:
             78  80         return false;
             79  82     }
             80  83     return false;
             81  84 }
             82  85 
             83  86 bool _autolist::go()
             84  87 {
             85  88     static std::list<autoItem*>::iterator it;
             86  89     int nsize = itemList.size();
             87  90     it= itemList.begin();
             88  91     for (; it != itemList.end();)
             89  92     {
             90  93         (*it)->proces();
             91  94         if ( (*it)->ok())
             92  95             it = itemList.erase(it);
             93  96         else
             94  97             it++;
             95  98     }
             96  99     return true;
             97 100 }
             98 101 
             99 102 bool _autolist::clear()
            100 103 {
            101 104     itemList.clear();
            102 105     return true;
            103 106 }
            104 107 
            105 

            posted on 2013-12-15 22:30 陳志遠(yuǎn) 閱讀(1455) 評(píng)論(2)  編輯 收藏 引用

            評(píng)論

            # re: 自處理list 2013-12-17 16:50 ccsdu2009

            干啥的?  回復(fù)  更多評(píng)論   

            # re: 自處理list 2013-12-18 00:08 陳志遠(yuǎn)

            @ccsdu2009
            我用它畫 動(dòng)畫啊 或者執(zhí)行一些可變的過程,看那個(gè)autoItem怎么實(shí)現(xiàn)了  回復(fù)  更多評(píng)論   


            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            導(dǎo)航

            <2013年12月>
            24252627282930
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            統(tǒng)計(jì)

            常用鏈接

            留言簿

            隨筆檔案

            文章分類

            Othor's blog

            搜索

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            丁香色欲久久久久久综合网| 久久久中文字幕| 欧美午夜精品久久久久久浪潮| 久久久久久国产a免费观看不卡| 久久乐国产精品亚洲综合| 久久这里只有精品视频99| AV无码久久久久不卡蜜桃| 91精品国产高清91久久久久久| 中文字幕成人精品久久不卡| 无码国内精品久久综合88| 久久狠狠高潮亚洲精品| 国产高清国内精品福利99久久| 日日狠狠久久偷偷色综合0| 2022年国产精品久久久久| 久久久久亚洲国产| 亚洲国产精品久久66| 亚洲色欲久久久综合网东京热| 国产午夜福利精品久久| 久久久久免费精品国产| 久久精品成人免费网站| 久久久久久国产精品无码超碰| 青青青青久久精品国产h久久精品五福影院1421 | 久久久久久亚洲精品不卡| 亚洲午夜久久久影院| 久久精品极品盛宴观看| 久久综合久久久| 大伊人青草狠狠久久| 日韩人妻无码精品久久免费一 | 91精品无码久久久久久五月天| 久久亚洲日韩精品一区二区三区| 人人妻久久人人澡人人爽人人精品| 国产激情久久久久影院老熟女| 国产精品久久久久aaaa| 国产精品久久久久影院色| 久久综合给久久狠狠97色| 久久精品国产日本波多野结衣| 久久频这里精品99香蕉久| 久久夜色撩人精品国产小说| 久久97久久97精品免视看秋霞| 久久精品人人做人人爽电影| 国产91色综合久久免费|