本文整理汇总了C++中Holder::getCurl方法的典型用法代码示例。如果您正苦于以下问题:C++ Holder::getCurl方法的具体用法?C++ Holder::getCurl怎么用?C++ Holder::getCurl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Holder
的用法示例。
在下文中一共展示了Holder::getCurl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
JNIEXPORT jint JNICALL Java_com_netbirdtech_libcurl_Curl_curlEasySetoptObjectPointNative
(JNIEnv * env, jobject obj, jlong handle, jint opt, jstring value) {
const char *str;
int result;
Holder* holder = (Holder*) handle;
CURL * curl = holder->getCurl();
jstring value_ref;
str = env->GetStringUTFChars(value, 0);
if (str == 0) {
return 0;
}
result = (int) curl_easy_setopt(curl, (CURLoption) opt, str);
switch(opt) {
case CURLOPT_POSTFIELDS:
// this field not copy data
// see http://curl.haxx.se/libcurl/c/CURLOPT_POSTFIELDS.html
value_ref = (jstring) env->NewGlobalRef(value);
holder->addStringGlobalRefs(value_ref, str);
break;
default:
// free
env->ReleaseStringUTFChars(value, str);
}
return result;
}
示例2:
JNIEXPORT jint JNICALL Java_com_netbirdtech_libcurl_Curl_curlEasySetoptObjectPointBytesNative
(JNIEnv * env, jobject obj, jlong handle, jint opt, jbyteArray bytes) {
int result;
Holder* holder = (Holder*) handle;
CURL * curl = holder->getCurl();
jbyte* str = env->GetByteArrayElements(bytes, JNI_FALSE);
int content_length = env->GetArrayLength(bytes);
if (str == NULL) {
return 0;
}
result = (int) curl_easy_setopt(curl, (CURLoption) opt, str);
switch(opt) {
case CURLOPT_POSTFIELDS:
// this field not copy data
// see http://curl.haxx.se/libcurl/c/CURLOPT_POSTFIELDS.html
// release after perform
holder->addByteArrayGlobalRefs(env->NewGlobalRef(bytes), (const char*)str);
break;
default:
// free
env->ReleaseByteArrayElements(bytes, str, 0);
}
return result;
}
示例3: curl_easy_setopt
JNIEXPORT jint JNICALL Java_com_netbirdtech_libcurl_Curl_curlEasySetoptObjectPointArrayNative
(JNIEnv *env, jobject obj, jlong handle, jint opt, jobjectArray values) {
Holder* holder = (Holder*) handle;
CURL * curl = holder->getCurl();
const char *str;
struct curl_slist *slist = 0;
int nargs = env->GetArrayLength(values);
for (int i = 0; i < nargs; i++) {
jstring value = (jstring) env->GetObjectArrayElement(values, i);
str = env->GetStringUTFChars(value, 0);
if (str == 0) {
return 0;
}
//LOGV("append slist");
slist = curl_slist_append(slist, str);
env->ReleaseStringUTFChars(value, str);
}
holder->addCurlSlist(slist);
//LOGD("set slist option=%d, size=%d", opt, nargs);
return curl_easy_setopt(curl, (CURLoption) opt, slist);
}
示例4: return
JNIEXPORT jint JNICALL Java_com_netbirdtech_libcurl_Curl_curlEasySetoptLongNative
(JNIEnv *env, jobject obj, jlong handle, jint opt, jlong value) {
Holder* holder = (Holder*) handle;
return (int) curl_easy_setopt(holder->getCurl(), (CURLoption) opt, (long) value);
}