本文整理汇总了C++中RAWLOG_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ RAWLOG_ERROR函数的具体用法?C++ RAWLOG_ERROR怎么用?C++ RAWLOG_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RAWLOG_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RAWLOG_ERROR
VALUE rho_cast_helper<VALUE, jobject>::convertJavaCollectionToRubyArray(jobject jList)
{
jhobject jhIterator = m_env->CallObjectMethod(jList, midCollectionIterator);
if(m_env->ExceptionCheck() == JNI_TRUE)
{
rho::String message = rho::common::clearException(m_env);
RAWLOG_ERROR(message.c_str());
return Qnil;
}
CHoldRubyValue retval(rho_ruby_create_array());
while(m_env->CallBooleanMethod(jhIterator.get(), midIteratorHasNext))
{
jhobject jhVal = m_env->CallObjectMethod(jhIterator.get(), midIteratorNext);
if(m_env->ExceptionCheck() == JNI_TRUE)
{
rho::String message = rho::common::clearException(m_env);
RAWLOG_ERROR(message.c_str());
return Qnil;
}
CHoldRubyValue val(rho_cast<VALUE>(m_env, jhVal));
rho_ruby_add_to_array(retval, val);
}
return retval;
}
示例2: rho_barcode_barcode_recognize
extern "C" const char* rho_barcode_barcode_recognize(const char* filename) {
JNIEnv *env = jnienv();
jclass cls = rho_find_class(env, "com/rhomobile/barcode/Barcode");
if (!cls) return NULL;
jmethodID mid = env->GetStaticMethodID( cls, "recognize", "(Ljava/lang/String;)Ljava/lang/String;");
if (!mid) return NULL;
jstring objFilename = env->NewStringUTF(filename);
jstring res = (jstring)env->CallStaticObjectMethod(cls, mid, objFilename);
env->DeleteLocalRef(objFilename);
if (res == NULL) {
RAWLOG_ERROR("Failed to recognize.");
return NULL;
}
if(env->GetStringUTFLength(res) < (sizeof(barcode_result)/sizeof(barcode_result[0])))
{
const char* code = env->GetStringUTFChars(res,0);
strcpy(barcode_result, code);
env->ReleaseStringUTFChars(res, code);
} else
{
RAWLOG_ERROR("Recognized data is too large.");
return NULL;
}
return barcode_result;
}
示例3: CFStreamCreatePairWithSocket
CURLcode SSLImpl::connect(int sockfd, int nonblocking, int *done, int ssl_verify_peer, void *storage, char* host_name)
{
ssl_data_t *data = (ssl_data_t*)storage;
CFStreamCreatePairWithSocket(kCFAllocatorDefault, sockfd, &data->readStream, &data->writeStream);
// Indicate that the connection needs to be done in secure manner
CFReadStreamSetProperty(data->readStream, kCFStreamPropertySocketSecurityLevel, kCFStreamSocketSecurityLevelSSLv3);
CFWriteStreamSetProperty(data->writeStream, kCFStreamPropertySocketSecurityLevel, kCFStreamSocketSecurityLevelSSLv3);
CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
if (!dict) {
RAWLOG_ERROR("Can not allocate CFMutableDictionaryRef");
return CURLE_SSL_CONNECT_ERROR;
}
CFDictionarySetValue(dict, kCFStreamSSLValidatesCertificateChain, ssl_verify_peer ? kCFBooleanTrue : kCFBooleanFalse);
CFReadStreamSetProperty(data->readStream, kCFStreamPropertySSLSettings, dict);
CFWriteStreamSetProperty(data->writeStream, kCFStreamPropertySSLSettings, dict);
CFRelease(dict);
if (!CFReadStreamOpen(data->readStream) || !CFWriteStreamOpen(data->writeStream)) {
RAWLOG_ERROR("SSL connection error");
return CURLE_SSL_CONNECT_ERROR;
}
CFReadStreamScheduleWithRunLoop( data->readStream,
CFRunLoopGetCurrent(),
kCFRunLoopCommonModes);
CFWriteStreamScheduleWithRunLoop( data->writeStream,
CFRunLoopGetCurrent(),
kCFRunLoopCommonModes);
*done = 1;
return CURLE_OK;
}
示例4: rho_geoimpl_do_geocoding
void rho_geoimpl_do_geocoding(rho_param* p, const char* callback, int callback_tag) {
const char* c_adress = NULL;
bool adress_setted = false;
float longitude = 0;
float latitude = 0;
bool longitude_setted = false;
bool latitude_setted = false;
switch (p->type) {
case RHO_PARAM_HASH: {
for (int i = 0, lim = p->v.hash->size; i < lim; ++i) {
const char *name = p->v.hash->name[i];
rho_param *value = p->v.hash->value[i];
if (strcasecmp(name, "adress") == 0) {
c_adress = value->v.string;
adress_setted = true;
}
if (strcasecmp(name, "latitude") == 0) {
latitude = strtod(value->v.string, NULL);
latitude_setted = true;
}
if (strcasecmp(name, "longitude") == 0) {
longitude_setted = true;
longitude = strtod(value->v.string, NULL);
}
}
}
break;
default: {
RAWLOG_ERROR("Unexpected parameter type for do_geocoding, should be Hash");
return;
}
}
if ((c_adress == NULL) && (!latitude_setted && !longitude_setted)) {
RAWLOG_ERROR("Unexpected parameter type for do_geocoding, should be Hash with 'adress' or 'latitude' + 'longitude' parameters");
return;
}
if (adress_setted) {
rho::String adress = c_adress;
getGeocodeSignletone()->resolve(adress, new RhoGoogleGeocodeCallbackImpl(adress, callback, callback_tag));\
}
else if (latitude_setted && longitude_setted) {
getGeocodeSignletone()->resolve(latitude, longitude, new RhoGoogleGeocodeCallbackImpl("", callback, callback_tag));
}
else {
RAWLOG_ERROR("Ivalid parameters type for do_geocoding, should be Hash with 'adress' or 'latitude' + 'longitude' parameters");
}
}
示例5: RAWTRACE
jobjectArray rho_cast_helper<jobjectArray, VALUE>::operator()(JNIEnv *env, VALUE value)
{
RAWTRACE("rho_cast<jobjectArray, VALUE>");
if (!initConvertor(env))
return 0;
if (NIL_P(value))
return 0;
if(TYPE(value) == RUBY_T_ARRAY)
{
int size = RARRAY_LEN(value);
jobjectArray jArray = env->NewObjectArray(size, clsString, 0);
if(env->ExceptionCheck() == JNI_TRUE)
{
rho::String message = rho::common::clearException(env);
RAWLOG_ERROR(message.c_str());
return 0;
}
for (int i = 0; i < size; ++i)
{
jhstring jhElement = rho_cast<jstring>(env, rb_ary_entry(value, i));
env->SetObjectArrayElement(jArray, i, jhElement.get());
}
return jArray;
}
RAWLOG_ERROR1("rho_cast<jobjectArray, VALUE>: wrong type of VALUE: %d", TYPE(value));
return 0;
}
示例6: onSuccess
virtual void onSuccess(double latitude, double longitude, const char* adress) {
char* buf = new char[2048];
if (buf == NULL) {
RAWLOG_ERROR("can not allocate temporary char buffer in GeoLocation callback");
return;
}
if (adress != NULL) {
rho::String coded_adr = adress;
coded_adr = rho::net::URI::urlEncode(coded_adr);
sprintf(buf,"&rho_callback=1&status=ok&tag=%d&latitude=%f&longitude=%f&adress=%s", mTag, (float)latitude, (float)longitude, coded_adr.c_str());
}
else {
sprintf(buf,"&rho_callback=1&status=ok&tag=%d&latitude=%f&longitude=%f", mTag, (float)latitude, (float)longitude);
}
char* norm_url = rho_http_normalizeurl(mCallback.c_str());
rho_net_request_with_data(norm_url, buf);
rho_http_free(norm_url);
delete buf;
//delete this;
}
示例7: rho_ruby_create_string
VALUE rho_cast_helper<VALUE, jobject>::operator()(JNIEnv *env, jobject obj)
{
if (env->IsSameObject(obj, NULL) == JNI_TRUE)
return Qnil;
if (!initConvertor(env))
{
env->ThrowNew(getJNIClass(RHODES_JAVA_CLASS_RUNTIME_EXCEPTION), "Java <=> Ruby conversion initialization failed");
return Qnil;
}
if (env->IsInstanceOf(obj, clsString))
{
const char *str = env->GetStringUTFChars(static_cast<jstring>(obj), JNI_FALSE);
VALUE res = rho_ruby_create_string(str);
env->ReleaseStringUTFChars(static_cast<jstring>(obj), str);
return res;
}
if (env->IsInstanceOf(obj, clsMap))
return convertJavaMapToRubyHash(env, obj);
RAWLOG_ERROR("rho_cast<VALUE, jobject>: unknown type of value");
return Qnil;
}
示例8: RAWLOG_ERROR
JNIEnv *jnienv()
{
JNIEnv *env = (JNIEnv *)pthread_getspecific(g_thrkey);
if (!env)
RAWLOG_ERROR("JNIEnv is not set for this thread!!!");
return env;
}
示例9: RAWTRACE
VALUE MethodResultJni::enumerateRubyObjects(VALUE klass)
{
RAWTRACE("enumerateRubyObjects");
JNIEnv *env = jniInit();
if (!env) {
RAWLOG_ERROR("JNI initialization failed");
rb_raise(rb_eRuntimeError,"JNI initialization failed");
return Qnil;;
}
if(getResultType(env) == typeList)
{
CHoldRubyValue valArray(rho_ruby_create_array());
HStringVector pIDs = rho_cast<HStringVector>(env, getListResult(env));
for(HStringVector::element_type::size_type i = 0; i < pIDs->size(); ++i)
{
VALUE valObj = rho_ruby_create_object_with_id( klass, (*pIDs)[i].c_str() );
rho_ruby_add_to_array(valArray, valObj);
}
RAWTRACE("has enumerated");
reset(env);
return valArray;
} else
{
return toRuby();
}
}
示例10: take_picture
RHO_GLOBAL void take_picture(char* callback_url, rho_param *options_hash )
{
JNIEnv *env = jnienv();
jclass cls = getJNIClass(RHODES_JAVA_CLASS_CAMERA);
if (!cls) return;
jmethodID mid = getJNIClassStaticMethod(env, cls, "takePicture", "(Ljava/lang/String;Ljava/lang/Object;)V");
if (!mid) return;
if ((options_hash != NULL) && (options_hash->type != RHO_PARAM_HASH)) {
RAWLOG_ERROR("Unexpected parameter type, should be Hash");
return;
}
jobject paramsObj = NULL;
if (options_hash != NULL) {
paramsObj = RhoValueConverter(env).createObject(options_hash);
}
env->CallStaticVoidMethod(cls, mid, rho_cast<jhstring>(callback_url).get(), paramsObj);
if (options_hash != NULL) {
env->DeleteLocalRef(paramsObj);
}
}
示例11: Init_Barcode1
extern "C" void Init_Barcode1(void)
{
JNIEnv *env = jnienv();
if(env)
{
jclass barcode1SingletonClass = rho_find_class(env, BARCODE1_SINGLETON_CLASS);
if(!barcode1SingletonClass)
{
RAWLOG_ERROR1("Failed to find java class: %s", BARCODE1_SINGLETON_CLASS);
return;
}
jmethodID midInit = env->GetStaticMethodID(barcode1SingletonClass, "init", "()V");
if(!midInit)
{
RAWLOG_ERROR1("Failed to get method 'init' for java class %s", BARCODE1_SINGLETON_CLASS);
return;
}
env->CallStaticVoidMethod(barcode1SingletonClass, midInit);
Init_RubyAPI_Barcode1();
//Init_JSAPI_Barcode1();
}
else
{
RAWLOG_ERROR("Failed to initialize Barcode1 API: jnienv() is failed");
}
}
示例12: m_jhResult
MethodResultJni::MethodResultJni(JNIEnv* env, jobject jResult) : m_jhResult(jResult), m_bGlobalRef(false), m_bSlaveRef(false), m_hasCallback(false), m_resType(typeNone)
{
m_env = jniInit(env);
if (!m_env) {
RAWLOG_ERROR("ctor - JNI initialization failed");
return;
}
}
示例13: m_jhResult
MethodResultJni::MethodResultJni() : m_jhResult(0), m_hasCallbackUrl(false), m_resType(typeNone)
{
JNIEnv *env = jniInit();
if (!env) {
RAWLOG_ERROR("ctor - JNI initialization failed");
return;
}
m_jhResult = env->NewObject(s_methodResultClass, s_midMethodResult);
}
示例14: m_env
MethodResultJni::MethodResultJni(bool isRuby) : m_env(0), m_jhResult(0), m_bGlobalRef(false), m_bSlaveRef(false), m_hasCallback(false), m_resType(typeNone)
{
m_env = jniInit();
if (!m_env) {
RAWLOG_ERROR("ctor - JNI initialization failed");
return;
}
m_jhResult = m_env->NewObject(s_methodResultClass, s_midMethodResult, static_cast<jboolean>(isRuby));
}
示例15: jnienv
JNIEnv* CBarcode1::jniInit()
{
JNIEnv *env = jnienv();
if(!env)
{
RAWLOG_ERROR("JNI init failed: JNIEnv is null");
return 0;
}
return jniInit(env);
}