当前位置: 首页>>代码示例>>C++>>正文


C++ ListIterator::IsDone方法代码示例

本文整理汇总了C++中ListIterator::IsDone方法的典型用法代码示例。如果您正苦于以下问题:C++ ListIterator::IsDone方法的具体用法?C++ ListIterator::IsDone怎么用?C++ ListIterator::IsDone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListIterator的用法示例。


在下文中一共展示了ListIterator::IsDone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RequestReceived

/**
* @date     2011/12/21
*
*  Handler of a request. The WebService request si built from the request, and
*  forwarded to the correct WsInterface.
*
******************************************************************************/
int32_t  WsHandler::RequestReceived(const HttpdRequest &Request,
                                    HttpdRequest *Answer)
{
   int32_t i_Ret = -1;
   ListIterator<AList<WsInterface*>, WsInterface*>  Iterator;
   WsInterface    *p_Interface = NULL;
   const String   *RequestInterface;

   if(HandleCors(Request, Answer) == 0)
      return(0);

   DynObject   Params;
   const uint8_t *Payload;
   uint32_t i_Length;
   i_Ret = Request.GetPayload(&Payload, &i_Length);
   if(i_Ret == 0)
   {
      JsonFlattener Flattener;
      const String PayloadString((const char*)(Payload), i_Length);

      i_Ret = Flattener.UnFlatten(&PayloadString, &Params);
      if(i_Ret == 0)
      {
         i_Ret = Params.FindString("InterfaceName", &RequestInterface);
      }
   }
   if(i_Ret != 0)
      return(-1);

   Iterator.SetTo(&InterfaceList);
   Iterator.First();
   while(Iterator.IsDone() == false)
   {
      if( (Iterator.GetItem(&p_Interface) == 0) && (p_Interface != NULL) )
      {
         if(p_Interface->GetName() == *RequestInterface)
         {
            String   AnswerString;
            i_Ret = p_Interface->Call(Params, &AnswerString);
            if(i_Ret == 0)
            {
               i_Ret = Answer->SetPayload((const uint8_t*)AnswerString.GetString(),
                                          AnswerString.GetSize());
            }
            break;
         }
      }
      Iterator.Next();
   }

   return(i_Ret);
}
开发者ID:edkit,项目名称:edkit-agent,代码行数:59,代码来源:WsHandler.cpp

示例2: main

void main() {
    Recipe myRecipe1 =  Recipe("Fish Filets in Hot Chili Oil");
    Recipe myRecipe2 =  Recipe("Boiled Fish with Pickled Cabbage and Chili ");
    Recipe myRecipe3 =  Recipe("Coke Chicken");
    Recipe myRecipe4 =  Recipe("Fish ball soup");
    List<Recipe>* myRecipeList = new List<Recipe>();
    myRecipeList->Append(myRecipe1);
    myRecipeList->Append(myRecipe2);
    myRecipeList->Append(myRecipe3);
    myRecipeList->Append(myRecipe4);
    ListIterator<Recipe> myIterator = ListIterator<Recipe>(myRecipeList);
    for(myIterator.First(); !myIterator.IsDone(); myIterator.Next()) {
        myIterator.CurrentItem().Print();
    }
    while(1) {
        ;
    }
}
开发者ID:wangqiang8511,项目名称:C---Design-Patterns-Examples,代码行数:18,代码来源:main.cpp

示例3: SetPath

TEST(HttpdRequestTestGroup, Basic)
{
   String   SetPath(PATH1 );
   HttpdRequest Obj1;

   /* Path */
   const String   &GetPath1 = Obj1.GetPath();
   CHECK(GetPath1 == "");
   CHECK(Obj1.SetPath(SetPath) == 0);

   const String   &GetPath2 = Obj1.GetPath();
   CHECK(GetPath2 == SetPath);

   /* Status */
   CHECK(Obj1.GetStatus() == 200);
   Obj1.SetStatus(404);
   CHECK(Obj1.GetStatus() == 404);

   /* Method */
   CHECK(Obj1.GetMethod() == HttpdRequest::NONE);
   Obj1.SetMethod(HttpdRequest::POST);
   CHECK(Obj1.GetMethod() == HttpdRequest::POST);

   /* payload */
   uint8_t SetPayload[326];
   const uint8_t *GetPayload;
   uint32_t i_Length;
   CHECK(Obj1.SetPayload(SetPayload, 326) == 0);
   CHECK(Obj1.GetPayload(&GetPayload, &i_Length) == 0);
   CHECK(i_Length == 326);
   CHECK(memcmp(GetPayload, SetPayload, i_Length) == 0);


   /* Header */
   String Header1Name(HEADER1), Header2Name(HEADER2);
   String Header1Val(HEADER1VAL), Header2Val(HEADER2VAL);
   String HeaderVal;

   CHECK(Obj1.GetHeader(Header1Name, &HeaderVal) == -1);
   CHECK(Obj1.SetHeader(Header1Name, Header1Val) == 0);
   CHECK(Obj1.GetHeader(Header1Name, &HeaderVal) == 0);
   CHECK(HeaderVal == Header1Val);

   CHECK(Obj1.SetHeader(Header2Name, Header2Val) == 0);
   CHECK(Obj1.GetHeader(Header2Name, &HeaderVal) == 0);
   CHECK(HeaderVal == Header2Val);

   CHECK(Obj1.SetHeader(Header1Name, Header2Val) == 0);
   CHECK(Obj1.GetHeader(Header1Name, &HeaderVal) == 0);
   CHECK(HeaderVal == Header2Val);

   /* Header list */
   const AList<HttpdRequest::Header*> &HeaderList = Obj1.GetHeaderList();
   ListIterator<AList<HttpdRequest::Header*>, HttpdRequest::Header*> Iterator;
   HttpdRequest::Header  *p_CurHeader;
   uint32_t i_Index = 0;

   Iterator.SetTo(&HeaderList);
   Iterator.First();
   while(Iterator.IsDone() == false)
   {
      CHECK(Iterator.GetItem(&p_CurHeader) == 0);
      CHECK(p_CurHeader != NULL);

      CHECK(i_Index <= 1);
      switch(i_Index)
      {
         case 0:
            CHECK(p_CurHeader->Name == Header1Name);
            CHECK(p_CurHeader->Value == Header2Val);
         break;
         case 1:
            CHECK(p_CurHeader->Name == Header2Name);
            CHECK(p_CurHeader->Value == Header2Val);
         break;
      }
      i_Index++;
      Iterator.Next();
   }

};
开发者ID:edkit,项目名称:edkit-agent,代码行数:81,代码来源:HttpdRequest1.cpp


注:本文中的ListIterator::IsDone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。