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


C++ BodyPart::GetHeaderFields方法代码示例

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


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

示例1:

   IMAPFetchParser::BodyPart
   IMAPFetchParser::_ParseBODY(const String &sString)
   {
      BodyPart oPart;
      
      // Set the description.

      String sNewName = sString;
      sNewName.ReplaceNoCase(_T("BODY.PEEK["), _T("BODY["));

      oPart.SetDescription(sNewName);

      // Locate the start of the peek-part.
      long lBodyStart = sNewName.Find(_T("[")) + 1;
      
      // Locate the end of the part.
      long lBodyEnd = sNewName.Find(_T("]"), lBodyStart) - 1;

      if (sNewName.Find(_T("<"), lBodyEnd) == lBodyEnd +2)
      {
         int iStart = lBodyEnd+3;
         int iEnd = sNewName.Find(_T(">"), iStart);

         String sPartial = sNewName.Mid(iStart, iEnd - iStart);
         int iDotPos = sPartial.Find(_T("."));
         
         oPart.m_iOctetStart = _ttoi(sPartial.Mid(0, iDotPos));
         oPart.m_iOctetCount = _ttoi(sPartial.Mid(iDotPos+1));

         // Remove the octets part from the description.
         String sBefore = sNewName.Mid(0, iStart - 1);
         String sAfter = sNewName.Mid(iEnd + 1);

         String sDescWithoutOctets = sBefore + sAfter;

         oPart.SetDescription(sDescWithoutOctets);
      }

      // Extract the body  part.
      long lBodyLen = lBodyEnd - lBodyStart +1 ;
      String sBody = sNewName.Mid(lBodyStart, lBodyLen);

      if (sBody.IsEmpty())
      {
         oPart.SetShowBodyFull(true);
         m_bSetSeen = true;
      }
      else
      {
         // Determine what to look at.
         long lTemp  = 0;

         // Should we show all header fields except for...
         lTemp = sBody.FindNoCase(_T("HEADER.FIELDS.NOT"));
         if (lTemp >= 0)
         {
            int lStart = sBody.Find(_T("("), lTemp) + 1;
            int lEnd = sBody.Find(_T(")"), lStart) ;
            int lLength = lEnd - lStart;
            
            String sFields = sBody.Mid(lStart, lLength);
            oPart.GetHeaderFieldsNOT() = StringParser::SplitString(sFields, " ");
            oPart.SetShowBodyHeaderFieldsNOT(true);

            // Strip away the header fields part from the Body.
            // If we don't do this, we will parse the same string
            // as header.fields below.
            String sBefore = sBody.Mid(0, lTemp);
            String sAfter = sBody.Mid(lEnd + 2);
            sBody = sBefore + sAfter;

         }

         // Should we show header fields?
         lTemp = sBody.FindNoCase(_T("HEADER.FIELDS"));
         if (lTemp >= 0)
         {
            int lStart = sBody.Find(_T("("), lTemp) + 1;
            int lEnd = sBody.Find(_T(")"), lStart) ;
            int lLength = lEnd - lStart;
            
            String sFields = sBody.Mid(lStart, lLength);
            oPart.GetHeaderFields() = StringParser::SplitString(sFields, " ");
            oPart.SetShowBodyHeaderFields(true);

            // Strip away the header fields part from the Body.
            String sBefore = sBody.Mid(0, lTemp);
            String sAfter = sBody.Mid(lEnd + 2);
            sBody = sBefore + sAfter;
         }

         lTemp = sBody.FindNoCase(_T("HEADER"));
         if (lTemp >= 0)
         {
            oPart.SetShowBodyHeader(true);
            
            String sBefore = sBody.Mid(0, lTemp);
            String sAfter = sBody.Mid(lTemp + 7);
            sBody = sBefore + sAfter;
         }
//.........这里部分代码省略.........
开发者ID:Bill48105,项目名称:hmailserver,代码行数:101,代码来源:IMAPFetchParser.cpp


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