Ejemplo n.º 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();	
}
Ejemplo n.º 2
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();	
}