Exemple #1
0
    void test_null()
    {
        xlnt::workbook wb;

        const auto datatypes =
        {
            xlnt::cell::type::empty,
            xlnt::cell::type::boolean,
            xlnt::cell::type::error,
            xlnt::cell::type::formula_string,
            xlnt::cell::type::number,
            xlnt::cell::type::shared_string
        };

        for (const auto &datatype : datatypes)
        {
            auto ws = wb.active_sheet();
            auto cell = ws.cell(xlnt::cell_reference(1, 1));

            cell.data_type(datatype);
            xlnt_assert(cell.data_type() == datatype);
            cell.clear_value();
            xlnt_assert(cell.data_type() == xlnt::cell::type::empty);
        }
    }
Exemple #2
0
amf_object::amf_object()
{
	ref = 1;
	bytearrayLen = 0;
	bytearrayValue = 0;
	clear_value();
}
Exemple #3
0
void clear_value(Value* value, int all) {
	if (all == 1) {
		if (value->next != NULL) clear_value(value->next, 1);
	}
	memset(value, 0, sizeof(Value));
	free(value);
	return;
}
Exemple #4
0
void clear_attribute(Attribute* attribute, int all) {
	if (all == 1) {
		if (attribute->next != NULL) clear_attribute(attribute->next, 1);
	}
	if (attribute->value != NULL) clear_value(attribute->value, 1);
	memset(attribute, 0, sizeof(Attribute));
	free(attribute);
	return;
}
Exemple #5
0
    void test_cell_formatted_as_date1()
    {
        xlnt::workbook wb;
        auto ws = wb.active_sheet();
        auto cell = ws.cell(xlnt::cell_reference(1, 1));

        cell.value(xlnt::datetime::today());
        cell.clear_value();
        xlnt_assert(!cell.is_date()); // disagree with openpyxl
        xlnt_assert(!cell.has_value());
    }
Exemple #6
0
gpg_error_t
_ksba_der_store_null (AsnNode node)
{
  if (node->type == TYPE_ANY)
    node->type = TYPE_NULL;

  if (node->type == TYPE_NULL)
    {
      clear_value (node);
      return 0;
    }
  else
    return gpg_error (GPG_ERR_INV_VALUE);
}
Exemple #7
0
//バリュを一つ消去
//input は"category=value"の形式で受け取る
void value_del(attribute_list* att_list, char* input) {
    Attribute *att_ptr;
    Value *value_ptr;
    Value *temp;
    char *category;
    char *value;
    char *tp;
    
    tp = strtok(input, " \"=");
    category = malloc(sizeof(tp));
    strcpy(category, tp);
    tp = strtok(NULL, " \"=");
    value = malloc(sizeof(tp));
    strcpy(value, tp);
    
    att_ptr = att_list->attribute;
    while (att_ptr != NULL) {
        if (strcmp(att_ptr->data, category)) {
            att_ptr = att_ptr->next;
            continue;
        }
        value_ptr = att_ptr->value;
        temp = NULL;
        while (value_ptr != NULL) {
            if (strcmp(value_ptr->data, value)) {
                temp = value_ptr;
                value_ptr = value_ptr->next;
                continue;
            }
            if (temp == NULL) att_ptr->value = value_ptr->next;
            else temp->next = value_ptr->next;
            clear_value(value_ptr, 0);
            att_ptr->vnum--;
            free(category);
            free(value);
            return;
        }
        att_ptr = att_ptr->next;
    }
    
    printf("input category or value not exit error\n");
    free(category);
    free(value);
    return;
}
Exemple #8
0
/* Copy all values from the tree SRC (with values store in SRCIMAGE)
   to the tree DST */
gpg_error_t
_ksba_der_copy_tree (AsnNode dst_root,
                     AsnNode src_root, const unsigned char *src_image)
{
  AsnNode s, d;

  s = src_root;
  d = dst_root;
  /* note: we use the is_any flags becuase an inserted copy may have
     already changed the any tag to the actual type */
  while (s && d && (s->type == d->type || d->flags.is_any))
    {
      if (d->flags.is_any)
        d->type = s->type;

      if (s->flags.in_array && s->right)
        {
          if (!_ksba_asn_insert_copy (d))
            return gpg_error (GPG_ERR_ENOMEM);
        }

      if ( !_ksba_asn_is_primitive (s->type) )
        ;
      else if (s->off == -1)
        clear_value (d);
      else
        store_value (d, src_image + s->off + s->nhdr, s->len);

      s = _ksba_asn_walk_tree (src_root, s);
      d = _ksba_asn_walk_tree (dst_root, d);
    }

  if (s || d)
    {
/*        fputs ("ksba_der_copy_tree: trees don't match\nSOURCE TREE:\n", stderr); */
/*        _ksba_asn_node_dump_all (src_root, stderr); */
/*        fputs ("DESTINATION TREE:\n", stderr); */
/*        _ksba_asn_node_dump_all (dst_root, stderr); */
      return gpg_error (GPG_ERR_ENCODING_PROBLEM);
    }
  return 0;
}
//---------------------------------------------------------------------------
float CalculateRules2(float hue, float saturation, float value, int color)
{ float ret_val,lower_sum=0;
  int RulesCounter=0;
  while (fuzzy_rules[RulesCounter].hue>=0)
  {  /*
     if (do_grey_scale || (strcmp(fuzzy_rules[RulesCounter].color,"white")
     && strcmp(fuzzy_rules[RulesCounter].color,"light_grey")
     && strcmp(fuzzy_rules[RulesCounter].color,"dark_grey")
     && strcmp(fuzzy_rules[RulesCounter].color,"black")))
     {
     */
     if (fuzzy_rules[RulesCounter].color==color)  /* calculate only rules of the same color */
     { /* hue functions */
       ret_val=color_value(fuzzy_rules[RulesCounter].hue,hue);
       if (ret_val==0) goto loop;
       /* saturation function */
       if (fuzzy_rules[RulesCounter].saturation==SATURATION_GREY) ret_val=ret_val*grey_value(saturation);
       if (fuzzy_rules[RulesCounter].saturation==SATURATION_ALMOST_GREY) ret_val=ret_val*almost_grey_value(saturation);
       if (fuzzy_rules[RulesCounter].saturation==SATURATION_TEND_GREY) ret_val=ret_val*tend_grey_value(saturation);
       if (fuzzy_rules[RulesCounter].saturation==SATURATION_MEDIUM_GREY) ret_val=ret_val*medium_grey_value(saturation);
       if (fuzzy_rules[RulesCounter].saturation==SATURATION_TEND_CLEAR) ret_val=ret_val*tend_clear_value(saturation);
       if (fuzzy_rules[RulesCounter].saturation==SATURATION_CLEAR) ret_val=ret_val*clear_value(saturation);
       if (ret_val==0) goto loop;
       /* value functions */
       if (fuzzy_rules[RulesCounter].value==VALUE_DARK) ret_val=ret_val*dark_value(value);
       if (fuzzy_rules[RulesCounter].value==VALUE_ALMOST_DARK) ret_val=ret_val*almost_dark_value(value);
       if (fuzzy_rules[RulesCounter].value==VALUE_TEND_DARK) ret_val=ret_val*tend_dark_value(value);
       if (fuzzy_rules[RulesCounter].value==VALUE_TEND_LIGHT) ret_val=ret_val*tend_light_value(value);
       if (fuzzy_rules[RulesCounter].value==VALUE_LIGHT) ret_val=ret_val*light_value(value);
       /* add the rule values */
       lower_sum=lower_sum+ret_val;
     }
loop:
     RulesCounter++;
  }
  return(lower_sum);
}
Exemple #10
0
void Fl_Input_Browser::popup()
{
    bool resize_only = false;

    if(!win || !win->visible()) 
    {
        Fl_Group::current(0);

        if(!win) {
            win = new ComboWindow(0,0,0,0);
            win->set_override();

            win->begin();
            list = new ComboBrowser(0,0,0,0);
            list->box(FL_FLAT_BOX);
            list->callback(ComboBrowser::browser_cb, this);
            list->when(FL_WHEN_CHANGED | FL_WHEN_RELEASE_ALWAYS | FL_WHEN_ENTER_KEY_ALWAYS);        
            list->end();

            win->end();
            win->box(FL_BORDER_BOX);

            win->combo = this;
            list->combo = this;
        }        

        share_list.other = this;
        list->list(&share_list);

        list->indented((type()&INDENTED) != 0);
        win->color(list->color());

    } else
        resize_only = true;

    list->layout();
    int W = list->max_width() + list->scrollbar.w() + list->box()->dw();
    int H = list->max_height() + box()->dh() + SIZE_GRIP;
    if(W > popup_maxw) W = popup_maxw;
    if(H > popup_maxh) H = popup_maxh;
    if(W < popup_minw) W = popup_minw;
    if(W < width()) W = width();
    if(H < popup_minh) H = popup_minh;

    int X = x(); int Y = y()+h();
    for (Fl_Widget *o = parent(); o; o = o->parent()) {
        X += o->x(); Y += o->y();
    }

    int down = Fl::h() - Y;
    int up = Y-h();
    if(H > down) {
        if(up > down) {
            Y = up-H;
            if (Y < 0) {
                Y = 0;
                H = up;
            }
        } else {
            H = down;
        }
    }
    if (X + W > Fl::w()) {
        X = Fl::w() - W;
        if (X < 0) {
            X = 0;
            W = Fl::w();
        }
    }

    win->resize(X,Y,W,H);
    win->layout();
    //int winW=W, winH=H;
    X=0,Y=0;
    win->box()->inset(X,Y,W,H);
    list->resize(X,Y,W,H-SIZE_GRIP);

    if(resize_only) return;

    set_value();
    redraw(FL_DAMAGE_VALUE);

    win->exec(0, true);
    win->hide();

    if(type()&NONEDITABLE) throw_focus();
    else Fl::focus(input());

    clear_value();
    redraw(FL_DAMAGE_VALUE);
}
Exemple #11
0
bool Fl_Button::clear()
{
    clear_changed();
    if (value()) {clear_value(); redraw(); return true;}
    return false;
}
Exemple #12
0
amf_object::~amf_object(void)
{
	clear_value();
}