- Timestamp:
- 09/27/17 12:17:31 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/param.cpp
r659 r704 702 702 } 703 703 704 SString ParamInterface::getText(int i) 704 SString ParamInterface::getText(int i) //find the current enum text or call get(i) if not enum 705 705 { 706 706 const char *t; 707 if (( *(t = type(i))) == 'd')707 if (((*(t = type(i))) == 'd') && (strchr(t, '~')!=NULL)) //type is int and contains enum labels 708 708 { 709 709 paInt mn, mx, def; … … 712 712 { 713 713 if (value > mx) 714 return get(i); 714 return get(i);//unexpected value of out bounds (should never happen) -> fallback 715 715 value -= mn; 716 716 } 717 if (value < 0) return get(i); 718 for (; value >= 0; value--) if (t) t = strchr(t + 1, '~'); 719 if (t) 717 if (value < 0) return get(i); //unexpected value of out bounds (should never happen) -> fallback 718 // now value is 0-based index of ~text 719 for (; value >= 0; value--) if (t) t = strchr(t + 1, '~'); else break; 720 if (t) // found n-th ~text in type description (else: not enough ~texts in type description) 720 721 { 721 722 t++; … … 725 726 } 726 727 } 727 return get(i); 728 return get(i); //fallback - return int value as string 728 729 } 729 730
Note: See TracChangeset
for help on using the changeset viewer.