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


C++ NameValuePair类代码示例

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


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

示例1: headerParamIterator

UtlBoolean Url::getHeaderParameter(const char* name, UtlString& value, int index)
{
    int foundIndex = 0;
    UtlBoolean found = FALSE;
    value = "";
    if(mpHeaderOrQueryParameters || parseHeaderOrQueryParameters())
    {
        UtlDListIterator headerParamIterator(*mpHeaderOrQueryParameters);
        NameValuePair* headerParam = NULL;

        UtlString paramName;

        while ((headerParam = (NameValuePair*) headerParamIterator()))
        {
            paramName = *headerParam;
            if(paramName.compareTo(name, UtlString::ignoreCase) == 0)
            {
                if(index == foundIndex)
                {
                    found = TRUE;
                    value = headerParam->getValue();
                    break;
                }
                foundIndex++;
            }
        }
    }
    return(found);
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:29,代码来源:Url.cpp

示例2: iterator

// Copy constructor
SipRequestContext::SipRequestContext(const SipRequestContext& rSipRequestContext)
{
   // delete the old values in the UtlDList
   if(!mVariableList.isEmpty())
   {
      mVariableList.destroyAll();
   }

   //copy mVariableList memebers individually
	UtlDListIterator iterator((UtlDList&)rSipRequestContext.mVariableList);
	NameValuePair* nameValuePair = NULL;
   UtlString value;
   UtlString name;
   int index = 0;
   do
   {
      nameValuePair = (NameValuePair*)iterator();
      if(nameValuePair)
      {
         name.append(*nameValuePair);
         value.append(nameValuePair->getValue());
         NameValuePair* newNvPair = new NameValuePair(name, value);
         mVariableList.insertAt(index, newNvPair);
         index ++;
         name.remove(0);
         value.remove(0);
      }
   }
   while (nameValuePair != NULL);
}
开发者ID:chemeris,项目名称:sipxecs,代码行数:31,代码来源:SipRequestContext.cpp

示例3: fieldParamIterator

UtlBoolean Url::getFieldParameter(const char* name, UtlString& value, int index) const
{
    int foundIndex = 0;
    UtlBoolean found = FALSE;
    value = "";
    if(mpFieldParameters || const_cast<Url*>(this)->parseFieldParameters())
    {
        UtlDListIterator fieldParamIterator(*mpFieldParameters);
        NameValuePair* fieldParam = NULL;

        UtlString paramName;

        while ((fieldParam = (NameValuePair*) fieldParamIterator()))
        {
            paramName = *fieldParam;
            if(paramName.compareTo(name, UtlString::ignoreCase) == 0)
            {
                if(index == foundIndex)
                {
                    found = TRUE;
                    value = fieldParam->getValue();
                    break;
                }
                foundIndex++;
            }
        }
    }
    return(found);
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:29,代码来源:Url.cpp

示例4: HttpBody

// Construct a MimeBodyPart from an HttpBody and a list of parameters.
MimeBodyPart::MimeBodyPart(const HttpBody& httpBody,
                           //< Provides the bytes of the body.
                           const UtlDList& parameters
                           //< Provides the parameters.
   ) :
   HttpBody(httpBody),
   mpParentBody(NULL),
   mParentBodyRawStartIndex(-1),
   mRawBodyLength(-1),
   mParentBodyStartIndex(-1),
   mBodyLength(-1)
{
   // Copy the parameters to mNameValues.
   UtlDListIterator iterator(parameters);
   NameValuePair* nvp;
   while((nvp = (NameValuePair*) iterator()))
   {
      mNameValues.append(new NameValuePair(nvp->data(), nvp->getValue()));
   }
   // Add the Content-Type parameter, taken from the HttpBody.
   mNameValues.append(new NameValuePair(HTTP_CONTENT_TYPE_FIELD,
                                        httpBody.getContentType()));
   // Add the Content-Transfer-Encoding parameter.
   mNameValues.append(new NameValuePair(HTTP_CONTENT_TRANSFER_ENCODING_FIELD,
                                        HTTP_CONTENT_TRANSFER_ENCODING_BINARY));

   // Members that reference the parent will be corrected later.
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:29,代码来源:MimeBodyPart.cpp

示例5: if

UtlBoolean Url::getFieldParameters(int iMaxReturn, UtlString* pNames, UtlString *pValues, int& iActualReturn)
{
    if(!(mpFieldParameters || parseFieldParameters()))
    {
        iActualReturn = 0;
    }

    // If the pValue is null, return false and set the actual return to the actual
    // number of items.
    else if (pNames == NULL || pValues == NULL)
    {
        iActualReturn = mpFieldParameters->entries() ;
        return FALSE ;
    }
    else
    {
        iActualReturn = sipx_min(iMaxReturn, ((int)(mpFieldParameters->entries()))) ;

        for (int i=0; i<iActualReturn; i++)
        {
            NameValuePair *pair = (NameValuePair*) mpFieldParameters->at(i) ;
            pNames[i] = *pair;
            pValues[i] = pair->getValue() ;

        }
    }
    return (iActualReturn > 0) ;
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:28,代码来源:Url.cpp

示例6: iterator

// Copy constructor
HttpRequestContext::HttpRequestContext(const HttpRequestContext& rHttpRequestContext)
{
   //copy mEnvironmentVars[HTTP_ENV_LAST]
   int count = 0;
   for (count = HttpRequestContext::HTTP_ENV_RAW_URL;
        count < HttpRequestContext::HTTP_ENV_LAST ;
        count ++)
        {
           if(!rHttpRequestContext.mEnvironmentVars[count].isNull())
           {
              mEnvironmentVars[count].remove(0);
              mEnvironmentVars[count].append(rHttpRequestContext.mEnvironmentVars[count]);
           }
        }

   // delete the old values in the UtlSList
   if(!mCgiVariableList.isEmpty())
   {
      mCgiVariableList.destroyAll();
   }

   //copy mCgiVariableList memebers individually
   mUsingInsensitive = rHttpRequestContext.mUsingInsensitive;
        UtlSListIterator iterator((UtlSList&)rHttpRequestContext.mCgiVariableList);
        NameValuePair* nameValuePair = NULL;
   UtlString value;
   UtlString name;
   int index = 0;
   do
   {
      nameValuePair = (NameValuePair*)iterator();
      if(nameValuePair)
      {
         name = *nameValuePair;
         value = nameValuePair->getValue();
         NameValuePair* newNvPair = ( mUsingInsensitive
                                     ? new NameValuePair(name, value)
                                     : new NameValuePairInsensitive(name, value)
                                     );
         mCgiVariableList.insertAt(index, newNvPair);
         index ++;
      }
   }
   while (nameValuePair != NULL);

   mConnectionEncrypted = rHttpRequestContext.mConnectionEncrypted;
   mPeerCertTrusted = rHttpRequestContext.mPeerCertTrusted;
   if ( mPeerCertTrusted )
   {
      UtlSListIterator rPeerNames(rHttpRequestContext.mPeerIdentities);
      UtlString* peerName;
      while ( (peerName = dynamic_cast<UtlString*>(rPeerNames())) )
      {
         mPeerIdentities.append(new UtlString(*peerName));
      }
   }
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:58,代码来源:HttpRequestContext.cpp

示例7: matchName

UtlBoolean MimeBodyPart::getPartHeaderValue(const char* headerName, UtlString& headerValue) const
{
    headerValue.remove(0);
    NameValuePair matchName(headerName);
    NameValuePair* nvp = (NameValuePair*) mNameValues.find(&matchName);
    if(nvp)
    {
        headerValue.append(nvp->getValue());
    }
    return(nvp != NULL);
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:11,代码来源:MimeBodyPart.cpp

示例8: 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

示例9: getCgiVariable

UtlBoolean HttpRequestContext::getCgiVariable(int index, UtlString& name, UtlString& value) const
{
    NameValuePair* nameValuePair = NULL;
    name.remove(0);
    value.remove(0);

    if((int)(mCgiVariableList.entries()) > index && index >= 0)
    {
        nameValuePair = (NameValuePair*)mCgiVariableList.at(index);
        if(nameValuePair)
        {
            name = *nameValuePair;
            value.append(nameValuePair->getValue());
        }
    }

    return(nameValuePair != NULL);
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:18,代码来源:HttpRequestContext.cpp

示例10: parseUrlParameters

UtlBoolean Url::getUrlParameter(int urlIndex, UtlString& name, UtlString& value)
{
    NameValuePair* url = NULL;

    if (   (urlIndex >= 0)
        && (mpUrlParameters || parseUrlParameters())
        && (((int)(mpUrlParameters->entries())) > urlIndex) 
        )
    {
       url = (NameValuePair*) mpUrlParameters->at(urlIndex);
    }
    
    if(url)
    {
        name = *url;
        value = url->getValue();
    }

    return(NULL != url);
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:20,代码来源:Url.cpp

示例11: parseFieldParameters

UtlBoolean Url::getFieldParameter(int fieldIndex, UtlString& name, UtlString& value)
{
    NameValuePair* field = NULL;

    if (   fieldIndex >= 0
        && (mpFieldParameters || parseFieldParameters())
        && ((int)(mpFieldParameters->entries())) > fieldIndex 
        )
    {
       field = (NameValuePair*) mpFieldParameters->at(fieldIndex);
    }
    
    if(field)
    {
        name = *field;
        value = field->getValue();
    }

    return(NULL != field);
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:20,代码来源:Url.cpp

示例12: parseHeaderOrQueryParameters

UtlBoolean Url::getHeaderParameter(int headerIndex, UtlString& name, UtlString& value)
{
    NameValuePair* header = NULL;

    if (   (headerIndex >= 0)
        && (mpHeaderOrQueryParameters || parseHeaderOrQueryParameters())
        && (((int)(mpHeaderOrQueryParameters->entries())) > headerIndex)
        )
    {
       header = static_cast<NameValuePairInsensitive*>(mpHeaderOrQueryParameters->at(headerIndex));
    }
    
    if(header)
    {
        name = *header;
        value = header->getValue();
    }

    return(NULL != header);
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:20,代码来源:Url.cpp

示例13: 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

示例14: iterator

// Assignment operator
MimeBodyPart& 
MimeBodyPart::operator=(const MimeBodyPart& rhs)
{
   if (this == &rhs)            // handle the assignment to self case
      return *this;

    mNameValues.destroyAll();
    UtlDListIterator iterator((UtlDList&)rhs.mNameValues);
    NameValuePair* nvp;
    while((nvp = (NameValuePair*)iterator()))
    {
        mNameValues.append(new NameValuePair(nvp->data(), nvp->getValue()));
    }
    mpParentBody = rhs.mpParentBody;
    mParentBodyRawStartIndex = rhs.mParentBodyRawStartIndex;
    mRawBodyLength = rhs.mRawBodyLength;
    mParentBodyStartIndex = rhs.mParentBodyStartIndex;
    mBodyLength = rhs.mBodyLength;

   return *this;
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:22,代码来源:MimeBodyPart.cpp

示例15: NameValuePair

void Url::setUrlParameter(const char* name, const char* value)
{
    NameValuePair* nv = new NameValuePair(name ? name : "",
        value ? value : "");

    // ensure that mpUrlParameters is initialized
    if (! (mpUrlParameters || parseUrlParameters()))
    {
       mpUrlParameters = new UtlDList;
    }
    
    NameValuePair* existingParam = static_cast<NameValuePair*>(mpUrlParameters->find(nv));

    if (existingParam)
    {
       existingParam->setValue(value);
    }
    else
    {
    mpUrlParameters->append(nv);
}

}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:23,代码来源:Url.cpp


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