- Timestamp:
- 01/26/15 07:31:30 (10 years ago)
- Location:
- cpp/frams/_demos
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/_demos/loader_test_param.cpp
r308 r311 21 21 { 22 22 public: 23 SString text, longtext ;23 SString text, longtext, deftext; 24 24 int i1, i2, i3; 25 25 float f1, f2, f3; 26 26 ExtValue x; 27 int notchanged,notloaded,notsaved; 27 28 }; 28 29 … … 30 31 ParamEntry data_paramtab[] = 31 32 { 32 { "Data", 1, 8, "data", },33 { "Data", 1, 12, "data", }, 33 34 { "text", 0, 0, "Text", "s 0 10", FIELD(text), }, // 10 = length limit 34 35 { "longtext", 0, 0, "Long text", "s 1", FIELD(longtext), }, // 1 = multiline, 0 = unlimited 36 { "deftext", 0, 0, "Text with default value", "s 0 0 some text", FIELD(deftext), }, 35 37 { "i1", 0, 0, "Integer 1", "d", FIELD(i1), }, // unrestricted integer 36 38 { "i2", 0, 0, "Integer 2", "d -5 5 1", FIELD(i2), }, // [-5..5] integer, default=1 37 { "i3", 0, 0, "Integer 3", "d 0 3 0~Zero~One~Two~Three", FIELD(i3), }, // [0..3] + text labels (Param::getText())39 { "i3", 0, 0, "Integer 3", "d -1 3 0 ~Minus~Zero~One~Two~Three", FIELD(i3), }, // [0..3] + text labels (Param::getText()) 38 40 { "f1", 0, 0, "Float 1", "d", FIELD(f1), }, // unrestricted float 39 41 { "f2", 0, 0, "Float 2", "f -100 100 -100", FIELD(f2), }, // [-100..100] float, default=-100 40 42 { "x", 0, 0, "Untyped", "x", FIELD(x), }, // any type (class ExtValue) 43 { "notchanged", 0, PARAM_READONLY, "Read only field", "d", FIELD(notchanged), }, // neither load() nor setDefault() can change this 44 { "notloaded", 0, PARAM_DONTLOAD, "Unloadable field", "d", FIELD(notloaded), }, // load() does not change this 45 { "notsaved", 0, PARAM_DONTSAVE, "Unsaveable field", "d", FIELD(notsaved), }, // save() skips this field 41 46 { 0, 0, 0, }, 42 47 }; … … 59 64 Data data; 60 65 Param param(data_paramtab, &data); 66 67 data.notchanged=100; 68 data.notloaded=200; 61 69 62 70 loader.addObject(¶m); … … 82 90 case MultiParamLoader::BeforeObject: 83 91 fprintf(stderr, "----- object found, loading...\n"); 92 data.notchanged++; 84 93 param.setDefault(); //reset (initialize) struct contents 85 94 break; -
cpp/frams/_demos/loader_test_param.in
r307 r311 9 9 333\ \\ 10 10 4444~ 11 deftext:other 11 12 i1:-12345 12 13 i2:10 … … 15 16 f2:222 16 17 x:3.14 18 notloaded:44 19 unchanged:444 20 notsaved:4444 17 21 18 22 #all fields except x will have default values … … 25 29 i2:-99999 26 30 i3:99999 31 x:@Serialized:[1,2,3,1.00000,2e0,3.0,"x","]","\""] 27 32 33 data: 34 i1:0x100 35 i2:1e2 36 i3:-10 37 x:@Serialized:{"a":[1,2,3],"b":"abc","c":1.23}
Note: See TracChangeset
for help on using the changeset viewer.