Changeset 329 for cpp/frams/_demos/loader_test_param.cpp
- Timestamp:
- 02/06/15 05:58:34 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/_demos/loader_test_param.cpp
r323 r329 13 13 After loading, objects are printed ("saved") to standard output. 14 14 Additional information and messages are printed to standard error. 15 You can redirect both streams if needed. 16 15 You can redirect one or both streams if needed. 16 17 A sample input file for this program is "loader_test_param.in", 18 so you can run this program from the "cpp" directory as 19 ./loader_test_param frams/_demos/loader_test_param.in 20 17 21 \include loader_test_param.cpp 18 22 */ … … 22 26 public: 23 27 SString text, longtext, deftext; 24 int i1, i2, i3;25 float f1, f2, f3;26 ExtValue x ;27 int notchanged, notloaded,notsaved;28 paInt i1, i2, i3, i4; 29 double f1, f2, f3, f4; 30 ExtValue x1, x2; 31 int notchanged, notloaded, notsaved; 28 32 }; 29 33 … … 31 35 ParamEntry data_paramtab[] = 32 36 { 33 { "Data", 1, 1 2, "data", },37 { "Data", 1, 16, "data", }, 34 38 { "text", 0, 0, "Text", "s 0 10", FIELD(text), }, // 10 = length limit 35 39 { "longtext", 0, 0, "Long text", "s 1", FIELD(longtext), }, // 1 = multiline, 0 = unlimited … … 38 42 { "i2", 0, 0, "Integer 2", "d -5 5 1", FIELD(i2), }, // [-5..5] integer, default=1 39 43 { "i3", 0, 0, "Integer 3", "d -1 3 0 ~Minus~Zero~One~Two~Three", FIELD(i3), }, // [0..3] + text labels (Param::getText()) 44 { "i4", 0, 0, "Integer 4", "d 0 10 15", FIELD(i4), }, // invalid default 40 45 { "f1", 0, 0, "Float 1", "d", FIELD(f1), }, // unrestricted float 41 46 { "f2", 0, 0, "Float 2", "f -100 100 -100", FIELD(f2), }, // [-100..100] float, default=-100 42 { "x", 0, 0, "Untyped", "x", FIELD(x), }, // any type (class ExtValue) 47 { "f3", 0, 0, "Float 3", "f -10 10", FIELD(f3), }, // [-10..10] float 48 { "f4", 0, 0, "Float 4", "f 1 -1 404", FIELD(f4), }, // unrestricted float (invalid min>max), default=44 49 { "x1", 0, 0, "Untyped 1", "x", FIELD(x1), }, // any type (class ExtValue) 50 { "x2", 0, 0, "Untyped 2", "x", FIELD(x2), }, // any type (class ExtValue) 43 51 { "notchanged", 0, PARAM_READONLY, "Read only field", "d", FIELD(notchanged), }, // neither load() nor setDefault() can change this 44 52 { "notloaded", 0, PARAM_DONTLOAD, "Unloadable field", "d", FIELD(notloaded), }, // load() does not change this … … 65 73 Param param(data_paramtab, &data); 66 74 67 data.notchanged =100;68 data.notloaded =200;75 data.notchanged = 100; 76 data.notloaded = 200; 69 77 70 78 loader.addObject(¶m); … … 91 99 for (int i = 0; i < param.getPropCount(); i++) 92 100 fprintf(stderr, "%s=%s\n", param.id(i), (const char*)param.getText(i)); 93 fprintf(stderr, "type of 'x' is: %s\n", (const char*)data.x.typeDescription()); 101 fprintf(stderr, "type of 'x1' is: %s\n", (const char*)data.x1.typeDescription()); 102 fprintf(stderr, "type of 'x2' is: %s\n", (const char*)data.x2.typeDescription()); 94 103 fprintf(stderr, "-----\n\n"); 95 104 param.save(&virt_stdout);
Note: See TracChangeset
for help on using the changeset viewer.