Changeset 720 for cpp/frams/param/param.h
- Timestamp:
- 01/14/18 11:24:22 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/param.h
r650 r720 28 28 #define PARAM_NOSTATIC 256 //< (FramScript) don't access this member in a static object (ClassName.field) 29 29 #define PARAM_CONST 512 //< (FramScript) constant value 30 #define PARAM_CANOMITNAME 1024 //< affects Param::save 2()/load2() - for example one-liners in f0 genetic encoding30 #define PARAM_CANOMITNAME 1024 //< affects Param::saveSingleLine()/loadSingleLine() - for example one-liners in f0 genetic encoding 31 31 #define PARAM_DONTLOAD 2048 //< Param::load() skips this field 32 32 #define PARAM_NOISOLATION 4096 //< don't use proxy object in master/slave interactions … … 170 170 void quickCopyFrom(ParamInterface *src); 171 171 172 enum FileFormat { FormatMultiLine, FormatSingleLine }; // FormatJSON in the future? 173 struct LoadOptions { 174 bool warn_unknown_fields; bool *abortable; int *linenum; int offset; bool parse_failed; 175 LoadOptions() : warn_unknown_fields(false), abortable(NULL), linenum(NULL), offset(0), parse_failed(false) {} 176 }; 177 172 178 int save(VirtFILE*, const char* altname = NULL, bool force = 0); 173 179 int saveprop(VirtFILE*, int i, const char* p, bool force = 0); 174 int load(VirtFILE*, bool warn_unknown_fields = true, bool *abortable = NULL, int *linenum = NULL);///< @return the number of fields loaded 175 int load2(const SString &, int &);///< @return the number of fields loaded (or'ed with LOAD2_PARSE_FAILED if a parsing error was detected) 180 181 int load(FileFormat format, VirtFILE*, LoadOptions *load_options = NULL);///< @return the number of fields loaded 182 int load(FileFormat format, const SString &, LoadOptions *load_options = NULL);///< @return the number of fields loaded 183 protected: 184 int loadMultiLine(VirtFILE*, LoadOptions &options);///< @return the number of fields loaded 185 int loadSingleLine(const SString &, LoadOptions &options);///< @return the number of fields loaded 186 public: 176 187 177 188 static const char* SERIALIZATION_PREFIX; 178 static const int LOAD2_PARSE_FAILED = (1 << 30); ///< this bit is set in return value from load2 if a parse error was detected while loading. usage: if (load2(...) & LOAD2_PARSE_FAILED) ...179 static const int LOAD2_IGNORE_PARSE_FAILED = (~LOAD2_PARSE_FAILED); ///< bitmask to be used if the parsing error is to be ignored. usage: int number_of_loaded_fields=load2(...) & LOAD2_IGNORE_PARSE_FAILED;180 189 181 190 static bool isValidTypeDescription(const char* t); … … 299 308 300 309 int isequal(int i, void* defdata); 301 void save 2(SString&, void *defdata, bool addcr = true, bool all_names = true);310 void saveSingleLine(SString&, void *defdata, bool addcr = true, bool all_names = true); 302 311 303 312 virtual void setDefault();
Note: See TracChangeset
for help on using the changeset viewer.