Changeset 247 for cpp/frams/param/param.h
- Timestamp:
- 11/07/14 17:51:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/param.h
r230 r247 7 7 8 8 #include <stdio.h> 9 #include <stdint.h> 9 10 #include <frams/util/sstring.h> 10 11 #include <frams/util/list.h> … … 33 34 #define PARAM_DEPRECATED 8192 34 35 36 typedef int32_t paInt; 37 #define PA_INT_SCANF "%d" 38 35 39 // the result of param::set() is a combination of bits: 36 40 … … 92 96 93 97 virtual SString getString(int) = 0; ///< get string value, you can only use this for "s" type property 94 virtual longgetInt(int) = 0; ///< get long value, you can only use this for "d" type property98 virtual paInt getInt(int) = 0; ///< get long value, you can only use this for "d" type property 95 99 virtual double getDouble(int) = 0; ///< get double value, you can only use this for "f" type property 96 100 virtual ExtObject getObject(int) = 0; ///< get object reference, you can only use this for "o" type property … … 101 105 102 106 SString getStringById(const char*prop); ///< get string value, you can only use this for "s" type property 103 longgetIntById(const char* prop); ///< get long value, you can only use this for "d" type property107 paInt getIntById(const char* prop); ///< get long value, you can only use this for "d" type property 104 108 double getDoubleById(const char* prop);///< get double value, you can only use this for "f" type property 105 109 ExtObject getObjectById(const char* prop);///< get object reference, you can only use this for "o" type property … … 109 113 int setInt(int i, const char* str); 110 114 int setDouble(int i, const char* str); 111 virtual int setInt(int, long) = 0; ///< set long value, you can only use this for "d" type prop115 virtual int setInt(int, paInt) = 0; ///< set long value, you can only use this for "d" type prop 112 116 virtual int setDouble(int, double) = 0; ///< set double value, you can only use this for "f" type prop 113 117 virtual int setString(int, const SString &) = 0; ///< set string value, you can only use this for "s" type prop … … 119 123 int set(int, const char*); ///< oldstyle set, can convert string to long or double 120 124 121 int setIntById(const char* prop, long);///< set long value, you can only use this for "d" type prop125 int setIntById(const char* prop, paInt);///< set long value, you can only use this for "d" type prop 122 126 int setDoubleById(const char* prop, double);///< set double value, you can only use this for "f" type prop 123 127 int setStringById(const char* prop, const SString &);///< set string value, you can only use this for "s" type prop … … 128 132 /** get valid minimum, maximum and default value for property 'prop' 129 133 @return 0 if min/max/def information is not available */ 130 int getMinMax(int prop, long& minumum, long& maximum, long& def);134 int getMinMax(int prop, paInt& minumum, paInt& maximum, paInt& def); 131 135 /** get valid minimum, maximum and default value for property 'prop' 132 136 @return 0 if min/max/def information is not available */ … … 172 176 #define SETOFFSET(_proc_) ( (int (*)(void*,const ExtValue*)) &(FIELDSTRUCT :: _proc_ ## _statrick)) 173 177 174 #define FIELDOFFSET(_fld_) (( long)((char*)(&((FIELDSTRUCT*)&MakeCodeGuardHappy)->_fld_)-((char*)((FIELDSTRUCT*)&MakeCodeGuardHappy))))178 #define FIELDOFFSET(_fld_) ((intptr_t)((char*)(&((FIELDSTRUCT*)&MakeCodeGuardHappy)->_fld_)-((char*)((FIELDSTRUCT*)&MakeCodeGuardHappy)))) 175 179 176 180 #ifdef DEBUG 177 #define PARAM_ILLEGAL_OFFSET (( long)0xdeadbeef)181 #define PARAM_ILLEGAL_OFFSET ((intptr_t)0xdeadbeef) 178 182 #else 179 183 #define PARAM_ILLEGAL_OFFSET 0 … … 205 209 short group, flags; 206 210 const char *name, *type; 207 longoffset;211 intptr_t offset; 208 212 void *fun1; ///< procedure or get 209 213 void *fun2; ///< set … … 214 218 { 215 219 public: 216 ParamEntryConstructor(const char *_id, short _group = 0, short _flags = 0, const char *_name = 0, const char *_type = 0, long_offset = 0, void *_fun1 = 0, void *_fun2 = 0, const char *_help = 0)220 ParamEntryConstructor(const char *_id, short _group = 0, short _flags = 0, const char *_name = 0, const char *_type = 0, intptr_t _offset = 0, void *_fun1 = 0, void *_fun2 = 0, const char *_help = 0) 217 221 { 218 222 id = _id; group = _group; flags = _flags; name = _name; type = _type; offset = _offset; fun1 = _fun1; fun2 = _fun2; help = _help; … … 254 258 255 259 SString getString(int); 256 longgetInt(int);260 paInt getInt(int); 257 261 double getDouble(int); 258 262 ExtObject getObject(int); … … 270 274 } 271 275 272 int setInt(int, long);276 int setInt(int, paInt); 273 277 int setDouble(int, double); 274 278 int setString(int, const SString &);
Note: See TracChangeset
for help on using the changeset viewer.