Ignore:
Timestamp:
06/03/15 17:57:46 (9 years ago)
Author:
sz
Message:

f0 parsing corrections and enhancements:

  • f0 genotype becomes invalid if any of its numeric fields can't be parsed
  • ParamInterface::set and ParamInterface::load2 return the error flag if a numeric parsing error occured
  • fixed a bug in load2 (was failing on quoted fields containing a comma)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/param/param.h

    r382 r393  
    5050#define PSET_HITMAX     8
    5151
     52#define PSET_NOPROPERTY 16
     53
     54#define PSET_PARSEFAILED        32
     55
    5256// useful combination: need to get and display the value so that a user knows that the value they tried to set has been rejected or changed
    53 #define PSET_WARN (PSET_RONLY | PSET_HITMIN | PSET_HITMAX)
    54 
    55 #define PSET_NOPROPERTY 16
     57#define PSET_WARN (PSET_RONLY | PSET_HITMIN | PSET_HITMAX | PSET_PARSEFAILED)
     58
    5659
    5760struct ParamEntry;
     
    162165        int saveprop(VirtFILE*, int i, const char* p, bool force = 0);
    163166        int load(VirtFILE*, bool warn_unknown_fields = true, bool *abortable = NULL, int *linenum = NULL);///< @return the number of fields loaded
    164         int load2(const SString &, int &);///< @return the number of fields loaded
     167        int load2(const SString &, int &);///< @return the number of fields loaded (or'ed with LOAD2_PARSE_FAILED if a parsing error was detected)
    165168
    166169        static const char* SERIALIZATION_PREFIX;
     170        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) ...
     171        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;
    167172
    168173#ifdef DEBUG
Note: See TracChangeset for help on using the changeset viewer.