本文整理汇总了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;
}
示例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;
}
}
}