本文整理汇总了C++中OCRepresentation::setNULL方法的典型用法代码示例。如果您正苦于以下问题:C++ OCRepresentation::setNULL方法的具体用法?C++ OCRepresentation::setNULL怎么用?C++ OCRepresentation::setNULL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCRepresentation
的用法示例。
在下文中一共展示了OCRepresentation::setNULL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOGD
/*
* Class: org_iotivity_base_OcRepresentation
* Method: setValueRepresentation
* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;)V
*/
JNIEXPORT void JNICALL Java_org_iotivity_base_OcRepresentation_setValueRepresentation
(JNIEnv *env, jobject thiz, jstring jKey, jobject jValue)
{
LOGD("OcRepresentation_setValueRepresentation");
if (!jKey)
{
ThrowOcException(OC_STACK_INVALID_PARAM, "key cannot be null");
return;
}
OCRepresentation *rep = JniOcRepresentation::getOCRepresentationPtr(env, thiz);
if (!rep)
{
return;
}
std::string key = env->GetStringUTFChars(jKey, nullptr);
if (jValue)
{
OCRepresentation *value = JniOcRepresentation::getOCRepresentationPtr(env, jValue);
if (!value)
{
return;
}
rep->setValue(key, *value);
}
else
{
rep->setNULL(key);
}
}
示例2: LOGD
/*
* Class: org_iotivity_base_OcRepresentation
* Method: setNull
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_iotivity_base_OcRepresentation_setNull
(JNIEnv *env, jobject thiz, jstring jAttributeKey)
{
LOGD("OcRepresentation_setNull");
if (!jAttributeKey)
{
ThrowOcException(OC_STACK_INVALID_PARAM, "attributeKey cannot be null");
return;
}
OCRepresentation *rep = JniOcRepresentation::getOCRepresentationPtr(env, thiz);
if (!rep) return;
std::string attributeKey = env->GetStringUTFChars(jAttributeKey, nullptr);
rep->setNULL(attributeKey);
}