Vector向量用法,简明教程For Me!

jackxiang 2008-2-29 16:45 | |
32                 typedef struct
33                 {
34                         unsigned enterpriseID;
35                         string enterpriseName;
36                         string telephone;
37                         unsigned long long quota;
38                         unsigned long long realQuota;
39                         unsigned expiration;
40                         unsigned flag;
41                         unsigned openlong;
42                         string enterpriseStatusName;
43                         string regTime;
44                         string endDate;
45                         string subDomain;//for shenbak to stop and start enterprise
46                 }enterpriseVectorNode;

                     vector <enterpriseVectorNode> _enterpriseVector;
                      

for ( vector<enterpriseVectorNode>::iterator it = _enterpriseVector.begin(); it != _enterpriseVector.end() ; ++it )
  {
    if ( cnt % 2 == 0 )
      bgCorlor = "#f8f8f8";
    else
      bgCorlor = "#f5f5f5";

    osTmp<<"<tr align=center "<<bgCorlor<<">";
    osTmp<<"<td><input type=checkbox name=enterpriseID[] value="<<it->enterpriseID<<"></td>";
    osTmp<<"<td><a href=\""<<linkUrl<<it->enterpriseID<<"\">"<<it->enterpriseName<<"</a></td>";
    osTmp<<"<td>"<<it->subDomain<<"</td>";
    osTmp<<"<td>"<<it->telephone<<"</td>";
    osTmp<<"<td>"<<it->quota<<"</td>";
    osTmp<<"<td>"<<it->realQuota<<"</td>";
    osTmp<<"<td>"<<it->enterpriseStatusName<<"</td>";
    osTmp<<"<td>"<<it->regTime<<"</td>";
    osTmp<<"<td>"<<it->endDate<<"</td>";
    osTmp<<"</tr>";
  }



  for( int i = 0; i < list.GetCount( ); i++ )
  {
    row.Empty();
    sql_get2( list[i], row );
    enterpriseVectorNode tmpNode;
    tmpNode.enterpriseID = atoi((LPCSTR) *row[ 0 ] );
    tmpNode.enterpriseName =(LPCSTR) *row[ 1 ] ;
    tmpNode.telephone = (LPCSTR) *row[ 2 ] ;
    tmpNode.quota = atol((LPCSTR) * row[ 3 ] );
    tmpNode.realQuota = atol( (LPCSTR) *row[ 4 ] );
    tmpNode.expiration = atoi( (LPCSTR) *row[ 5 ] );
    tmpNode.flag = atoi( (LPCSTR) *row[ 6 ] );

    tmpNode.regTime = (LPCSTR) *row[ 7 ];
    tmpNode.openlong = atoi( (LPCSTR) *row[ 8 ] );
    tmpNode.subDomain = (LPCSTR) *row[ 9 ];

    initEnterpriseStatus( tmpNode );
    string tmpStr;
    dateAdd( tmpNode.regTime, tmpStr, tmpNode.openlong, 'd', errMsg );
    tmpNode.endDate = tmpStr;
    _enterpriseVector.push_back( tmpNode );
  }

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/901/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2008-2-29 16:45
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]