• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_value函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: type

etype::etype(const etype &var): type(ET_UNDEFINED), value(0x00)
{ set_type(var.type); set_value(var.value); }
开发者ID:jfmrod,项目名称:hpc-clust,代码行数:2,代码来源:etypes.cpp


示例2: snprintf

int KVConfig::set_value(const char *key, int v)
{
    char info[64];
    snprintf(info, sizeof(info), "%d", v);
    return set_value(key, info);
}
开发者ID:chenyq123,项目名称:3516a_sample,代码行数:6,代码来源:KVConfig.cpp


示例3: set_name

attribute* attribute::operator = (attribute* a)
{
    set_name(a->get_name());
    set_value(a->get_value());
    return this;
}
开发者ID:ivlab,项目名称:MinVR,代码行数:6,代码来源:attribute.cpp


示例4: mx_alarm

// *************************************************************************************************
// @fn          mx_alarm
// @brief       Set alarm time.
// @param       u8 line		LINE1
// @return      none
// *************************************************************************************************
void mx_alarm(u8 line)
{
	u8 select;
	s32 hours;
	s32 minutes;
        s32 softlen;
	u8 * str;
	
	// Clear display
	clear_display_all();

	// Keep global values in case new values are discarded
	hours 		= sAlarm.hour;
	minutes 	= sAlarm.minute;
        softlen=sAlarm.softlen;

	// Display HH:MM (LINE1) 
	str = int_to_array(hours, 2, 0);
	display_chars(LCD_SEG_L1_3_2, str, SEG_ON);
	display_symbol(LCD_SEG_L1_COL, SEG_ON);
	
	str = int_to_array(minutes, 2, 0);
	display_chars(LCD_SEG_L1_1_0, str, SEG_ON);

	str = int_to_array(softlen, 2, 0);
	display_chars(LCD_SEG_L2_1_0, str, SEG_ON);        
	display_chars(LCD_SEG_L2_3_2, " L", SEG_ON);                
	
	// Display "ALARM" (LINE2)
//	display_chars(LCD_SEG_L2_4_0, (u8 *)"ALARM", SEG_ON);
		
	// Init value index
	select = 0;	
		
	// Loop values until all are set or user breaks	set
	while(1) 
	{
		// Idle timeout: exit without saving 
		if (sys.flag.idle_timeout) break;
		
		// STAR (short): save, then exit 
		if (button.flag.star) 
		{
			// Store local variables in global alarm time
			sAlarm.hour = hours;
			sAlarm.minute = minutes;
                        sAlarm.softlen=softlen;
			// Set display update flag
			display.flag.line1_full_update = 1;
			break;
		}

		switch (select)
		{
			case 0:		// Set hour
                                        set_value(&hours, 2, 0, 0, 23, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_2, display_hours);
                                        select = 1;
                                        break;

			case 1:		// Set minutes
                                        set_value(&minutes, 2, 0, 0, 59, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_1_0, display_value);
                                        select = 2;
                                        break;
			case 2:		// Set L
                                        set_value(&softlen, 2, 3, 1, 59, SETVALUE_DISPLAY_VALUE + SETVALUE_FAST_MODE, LCD_SEG_L2_1_0, display_value);
                                        select = 0;
                                        break;
		}
	}
	
	// Clear button flag
	button.all_flags = 0;
	
	// Indicate to display function that new value is available
	display.flag.update_alarm = 1;
}
开发者ID:sneaky-tricky,项目名称:chronos,代码行数:82,代码来源:alarm.c


示例5: set_value

SJRotation::SJRotation(const SJVec3 &axis, float degrees)
{
   set_value(axis, degrees);
}
开发者ID:finite-difference,项目名称:ESFEA,代码行数:4,代码来源:SJRotation.cpp


示例6: get_code

bool C_GeneratorConfig::fromXml (C_XmlData          *P_data) {

  bool                      L_ret = true ;
  T_pXmlData_List           L_sectionList, L_subSectionList            ;
  T_XmlData_List::iterator  L_sectionListIt, L_subSectionListIt ;
  C_XmlData                *L_section, *L_subSection ;
  char                     *L_entity_value ;
  char                     *L_param_name, *L_param_value ;
  T_GeneratorConfigOption   L_param_code ;
  bool                      L_decode_param ;

  T_ConfigValue             L_configValue     ;
  
  if (P_data != NULL) {

    if ((L_sectionList = P_data->get_sub_data()) != NULL) {
      
      for(L_sectionListIt  = L_sectionList->begin() ;
	  L_sectionListIt != L_sectionList->end() ;
	  L_sectionListIt++) {
	
	L_section = *L_sectionListIt ;
	if (L_section != NULL) {
	  if (strcmp(L_section->get_name(), 
		     XML_CONFIG_SECTION) == 0) {

	    L_subSectionList = L_section->get_sub_data() ;
	    for(L_subSectionListIt  = L_subSectionList->begin() ;
		L_subSectionListIt != L_subSectionList->end() ;
		L_subSectionListIt++) {
	      L_subSection = *L_subSectionListIt ;
	      
	      if (strcmp(L_subSection->get_name(), 
			 XML_CONFIG_SUBSECTION) == 0) {

		L_entity_value = L_subSection->find_value(XML_CONFIG_ENTITY) ;
		if (L_entity_value != NULL) {

		  if (strcmp(L_entity_value, XML_CONFIG_ENTITY_VALUE) == 0) {
		    L_param_name = L_subSection->find_value(XML_CONFIG_NAME);
		    L_param_value = L_subSection->find_value(XML_CONFIG_VALUE);

		    L_param_code = get_code(L_param_name);

		    if (L_param_code != E_CFG_OPT_Number) {
		      L_decode_param = set_value (L_param_code, L_param_value) ;

		      if (L_decode_param == false) {
			GEN_ERROR(E_GEN_FATAL_ERROR, "Format incorrect for value ["
				  << L_param_value << "] for parameter ["
				  << L_param_name << "]");
			L_ret = false ;
			break ;
		      }
		    } else {
		      GEN_ERROR(E_GEN_FATAL_ERROR, "Unknown configuration parameter ["
				<< L_param_name << "]");
		      L_ret = false ;
		      break ;
		    }
		  }
		   if (strcmp(L_entity_value, XML_CONFIG_PARAM_ENTITY_VALUE) == 0) {
		    L_configValue.m_name = L_subSection->find_value(XML_CONFIG_NAME);
		    L_configValue.m_value = L_subSection->find_value(XML_CONFIG_VALUE);
		    m_configValueList->push_back(L_configValue);
		   }

		} 
	      }
	    }
	  }
	} 
      }

    } else {
      GEN_ERROR(E_GEN_FATAL_ERROR, "No Xml data");
      L_ret = false ;
    }
  } else { // P_data == NULL
    GEN_ERROR(E_GEN_FATAL_ERROR, "No Xml data");
    L_ret = false ;
  }


  return (L_ret);
}
开发者ID:Metaswitch,项目名称:clearwater-seagull,代码行数:86,代码来源:C_GeneratorConfig.cpp


示例7: mx_time

// *************************************************************************************************
// @fn          mx_time
// @brief       Clock set routine.
// @param       u8 line		LINE1, LINE2
// @return      none
// *************************************************************************************************
void mx_time(u8 line)
{
	u8 select;
	s32 timeformat;
	s16 timeformat1;
	s32 hours;
	s32 minutes;
	s32 seconds;
	s32 DailyCorrTmp;
    s32 WeeklyCorrTmp;
    s32 DST_AutoFlagTmp;
    
	u8 * str;
	
	// Clear display
    TimeAdjustmentFlag = 1;	
	clear_display_all();
	
    // Convert global time to local variables
	// Global time keeps on ticking in background until it is overwritten
	if (sys.flag.use_metric_units)
	{
		timeformat 	= TIMEFORMAT_24H;
	}
	else
	{
		timeformat 	= TIMEFORMAT_12H;
	}
	timeformat1	= timeformat;
	hours 		= sTime.hour; 
	minutes 	= sTime.minute;
	seconds 	= sTime.second;
	DailyCorrTmp  = DailyCorr;
	WeeklyCorrTmp = WeeklyCorr;
	DST_AutoFlagTmp = DST_AutoFlag;
	
	// Init value index
	select = 0;	
		
	// Loop values until all are set or user breaks	set
	while(1) 
	{
    	// Idle timeout: exit without saving 
		if (sys.flag.idle_timeout)
		{
			// Roll back time format
			if (timeformat1 == TIMEFORMAT_24H) 	sys.flag.use_metric_units = 1;
			else								sys.flag.use_metric_units = 0;
			display_symbol(LCD_SYMB_AM, SEG_OFF);
            TimeAdjustmentFlag = 0;
			break;
		}
		
		// Button STAR (short): save, then exit 
		if (button.flag.star) 
		{
			// Stop clock timer
			Timer0_Stop();

			// Store local variables in global clock time
			sTime.hour 	 = hours;
			sTime.minute = minutes;
			sTime.second = seconds;
	        DailyCorr    = DailyCorrTmp;
	        WeeklyCorr   = WeeklyCorrTmp;
	        DST_AutoFlag = DST_AutoFlagTmp;

			// Start clock timer
			Timer0_Start();
			
			// Full display update is done when returning from function
			display_symbol(LCD_SYMB_AM, SEG_OFF);
            TimeAdjustmentFlag = 0;
			break;
		}

		switch (select)
		{
			case 0:		// Clear LINE1 and LINE2 and AM icon - required when coming back from set_value(seconds)
						clear_display();
						display_symbol(LCD_SYMB_AM, SEG_OFF);
						
						// Set 24H / 12H time format
						set_value(&timeformat, 1, 0, 0, 1, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_SELECTION + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_1, display_selection_Timeformat1);
						
						// Modify global time format variable immediately to update AM/PM icon correctly
						if (timeformat == TIMEFORMAT_24H) 	sys.flag.use_metric_units = 1;
						else								sys.flag.use_metric_units = 0;
						select = 1;
						break;
			
			case 1:		// Display HH:MM (LINE1) and .SS (LINE2)
						str = itoa(hours, 2, 0);
						display_chars(LCD_SEG_L1_3_2, str, SEG_ON);
//.........这里部分代码省略.........
开发者ID:flamewow,项目名称:chronus,代码行数:101,代码来源:clock.c


示例8: set_value

void ColorMapInputWidget::slot_set_value()
{
    set_value(m_line_edit->text());
}
开发者ID:caomw,项目名称:appleseed,代码行数:4,代码来源:entityinputwidget.cpp


示例9: ompi_attr_copy_all

/*
 * Copy all the attributes from one MPI object to another
 */
int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object, 
                       void *new_object, opal_hash_table_t *oldattr_hash,
                       opal_hash_table_t *newattr_hash)
{
    int ret;
    int err;
    uint32_t key;
    int flag;
    void *node, *in_node;
    attribute_value_t *old_attr, *new_attr;
    ompi_attribute_keyval_t *hash_value;

    /* If there's nothing to do, just return */

    if (NULL == oldattr_hash) {
        return MPI_SUCCESS;
    }

    /* Lock this whole sequence of events -- don't let any other
       thread modify the structure of the attrbitue hash or bitmap
       while we're traversing it */

    OPAL_THREAD_LOCK(&attr_hash_lock);
    /* Get the first attribute in the object's hash */
    ret = opal_hash_table_get_first_key_uint32(oldattr_hash, &key, 
                                               (void **) &old_attr,
                                               &node);
    OPAL_THREAD_UNLOCK(&attr_hash_lock);

    /* While we still have some attribute in the object's key hash */
    while (OMPI_SUCCESS == ret) {
        in_node = node;

        /* Get the keyval in the main keyval hash - so that we know
           what the copy_attr_fn is */

	OPAL_THREAD_LOCK(&keyval_hash_lock);
        err = opal_hash_table_get_value_uint32(keyval_hash, key, 
                                               (void **) &hash_value);
	OPAL_THREAD_UNLOCK(&keyval_hash_lock);

        new_attr = OBJ_NEW(attribute_value_t);
        switch (type) {
        case UNUSED_ATTR:  /* keep the compiler happy */
            assert(0);
            break;
        case COMM_ATTR:
            /* Now call the copy_attr_fn */
            COPY_ATTR_CALLBACKS(communicator, old_object, hash_value, 
                                old_attr, new_object, new_attr);
            break;
            
        case TYPE_ATTR:
            /* Now call the copy_attr_fn */
            COPY_ATTR_CALLBACKS(datatype, old_object, hash_value, 
                                old_attr, new_object, new_attr);
            break;

        case WIN_ATTR:
            /* Now call the copy_attr_fn */
            COPY_ATTR_CALLBACKS(win, old_object, hash_value, 
                                old_attr, new_object, new_attr);
            break;
        }

        /* Hang this off the object's hash */
            
        /* The "predefined" parameter to ompi_attr_set() is set to 1,
           so that no comparison is done for prdefined at all and it
           just falls off the error checking loop in attr_set  */

        if (1 == flag) {
            if (0 != (hash_value->attr_flag & OMPI_KEYVAL_F77)) {
                if (0 != (hash_value->attr_flag & OMPI_KEYVAL_F77_MPI1)) {
                    new_attr->av_set_from = OMPI_ATTRIBUTE_FORTRAN_MPI1;
                } else {
                    new_attr->av_set_from = OMPI_ATTRIBUTE_FORTRAN_MPI2;
                }
            } else {
                new_attr->av_set_from = OMPI_ATTRIBUTE_C;
            }
            set_value(type, new_object, &newattr_hash, key, 
                      new_attr, true);

        } else {
            OBJ_RELEASE(new_attr);
        }

	OPAL_THREAD_LOCK(&attr_hash_lock);
        ret = opal_hash_table_get_next_key_uint32(oldattr_hash, &key, 
                                                  (void **) &old_attr, 
                                                  in_node, &node);
	OPAL_THREAD_UNLOCK(&attr_hash_lock);
    }

    /* All done */

//.........这里部分代码省略.........
开发者ID:bringhurst,项目名称:ompi,代码行数:101,代码来源:attribute.c


示例10: source

/*======== void my_main() ==========
  Inputs:   int polygons  
  Returns: 

  This is the main engine of the interpreter, it should
  handle most of the commadns in mdl.

  If frames is not present in the source (and therefore 
  num_frames is 1, then process_knobs should be called.

  If frames is present, the enitre op array must be
  applied frames time. At the end of each frame iteration
  save the current screen to a file named the
  provided basename plus a numeric string such that the
  files will be listed in order, then clear the screen and
  reset any other data structures that need it.

  Important note: you cannot just name your files in 
  regular sequence, like pic0, pic1, pic2, pic3... if that
  is done, then pic1, pic10, pic11... will come before pic2
  and so on. In order to keep things clear, add leading 0s
  to the numeric portion of the name. If you use sprintf, 
  you can use "%0xd" for this purpose. It will add at most
  x 0s in front of a number, if needed, so if used correctly,
  and x = 4, you would get numbers like 0001, 0002, 0011,
  0487

  05/17/12 09:41:35
  jdyrlandweaver
  ====================*/
void my_main( int polygons ) {

    int i, f, j, x;
    double step;
    double xval, yval, zval, knob_value;
    struct matrix *transform;
    struct matrix *tmp;
    struct stack *s;
    struct vary_node ** knobs;
    struct vary_node * link;
    screen t;
    color g;
    char q;
    
    num_frames = 1;
    step = 0.05;
    
    g.red = 0;
    g.green = 255;
    g.blue = 255;
    
    s = new_stack();
    tmp = new_matrix(4, 1000);
    clear_screen( t );
    
    first_pass();
    
    if(num_frames > 1)
        knobs = second_pass();
    
    int variables;
    
    for(variables = 0; variables < num_frames; variables++){
        s = new_stack();
        tmp = new_matrix(4,1000);
        clear_screen(t);
        
        for (j = 0; j < lastsym; j++){
            if(symtab[j].type == SYM_VALUE){
                link = knobs[variables];
                while (strcmp(link->name, symtab[j].name) != 0){
                    link = link->next;
                }
                if (link){
                    (&symtab[j])->s.value = link->value;
                }
            }
        }
        for (i=0;i<lastop;i++) {
            
            switch (op[i].opcode) {
                    
                case SET:
                    x = op[i].op.set.p->s.value;
                    set_value(lookup_symbol(op[i].op.set.p->name),x);
                    break;
                    
                case SETKNOBS:
                    x = op[i].op.setknobs.value;
                    for(j = 0; j < lastsym; j++){
                        if(symtab[j].type == SYM_VALUE){
                            set_value(&(symtab[j]), x);
                        }
                    }
                    
                case SPHERE:
                    add_sphere( tmp,op[i].op.sphere.d[0], //cx
                               op[i].op.sphere.d[1],  //cy
                               op[i].op.sphere.d[2],  //cz
                               op[i].op.sphere.r,
//.........这里部分代码省略.........
开发者ID:stuydw,项目名称:final,代码行数:101,代码来源:my_main.c


示例11: example_matrix_utilities


//.........这里部分代码省略.........
        return i;
      });

    cout << endl << "// map2() example:" << endl;

    cout << "cout << Y << endl;" << endl;
    cout << Y << endl;

    cout << "MatrixF A = Y;" << endl;
    MatrixF A = Y;


    cout << "cout << A << endl;" << endl;
    cout << A << endl;

    cout << "MatrixF B = Y;" << endl;
    MatrixF B = Y;

    cout << "cout << B << endl;" << endl;
    cout << B << endl;

    cout << "// Apply map2(): " << endl;
    cout << R"(map2(Y, A, B, [] (float a, float b) {
        return a + 2*b;
      });)" << endl << endl;

    map2(Y, A, B, [] (float a, float b) {
        return a + 2*b;
      });

    cout << "cout << Y << endl;" << endl;
    cout << Y << endl;

    cout << "// narrow() example:" << endl;

    i = 0;

    cout << R"(apply_sequential(Y, [&] (float a) {
        // Ignore the value of a.
        i += 1.0f;
        return i;
      });)" << endl;
    apply_sequential(Y, [&] (float a) {
        // Ignore the value of a.
        i += 1.0f;
        return i;
      });

    cout << "cout << Y << endl;" << endl;
    cout << Y << endl;

    cout << "MatrixF D = narrow(Y, 1, 1, 2);" << endl;
    MatrixF D = narrow(Y, 1, 1, 2);

    cout << "cout << D << endl;" << endl;
    cout << D << endl;

    cout << "// Now randomize D:" << endl;
    cout << "randomize_normal(D, 1.0f, 1.0f);" << endl;
    randomize_normal(D, 1.0f, 1.0f);

    cout << "cout << D << endl;" << endl;
    cout << D << endl;

    cout << "// Now copy data from D back into same locations in Y:" << endl;
    cout << "reverse_narrow(D, Y, 1, 1, 2);" << endl;
    reverse_narrow(D, Y, 1, 1, 2);

    cout << "cout << Y << endl;" << endl;
    cout << Y << endl;

    cout << "// Matrix multilication example:" << endl;
    cout << "MatrixF U(3,4);" << endl;
    MatrixF U(3,4);
    cout << "cout << U << endl;" << endl;
    cout << U << endl;
    cout << "randomize_uniform(U, -1.0f, 1.0f);" << endl;
    randomize_uniform(U, -1.0f, 1.0f);
    cout << "cout << U << endl;" << endl;
    cout << U << endl;
    cout << "MatrixF R(4,5);" << endl;
    MatrixF R(4,5);
    cout << "cout << R << endl;" << endl;
    cout << R << endl;
    cout << "set_value(R, 1.0f);" << endl;
    set_value(R, 1.0f);
    cout << "cout << R << endl;" << endl;
    cout << R << endl;    
    cout << "// Compute C = U*R:" << endl;
    cout << "MatrixF C;" << endl;
    MatrixF C;
    cout << "// Note: C has not been initialized to the required output dimensions but will be " << endl;
    cout << "// resized to the correct dimensions inside the matrix multiplication function." << endl;
    cout << "// Many of the matrix utility functions work like this (auto re-sizing of result)." << endl;
    cout << "mat_multiply(C, U, R);" << endl;
    mat_multiply(C, U, R);
    cout << "cout << C << endl;" << endl;
    cout << C << endl;

  }
开发者ID:bkvogel,项目名称:kumozu,代码行数:101,代码来源:ExamplesMatrix.cpp


示例12: Interaction

FreeResponseAnswer::FreeResponseAnswer(Util::UniqueID<Backend::Object> object_id, const string& answer) :
  Interaction(object_id)
{
  set_value(Util::kFreeResponseAnswerAttribute, answer);
}
开发者ID:pcostell,项目名称:playtolearn,代码行数:5,代码来源:FreeResponseAnswer.cpp


示例13: compile

/*
 * Reads each line from the input file, then malloc()s and populates main
 * data structures X, T, Y
 */
void compile(FILE *fin, t_clause ***X, t_clause ***T, t_clause ***Y, int *params, char *xs) {
	int r, value;
	int count = 0;
	t_fsm *fsmp = fsmparser();
	char line[LINLEN];
	char copy[LINLEN];
	char *token;
	char *op;
	char c;
	t_clause *cl;

	// used for keeping track of input and output symbols
	t_hashtable *inputs = hashtable(IN_HASHSIZE);
	t_hashtable *outputs = hashtable(OUT_HASHSIZE);
	t_hashtable *temps = hashtable(TMP_HASHSIZE);


	/* check hashtable pointers */
	if (!inputs || !outputs || !temps) {
		fprintf(stderr, "-- compile() : could not init hashtables\n");
		return;
	}

	/* process each line at a time */
	while (fgets(line, LINLEN, fin)) {
		int l = lincpy(line, copy, "\n\t\r;");

		if (l > 1) {

			/* initialize data structures */
			if (isdigit((c=copy[0]))) {

				token = strtok(copy, " ");
				value = atoi(token);
				token = strtok(NULL, " ");

				if (streq(token, "gates") || streq(token, "gate")) {
					*T = malloc(value*sizeof(t_clause*));
					params[2]=value;
					r = next(fsmp, LEN);
				} else if (streq(token, "inputs")) {
					*X = malloc(value*sizeof(t_clause*));
					params[0]=value;
					r = next(fsmp, IN);
				} else if (streq(token, "outputs")) {
					*Y = malloc(value*sizeof(t_clause*));
					params[1]=value;
					r = next(fsmp, OUT);
				} else
					r = next(fsmp, ERR);
			}

			/* line == 'begin' or line == 'end' */
			else if (streq(copy, "begin")) 		r = next(fsmp, PROG);
			else if (streq(copy, "end"))		r = next(fsmp, END);

			/* list of input symbols */
			else if (getstate(fsmp) == IN) {
				token=strtok(copy, " ");
				while (token)	{
					cl = clause(NULL, NULL, NULL, token, count);
					printf("0x%x @ %s ", cl, get_clause_name(cl));
					if (xs) {
						int xval = -48;
						bool b;
						xval += (count < strlen(xs)) ? xs[count] : 48;
						b = (!xval) ? FALSE : TRUE;
						set_value(cl, b);
						printf("= %d", b);
					}
					(*X)[count++] = cl;
					put_clause(inputs, cl);
					printf("\n");
					token = strtok(NULL, " ");
				}
				count=0;
			}

			/* list of output symbols */
			else if (getstate(fsmp) == OUT) {
				token = strtok(copy, " ");
				while (token) {
					cl = clause(NULL, NULL, NULL, token, count++);
					put_clause(outputs, cl);
					printf("0x%x @ %s\n", cl, get_clause_name(cl));
					token=strtok(NULL, " ");
				}
				count=0;
			}

			/* parse clauses */
			else if (getstate(fsmp) == PROG) {

				token = strtok(copy, "= ");
				t_clause *target = find_clause(outputs, token);
				char *lcname, *rcname, *op;
//.........这里部分代码省略.........
开发者ID:wcapraro,项目名称:SLPToolKit,代码行数:101,代码来源:parseutils.c


示例14: mutate_value

	void mutate_value(const std::string& key, const variant& value) {
		set_value(key, value);
	}
开发者ID:BrittzXD,项目名称:silvertree,代码行数:3,代码来源:formula_callable.hpp


示例15: switch

void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {

	if (!is_editable()) {
		return;
	}

	Ref<InputEventMouseButton> mb = p_event;

	if (mb.is_valid() && mb->is_pressed()) {

		bool up = mb->get_position().y < (get_size().height / 2);

		switch (mb->get_button_index()) {

			case BUTTON_LEFT: {

				set_value(get_value() + (up ? get_step() : -get_step()));

				range_click_timer->set_wait_time(0.6);
				range_click_timer->set_one_shot(true);
				range_click_timer->start();

				line_edit->grab_focus();
			} break;
			case BUTTON_RIGHT: {

				set_value((up ? get_max() : get_min()));
				line_edit->grab_focus();
			} break;
			case BUTTON_WHEEL_UP: {
				if (line_edit->has_focus()) {

					set_value(get_value() + get_step() * mb->get_factor());
					accept_event();
				}
			} break;
			case BUTTON_WHEEL_DOWN: {
				if (line_edit->has_focus()) {

					set_value(get_value() - get_step() * mb->get_factor());
					accept_event();
				}
			} break;
		}
	}

	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == 1) {

		//set_default_cursor_shape(CURSOR_VSIZE);
		Vector2 cpos = Vector2(mb->get_position().x, mb->get_position().y);
		drag.mouse_pos = cpos;
	}

	if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == 1) {

		//set_default_cursor_shape(CURSOR_ARROW);
		range_click_timer->stop();

		if (drag.enabled) {
			drag.enabled = false;
			Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
			warp_mouse(drag.capture_pos);
		}
	}

	Ref<InputEventMouseMotion> mm = p_event;

	if (mm.is_valid() && mm->get_button_mask() & 1) {

		Vector2 cpos = mm->get_position();

		if (drag.enabled) {

			float diff_y = drag.mouse_pos.y - cpos.y;
			diff_y = Math::pow(ABS(diff_y), 1.8f) * SGN(diff_y);
			diff_y *= 0.1;

			drag.mouse_pos = cpos;
			drag.base_val = CLAMP(drag.base_val + get_step() * diff_y, get_min(), get_max());

			set_value(drag.base_val);

		} else if (drag.mouse_pos.distance_to(cpos) > 2) {

			Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED);
			drag.enabled = true;
			drag.base_val = get_value();
			drag.mouse_pos = cpos;
			drag.capture_pos = cpos;
		}
	}
}
开发者ID:Bonfi96,项目名称:godot,代码行数:92,代码来源:spin_box.cpp


示例16: mx_altitude

// *************************************************************************************************
// @fn          mx_altitude
// @brief       Mx button handler to set the altitude offset. 
// @param       u8 line		LINE1
// @return      none
// *************************************************************************************************
void mx_altitude(u8 line)
{
	s32 altitude;
	s32	limit_high, limit_low;

	// Clear display
	clear_display_all();

	// Set lower and upper limits for offset correction
	if (sys.flag.use_metric_units)
	{
		// Display "m" symbol
		display_symbol(LCD_UNIT_L1_M, SEG_ON);

		// Convert global variable to local variable
		altitude  = sAlt.altitude; 

		// Limits for set_value function
		limit_low = -100;
		limit_high = 4000;
	}
	else // English units
	{
		// Display "ft" symbol
		display_symbol(LCD_UNIT_L1_FT, SEG_ON);
		
		// Convert altitude in meters to feet
		altitude = sAlt.altitude;

 		// Convert from meters to feet
		altitude = convert_m_to_ft(altitude);		

		// Limits for set_value function
		limit_low = -500;
		limit_high = 9999;
	}

	// Loop values until all are set or user breaks	set
	while(1) 
	{
		// Idle timeout: exit without saving 
		if (sys.flag.idle_timeout) break;

		// Button STAR (short): save, then exit 
		if (button.flag.star) 
		{
			// When using English units, convert ft back to m before updating pressure table
			if (!sys.flag.use_metric_units) altitude = convert_ft_to_m((s16)altitude);

			// Update pressure table
			update_pressure_table((s16)altitude, sAlt.pressure, sAlt.temperature);
			
			// Set display update flag
			display.flag.line1_full_update = 1;

			break;
		}

		// Set current altitude - offset is set when leaving function
		set_value(&altitude, 4, 3, limit_low, limit_high, SETVALUE_DISPLAY_VALUE + SETVALUE_FAST_MODE + SETVALUE_DISPLAY_ARROWS, LCD_SEG_L1_3_0, display_value1);
	}		
	
	// Clear button flags
	button.all_flags = 0;
}
开发者ID:bombela,项目名称:AbstractEZ430,代码行数:71,代码来源:altitude.c


示例17: set_value

bool attribute::set_value(std::string value) {
  return set_value((char *)value.c_str());
}
开发者ID:ivlab,项目名称:MinVR,代码行数:3,代码来源:attribute.cpp


示例18: set_type

etype &etype::operator=(const etype &var)
{
  set_type(var.type);
  set_value(var.value);
  return(*this);
}
开发者ID:jfmrod,项目名称:hpc-clust,代码行数:6,代码来源:etypes.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_vector函数代码示例发布时间:2022-05-30
下一篇:
C++ set_val函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap