当前位置: 首页>>代码示例>>C++>>正文


C++ dict_read_next函数代码示例

本文整理汇总了C++中dict_read_next函数的典型用法代码示例。如果您正苦于以下问题:C++ dict_read_next函数的具体用法?C++ dict_read_next怎么用?C++ dict_read_next使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dict_read_next函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: build_prayer_time_next

static struct tm build_prayer_time_next(int year, int month, int day, DictionaryIterator *iterator) {  
  Tuple *hour_tuple = dict_read_next(iterator);
  Tuple *minute_tuple = dict_read_next(iterator);
  time_t temp = time(NULL);  
  struct tm *prayer_time = localtime(&temp);    
  prayer_time->tm_year = year;
  prayer_time->tm_mon = month;
  prayer_time->tm_mday = day;  
  prayer_time->tm_hour = (int)hour_tuple->value->int32;
  prayer_time->tm_min = (int)minute_tuple->value->int32;
  prayer_time->tm_sec = 0;  
  return *prayer_time;
}
开发者ID:matmar10,项目名称:pebble-adhan-watchface,代码行数:13,代码来源:main.c

示例2: inbox_received_callback

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {

  APP_LOG(APP_LOG_LEVEL_INFO, "Received info from JS");
  
  // date components
  Tuple *date_year_tuple = dict_read_first(iterator);  
  Tuple *date_month_tuple = dict_read_next(iterator);
  Tuple *date_day_tuple = dict_read_next(iterator);
  
  int year = (int)date_year_tuple->value->int32;
  int month = (int)date_month_tuple->value->int32;
  int day = (int)date_day_tuple->value->int32;
    
  char str_ymd[32];
  snprintf(str_ymd, sizeof(str_ymd), "h-m-hs -- %i:%i:%i", year, month, day); 
  APP_LOG(APP_LOG_LEVEL_DEBUG, str_ymd);  
  
  s_fajr = build_prayer_time_next(year, month, day, iterator);  
  s_shurooq = build_prayer_time_next(year, month, day, iterator);
  s_dhuhr = build_prayer_time_next(year, month, day, iterator);
  s_asr = build_prayer_time_next(year, month, day, iterator);  
  s_maghrib = build_prayer_time_next(year, month, day, iterator);
  s_isha = build_prayer_time_next(year, month, day, iterator);  
  
  s_has_prayer_times = 1;  

  strftime(str_fajr, sizeof(str_fajr), "%H:%M", &s_fajr);  
  APP_LOG(APP_LOG_LEVEL_DEBUG, str_fajr);
  text_layer_set_text(s_fajr_layer, str_fajr);

  strftime(str_shurooq, sizeof(str_shurooq), "%H:%M", &s_shurooq); 
  APP_LOG(APP_LOG_LEVEL_DEBUG, str_shurooq);
  text_layer_set_text(s_shurooq_layer, str_shurooq);  
  
  strftime(str_dhuhr, sizeof(str_dhuhr), "%H:%M", &s_dhuhr); 
  APP_LOG(APP_LOG_LEVEL_DEBUG, str_dhuhr);  
  text_layer_set_text(s_dhuhr_layer, str_dhuhr);
  
  strftime(str_asr, sizeof(str_asr), "%H:%M", &s_asr); 
  APP_LOG(APP_LOG_LEVEL_DEBUG, str_asr);
  text_layer_set_text(s_asr_layer, str_asr);  

  strftime(str_maghrib, sizeof(str_maghrib), "%H:%M", &s_maghrib); 
  APP_LOG(APP_LOG_LEVEL_DEBUG, str_maghrib); 
  text_layer_set_text(s_maghrib_layer, str_maghrib);     
  
  strftime(str_isha, sizeof(str_isha), "%H:%M", &s_isha);  
  APP_LOG(APP_LOG_LEVEL_DEBUG, str_isha);
  text_layer_set_text(s_isha_layer, str_isha);  
}
开发者ID:matmar10,项目名称:pebble-adhan-watchface,代码行数:50,代码来源:main.c

示例3: inbox_received_callback

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
   //store incoming information
  static char temperature_buffer[8];
  static char conditions_buffer[32];
  
  //read first item
  Tuple *t = dict_read_first(iterator);

  //for all items
  while(t != NULL) {
    // which key was received?
    switch(t->key) {
    case KEY_TEMP:
      snprintf(temperature_buffer, sizeof(temperature_buffer), "%dC", (int)t->value->int32);
      break;
    case KEY_COND:
      snprintf(conditions_buffer, sizeof(conditions_buffer), "%s", t->value->cstring);
      break;
    default:
      APP_LOG(APP_LOG_LEVEL_ERROR, "Key %d not recognized!", (int)t->key);
      break;
    }

    //look for next item
    t = dict_read_next(iterator);
  }
  
  //assemble full string and display
  snprintf(weather_layer_buffer, sizeof(weather_layer_buffer), "%s  %s", temperature_buffer, conditions_buffer);
}
开发者ID:Akirakira,项目名称:ResiWatch,代码行数:30,代码来源:sample.c

示例4: in_received_handler

void in_received_handler(DictionaryIterator *iter, void *context) {
    /* get data */
    Tuple *t = dict_read_first(iter);
    while (t) {
        int key = t->key;
        
        char tmp[BUFSIZE] = "";
        strncpy(tmp, t->value->cstring, BUFSIZE);
        
        switch (key) {
            case STR_CHANGE_UP:
                strncpy(str_drink_up, tmp, BUFSIZE);
                text_layer_set_text(text_layer_top, str_drink_up);
                break;
            case STR_CHANGE_SELECT:
                strncpy(str_drink_select, tmp, BUFSIZE);
                text_layer_set_text(text_layer_center, str_drink_select);
                break;
            case STR_CHANGE_DOWN:
                strncpy(str_drink_down, tmp, BUFSIZE);
                text_layer_set_text(text_layer_bottom, str_drink_down);
                break;
        }
        
        /* get even more data */
        t = dict_read_next(iter);
    }
}
开发者ID:nilsding,项目名称:twoffein-pebble,代码行数:28,代码来源:twoffein_pebble.c

示例5: inbox_received_callback

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
  // Store incoming information
  static char temperature_buffer[8];
  static char conditions_buffer[32];
  static char weather_layer_buffer[32];
  
  // Read first item
  Tuple *t = dict_read_first(iterator);
  
  // For all items
  while(t != NULL) {
    switch(t->key) {
      case KEY_TEMPERATURE:
        snprintf(temperature_buffer, sizeof(temperature_buffer), "%dC", (int)t->value->int32);
        break;
      case KEY_CONDITIONS:
        snprintf(conditions_buffer, sizeof(conditions_buffer), "%s", t->value->cstring);
        break;
      default:
        APP_LOG(APP_LOG_LEVEL_ERROR, "KEY %d not recognized!", (int)t->key);
        break;
    }
    
    // Look for next item
    t = dict_read_next(iterator);
  }
  
  // Assemble the full string and display
  snprintf(weather_layer_buffer, sizeof(weather_layer_buffer), "%s, %s", temperature_buffer, conditions_buffer);
  text_layer_set_text(s_weather_layer, weather_layer_buffer);
}
开发者ID:bencentra,项目名称:pebble-tutorial,代码行数:31,代码来源:main.c

示例6: read_state_data

bool read_state_data(DictionaryIterator* received, struct Data* d){
	(void)d;
	bool has_data = false;
	Tuple* tuple = dict_read_first(received);
	if(!tuple) return false;
	do {
		switch(tuple->key) {
	  		case TUPLE_MISSED_CALLS:
				d->missed = tuple->value->uint8;
				
				static char temp_calls[5];
				memcpy(temp_calls, itoa(tuple->value->uint8), 4);
				text_layer_set_text(&calls_layer, temp_calls);
				
				has_data = true;
				break;
			case TUPLE_UNREAD_SMS:
				d->unread = tuple->value->uint8;
			
				static char temp_sms[5];
				memcpy(temp_sms, itoa(tuple->value->uint8), 4);
				text_layer_set_text(&sms_layer, temp_sms);
			
				has_data = true;
				break;
		}
	}
	while((tuple = dict_read_next(received)));
	return has_data;
}
开发者ID:Crewdawg,项目名称:ninety_weather,代码行数:30,代码来源:ninety_weather.c

示例7: inbox_received_callback

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
  
  APP_LOG(APP_LOG_LEVEL_INFO, "inbox callback success!");
  
  // Read first item
  Tuple *t = dict_read_first(iterator);
 
  // For all items
  while(t != NULL) {
    
    // Get string
    char colorString[strlen(t->value->cstring)+1];
    strcpy(colorString, t->value->cstring);
    const char s[2] = ",";
    char *token;
    int idx;
    
    /* get the first token */
    token = myStrtok(colorString, s);
    
    /* walk through other tokens */
    int count = 0;
    while( token != NULL ) 
    {
      idx = atoi( token );
      settings.colorIdx[count++] = idx;
      token = myStrtok(NULL, s);
    }
 
      // Look for next item
      t = dict_read_next(iterator);
    }
    window_set_background_color(s_main_window, (GColor8)allColors[settings.colorIdx[10]]);
    layer_mark_dirty(window_get_root_layer(s_main_window));
}
开发者ID:jinalex,项目名称:Pebble-Synesthesia,代码行数:35,代码来源:main.c

示例8: inbox_received_callback

static void inbox_received_callback(DictionaryIterator *iterator, void *context){
  static char temperature_buffer[8];
  static char conditions_buffer[32];
  static char weather_layer_buffer[32];
  
  Tuple *t = dict_read_first(iterator);
  
  while (t != NULL) {
    switch(t->key) {
      case KEY_TEMPERATURE:
        snprintf(temperature_buffer, sizeof(temperature_buffer), "%dC", (int)t->value->int32);
        break;
      case KEY_CONDITIONS:
        snprintf(conditions_buffer, sizeof(conditions_buffer), "%s", t->value->cstring);
        break;
      default:
        APP_LOG(APP_LOG_LEVEL_ERROR, "Key %d not recognised!", (int)t->key);
        break;
    }
    
    t = dict_read_next(iterator);
  }
  
  snprintf(weather_layer_buffer, sizeof(weather_layer_buffer), "%s, %s", temperature_buffer, conditions_buffer);
  text_layer_set_text(s_weather_layer, weather_layer_buffer);
}
开发者ID:sambeaven,项目名称:FirstPebbleFace,代码行数:26,代码来源:Main.c

示例9: inbox_received_callback

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
    static bool vibe = true;
    APP_LOG(APP_LOG_LEVEL_INFO, "Message received!");
    // Get the first pair
    Tuple *t = dict_read_first(iterator);

    static char text_buffer[MAX_MESSAGE_LENGTH];
    static char time_buffer[MAX_MESSAGE_LENGTH];
    static char message_buffer[MAX_MESSAGE_LENGTH];
    // Process all pairs present
    while(t != NULL) {
        // Process this pair's key
        switch (t->key) {
            case MESSAGE_TEXT_KEY:
                snprintf(text_buffer, sizeof(text_buffer), "%s", t->value->cstring);
                break;
            case MESSAGE_TIME_KEY:
                snprintf(time_buffer, sizeof(time_buffer), "%s", t->value->cstring);
                break;
        }

        // Get next pair, if any
        t = dict_read_next(iterator);
    }
    schedule(0, text_buffer);
    snprintf(message_buffer, sizeof(message_buffer), "Scheduled '%s' every day @%s ", text_buffer, time_buffer);
    notify(message_buffer, vibe);
}
开发者ID:szilardhuber,项目名称:pebble-forgetmenot,代码行数:28,代码来源:forgetmenot.c

示例10: inbox_received_callback

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
  // Get the first pair
  Tuple *t = dict_read_first(iterator);

  // Process all pairs present
  while (t != NULL) {
    // Long lived buffer
//     static char s_buffer[64];

    // Process this pair's key
    switch (t->key) {
      case 1:
        // Copy value and display8
//         snprintf(s_buffer, sizeof(s_buffer), "Received '%s'", t->value->cstring);
      circle_layer1 = layer_create(GRect(0, 0, 144, 50));
      
//         text_layer_set_text(s_output_layer, s_buffer);
          layer_set_update_proc(circle_layer1, draw_circle1_update_proc);
           layer_add_child(window_layer, circle_layer1);
        break;
      case 2:
      circle_layer2 = layer_create(GRect(0, 0, 144, 50));
          layer_set_update_proc(circle_layer2, draw_circle2_update_proc); 
          layer_add_child(window_layer, circle_layer2);
      break;
    }

    // Get next pair, if any
    t = dict_read_next(iterator);
  }
}
开发者ID:ttingt,项目名称:Supported,代码行数:31,代码来源:hello_world.c

示例11: in_recv_handler

static void in_recv_handler(DictionaryIterator *iterator, void *context)
{
  //Get Tuple
  Tuple *t = dict_read_first(iterator);
  while (t)
  {
    switch(t->key) {
    case KEY_INVERT:
      //It's the KEY_INVERT key
      inverted = (strcmp(t->value->cstring, "si") == 0);
      layer_set_hidden((Layer *)ILFondo, inverted);
 	  persist_write_bool(KEY_INVERT, inverted);
      break;
	  
	case KEY_IDIOMA:
      //It's the KEY_INVERT key
      if(strcmp(t->value->cstring, "1")==0)
      {
        //Set and save as inverted
		idioma=1;  
        persist_write_int(KEY_IDIOMA, 1);
      }
      else if(strcmp(t->value->cstring, "0")==0)
      {
        //Set and save as not inverted
		idioma = 0;
        persist_write_int(KEY_IDIOMA, 0);
      }
      break;
    }
	t = dict_read_next(iterator);
  }
}
开发者ID:manelto,项目名称:pizarra,代码行数:33,代码来源:main.c

示例12: app_message_read_card_payload

static void app_message_read_card_payload(DictionaryIterator *dict, int32_t card_index) {
    Tuple *tuple = dict_read_first(dict);
    if (!tuple) {
        APP_LOG(APP_LOG_LEVEL_ERROR, "[CARD %ld] dict_read_first -> NULL", card_index);
        return;
    }

    while (tuple) {
        uint32_t cstr_key = 0;
        uint32_t data_key = 0;
        switch (tuple->key) {
            case KEY_CARD_BALANCE:
                cstr_key = STORAGE_CARD_VALUE(BALANCE, card_index);
                break;
            case KEY_CARD_BARCODE_DATA:
                data_key = STORAGE_CARD_VALUE(BARCODE_DATA, card_index);
                break;
            case KEY_CARD_NAME:
                cstr_key = STORAGE_CARD_VALUE(NAME, card_index);
                break;
        }

        if (cstr_key) {
            persist_write_string(cstr_key, tuple->value->cstring);
        } else if (data_key) {
            persist_write_data(data_key, tuple->value->data, tuple->length);
        }

        tuple = dict_read_next(dict);
    }
}
开发者ID:henriwatson,项目名称:PebbleBucks,代码行数:31,代码来源:main.c

示例13: Process_Received_Data

static void Process_Received_Data(DictionaryIterator *iter, void *context){
	Tuple *t = dict_read_first(iter);
	 while(t != NULL){
		APP_LOG(APP_LOG_LEVEL_INFO, "something received");
		int key = t->key;
        int value = t->value->int32;
		char string_value[32];
		strcpy(string_value, t->value->cstring);	
		switch (key){
			case WEATHER_TEMPERATURE:
				APP_LOG(APP_LOG_LEVEL_INFO, string_value);
				snprintf(Weather_Buffer, sizeof(Weather_Buffer), "%s", string_value);
				text_layer_set_text(Weather_Text, Weather_Buffer);
				break;
			
			case WEATHER_CONDITIONS:
				gbitmap_destroy(Weather_Bitmap); 
				Weather_Bitmap = gbitmap_create_with_resource(Weather_icons[value]); 
				bitmap_layer_set_bitmap(Weather_Layer, Weather_Bitmap); 
				break;
			
			case SETTINGS_HOURLY_VIBE:
				Settings.Vibe_Hourly = value;
				break;
			
			case SETTINGS_BT_VIBE:
				Settings.Vibe_BT = value;
		}
		 
		 
        t = dict_read_next(iter);
    }	
}
开发者ID:GrakovNe,项目名称:Pebble-vic4884,代码行数:33,代码来源:main.c

示例14: inbox_received_handler

static void inbox_received_handler(DictionaryIterator *iterator, void *context) {
  // Get the first pair
  Tuple *t = dict_read_first(iterator);

  int key = (int)(t->key / 256);
  int menu_item_section = (int)((t->key % 256) / 16);
  int menu_item = (t->key % 16);
  // Process all pairs present
  while(t != NULL) {
    // Process this pair's key
    switch(key) {
      case KEY_STATUS:
      APP_LOG(APP_LOG_LEVEL_INFO, "STATUS for KEY %d is %d", key, (int)t->value->int32);
        menu_item_statuses[menu_item_section][menu_item] = get_status_text((int)t->value->int32);
        menu_layer_reload_data(s_menu_layer);
        break;
      case KEY_VIBRATE:
        // Trigger vibration
//         text_layer_set_text(s_text_layer, "Vibrate!");
        APP_LOG(APP_LOG_LEVEL_INFO, "Vibrate!");
        vibes_short_pulse();
        break;
      default:
        APP_LOG(APP_LOG_LEVEL_INFO, "Unknown key: %d", (int)t->key);
        break;
    }

    // Get next pair, if any
    t = dict_read_next(iterator);
  }
}
开发者ID:kvv20,项目名称:SwissArmyPebble,代码行数:31,代码来源:main.c

示例15: inbox_received_callback

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
	
  // Read first item
  Tuple *t = dict_read_first(iterator);

  text_layer_set_text( title_layer, title );
	
  // For all items
  while(t != NULL) {
    // Which key was received?
		APP_LOG(APP_LOG_LEVEL_DEBUG, "Loop index now %s", t->value->cstring);
    switch(t->key) {
    case KEY_ABSTRACT:
          snprintf(abstract, sizeof(abstract), "%s", t->value->cstring);			
      break;
    case KEY_TITLE:
          snprintf(title, sizeof(title), "%s", t->value->cstring);
      break;
    default:
      snprintf( title, sizeof(abstract), "%s", t->value->cstring );
      break;
    }
		text_layer_set_text( word_layer, abstract );// Look for next item
    app_timer_register( (200+10*( strlen(abstract) )), (AppTimerCallback) refresh, NULL);
    
		psleep(500);
    t = dict_read_next(iterator);
  }
  window_stack_pop(true);  
}
开发者ID:kyleliangus,项目名称:KeySpeedRead,代码行数:30,代码来源:main.c


注:本文中的dict_read_next函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。