예제 #1
0
VALUE getallPhonebookRecords(void* pb) {
#if defined (_WIN32_WCE)//&& !defined( OS_PLATFORM_MOTCE )
	if (RHO_IS_WMDEVICE && pb) {
		CNativeAddressBook* phonebook = (CNativeAddressBook*)pb;
        VALUE valGc = rho_ruby_disable_gc();
        CHoldRubyValue hash(rho_ruby_createHash());
		
		std::vector<CABRecord*> records;
		phonebook->getAllRecords(records);
		while(records.size() > 0) {
			CABRecord* record = records.back();
			const char* rid = record->getValue("id").c_str();
			if (rid) {
				LOGC(TRACE,"Phonebook") + "Adding record " + rid;
				addHashToHash(hash,rid,_getRecord(record));
			}
			delete record;
			records.pop_back();
		}

        rho_ruby_enable_gc(valGc);
		return hash;
	}	
#endif
	return rho_ruby_get_NIL();	
}
예제 #2
0
int setRecordValue(void* record, char* prop, char* value) {
#if defined (_WIN32_WCE)
	if (record) {
		CABRecord* r = (CABRecord*)record;
		r->setValue(prop,value);
	}
#endif
	return 1;
}
예제 #3
0
int setRecordValue(void* record, char* prop, char* value) {
#if defined (_WIN32_WCE)//&& !defined( OS_PLATFORM_MOTCE )
	if (RHO_IS_WMDEVICE && record) {
		CABRecord* r = (CABRecord*)record;
		r->setValue(prop,value);
	}
#endif
	return 1;
}
예제 #4
0
int deleteRecord(void* pb, void* record) {
#if defined (_WIN32_WCE)
	if (record) {
		CABRecord* r = (CABRecord*)record;
		r->remove();
		delete r;
	}
#endif
	return 1;
}
예제 #5
0
int deleteRecord(void* pb, void* record) {
#if defined (_WIN32_WCE)//&& !defined( OS_PLATFORM_MOTCE )
	if (RHO_IS_WMDEVICE && record) {
		CABRecord* r = (CABRecord*)record;
		r->remove();
		delete r;
	}
#endif
	return 1;
}
예제 #6
0
int saveRecord(void* pb, void* record) {
#if defined (_WIN32_WCE)
	if (record) {
		CABRecord* r = (CABRecord*)record;
		LOGC(INFO,"Phonebook") + "About to save:";
		r->dump();
		r->save();
		delete  r;
	}
#endif
	return 1;
}
예제 #7
0
int saveRecord(void* pb, void* record) {
#if defined (_WIN32_WCE)//&& !defined( OS_PLATFORM_MOTCE )
	if (RHO_IS_WMDEVICE && record) {
		CABRecord* r = (CABRecord*)record;
		LOGC(INFO,"Phonebook") + "About to save:";
		r->dump();
		r->save();
		delete  r;
	}
#endif
	return 1;
}
예제 #8
0
VALUE getallPhonebookRecords(void* pb) {
#if defined (_WIN32_WCE)
	if (pb) {
		CNativeAddressBook* phonebook = (CNativeAddressBook*)pb;
		VALUE hash = createHash();
		
		std::vector<CABRecord*> records;
		phonebook->getAllRecords(records);
		while(records.size() > 0) {
			CABRecord* record = records.back();
			const char* rid = record->getValue("id").c_str();
			if (rid) {
				LOGC(TRACE,"Phonebook") + "Adding record " + rid;
				addHashToHash(hash,rid,_getRecord(record));
			}
			delete record;
			records.pop_back();
		}

		return hash;
	}
#endif
	return rho_ruby_get_NIL();	
}