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


C++ NameValuePair::compareTo方法代码示例

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


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

示例1: testAccessors

    void testAccessors()
    {
        const char* name = "xxx";
        const char* name_different_case = "XXX";
        const char* value = "xxx-value";
        const char* valueRef;

        NameValuePair* nv = new NameValuePair(name);
        NameValuePair* nv_different_case = new NameValuePair(name_different_case);

        valueRef = nv->getValue();
        CPPUNIT_ASSERT_MESSAGE("value should be null", NULL == valueRef);

        nv->setValue(value);
        valueRef = nv->getValue();
        ASSERT_STR_EQUAL_MESSAGE("incorrect value retrieved", value, valueRef);

        nv->setValue(name);
        valueRef = nv->getValue();
        ASSERT_STR_EQUAL_MESSAGE("incorrect value retrieved", valueRef, name);

        CPPUNIT_ASSERT_MESSAGE("nv should be == nv", nv->compareTo(nv) == 0);
        CPPUNIT_ASSERT_MESSAGE("nv should be != nv_different_case",
                               nv->compareTo(nv_different_case) != 0);

        delete nv;
        delete nv_different_case;
    }
开发者ID:chemeris,项目名称:sipxecs,代码行数:28,代码来源:NameValuePairTest.cpp

示例2: partHeaders

// Constructor
MimeBodyPart::MimeBodyPart(const HttpBody* parent, int parentBodyStartIndex, int rawBodyLength)
{
   mpParentBody = parent;
   mParentBodyRawStartIndex = parentBodyStartIndex;
   mRawBodyLength = rawBodyLength;
   mParentBodyStartIndex = parentBodyStartIndex;
   mBodyLength = 0;

   if(rawBodyLength > 0 && parent)
   {
       const char* parentBodyBytes;
       const char* bodyBytes;
       int parentBodyLength;
       parent->getBytes(&parentBodyBytes, &parentBodyLength);
       bodyBytes = parentBodyBytes + parentBodyStartIndex;
       if(parentBodyLength >= parentBodyStartIndex + rawBodyLength)
       {
            
           int parsedBytes = HttpMessage::parseHeaders(bodyBytes, rawBodyLength,
                    mNameValues);

           // search the part headers for a Content-Type
           NameValuePair* partType;
           UtlDListIterator partHeaders(mNameValues);
           for( partType = static_cast<NameValuePair*>(partHeaders());
                partType && partType->compareTo(HTTP_CONTENT_TYPE_FIELD, UtlString::ignoreCase);
                partType = static_cast<NameValuePair*>(partHeaders())
               )
           {
           }
           if (partType)
           {
              // the content-type of the part is stored in the parent UtlString
              append(partType->getValue());
           }
            mParentBodyStartIndex = parentBodyStartIndex + parsedBytes;
            mBodyLength = mRawBodyLength - parsedBytes;
       }
   }

}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:42,代码来源:MimeBodyPart.cpp


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