Changeset 104 for cpp/gdk/param.cpp
- Timestamp:
- 07/23/13 18:15:30 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/gdk/param.cpp
r93 r104 231 231 } 232 232 233 const char* ParamInterface::SERIALIZATION_PREFIX="@Serialized:"; 234 233 235 int ParamInterface::saveprop(VirtFILE* f,int i,const char* p,bool force) 234 236 { … … 243 245 err|=(fputs(p,f)==EOF); fputc(':',f); 244 246 cr=0; 245 ws=get(i); 247 if (*typ=='x') 248 { 249 ExtValue ex; 250 get(i,ex); 251 ws=SString(SERIALIZATION_PREFIX)+ex.serialize(); 252 } 253 else 254 ws=get(i); 246 255 quoteTilde(ws); 247 256 w=ws; … … 497 506 { 498 507 ExtValue e; 499 if (isdigit(*v)||((*v=='-')&&isdigit(v[1]))) 500 { 501 if (strchr(v,'.')) e.setDouble(atof(v)); 502 else e.setInt(atol(v)); 508 const char* after; 509 if (!strncmp(v,SERIALIZATION_PREFIX,strlen(SERIALIZATION_PREFIX))) 510 { 511 after=e.deserialize(v+strlen(SERIALIZATION_PREFIX)); 512 if ((after==NULL)||(*after)) 513 FMprintf("ParamInterface","set",FMLV_WARN,"serialization format mismatch in %s.%s",(getName()?getName():"<Unknown>"),id(i)); 514 } 515 else if ((after=e.parseNumber(v))&&(*after==0)) //consumed the whole string 516 { 517 //OK! 503 518 } 504 519 else … … 566 581 long SimpleAbstractParam::getInt(int i) 567 582 { 568 staticExtValue v;583 ExtValue v; 569 584 ParamEntry *pe=entry(i); 570 585 if (pe->fun1) … … 582 597 double SimpleAbstractParam::getDouble(int i) 583 598 { 584 staticExtValue v;599 ExtValue v; 585 600 ParamEntry *pe=entry(i); 586 601 if (pe->fun1) … … 598 613 SString SimpleAbstractParam::getString(int i) 599 614 { 600 staticExtValue v;615 ExtValue v; 601 616 ParamEntry *pe=entry(i); 602 617 if (pe->fun1) … … 614 629 ExtObject SimpleAbstractParam::getObject(int i) 615 630 { 616 staticExtValue v;631 ExtValue v; 617 632 ParamEntry *pe=entry(i); 618 633 if (pe->fun1) … … 630 645 ExtValue SimpleAbstractParam::getExtValue(int i) 631 646 { 632 staticExtValue v;647 ExtValue v; 633 648 ParamEntry *pe=entry(i); 634 649 if (pe->fun1) … … 649 664 int SimpleAbstractParam::setInt(int i,long x) 650 665 { 651 staticExtValue v;666 ExtValue v; 652 667 ParamEntry *pe=entry(i); 653 668 if (pe->flags&PARAM_READONLY) return PSET_RONLY; 654 long xcopy=x; //only needed for helpful printed messages: retain original, requested value of x because it may be changed below669 long xcopy=x; //only needed for messageOnExceedRange(): retain original, requested value of x because it may be changed below 655 670 long a=0,b=0; 656 671 int result=0; … … 684 699 int SimpleAbstractParam::setDouble(int i,double x) 685 700 { 686 staticExtValue v;701 ExtValue v; 687 702 ParamEntry *pe=entry(i); 688 703 if (pe->flags&PARAM_READONLY) return PSET_RONLY; 689 double xcopy=x; //only needed for helpful printed messages: retain original, requested value of x because it may be changed below704 double xcopy=x; //only needed for messageOnExceedRange(): retain original, requested value of x because it may be changed below 690 705 double a=0,b=0; 691 706 int result=0; … … 719 734 int SimpleAbstractParam::setString(int i,const SString& x) 720 735 { 721 staticExtValue v;722 staticSString vs;736 ExtValue v; 737 SString vs; 723 738 const SString *xx=&x; 724 739 ParamEntry *pe=entry(i); 725 740 if (pe->flags&PARAM_READONLY) return PSET_RONLY; 726 SString xcopy=x; //only needed for helpful printed messages: retain original, requested value of x because it may be changed below741 SString xcopy=x; //only needed for messageOnExceedRange(): retain original, requested value of x because it may be changed below 727 742 const char* t=pe->type+1; 728 743 while(*t) if (*t==' ') break; else t++; … … 759 774 int SimpleAbstractParam::setObject(int i,const ExtObject& x) 760 775 { 761 staticExtValue v;776 ExtValue v; 762 777 ParamEntry *pe=entry(i); 763 778 if (pe->flags&PARAM_READONLY) return PSET_RONLY; 764 ExtObject xcopy=x; //only needed for helpful printed messages: retain original, requested value of x because it may be changed below779 ExtObject xcopy=x; //only needed for messageOnExceedRange(): retain original, requested value of x because it may be changed below 765 780 if (pe->fun2) 766 781 {
Note: See TracChangeset
for help on using the changeset viewer.