Changeset 16367


Ignore:
Timestamp:
10/10/13 14:09:25 (11 years ago)
Author:
Mathieu Morlighem
Message:

NEW: added StringToEnum return -1 if not found

Location:
issm/trunk-jpl/src/c/shared/Enum
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/shared/Enum/Enum.h

    r14974 r16367  
    66const char* EnumToStringx(int enum_in);
    77void        EnumToStringx(char** string,int enum_in);
    8 int         StringToEnumx(const char* string_in);
     8int         StringToEnumx(const char* string_in,bool notfounderror=true);
    99
    1010#endif
  • issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp

    r16343 r16367  
    1212#include "../Exceptions/exceptions.h"
    1313
    14 int  StringToEnumx(const char* name){
     14int  StringToEnumx(const char* name,bool notfounderror){
    1515
    1616   int  stage=1;
     
    619619   }
    620620        /*If we reach this point, the string provided has not been found*/
    621         _error_("Enum " << name << " not found");
     621        if(notfounderror)
     622                _error_("Enum " << name << " not found");
     623        else
     624                return -1;
    622625}
  • issm/trunk-jpl/src/c/shared/Enum/Synchronize.sh

    r15690 r16367  
    7373#include "../Exceptions/exceptions.h"
    7474
    75 int  StringToEnumx(const char* name){
     75int  StringToEnumx(const char* name,bool notfounderror){
    7676
    7777   int  stage=1;
     
    9797cat <<END >> $ISSM_DIR/src/c/shared/Enum/StringToEnumx.cpp
    9898        /*If we reach this point, the string provided has not been found*/
    99         _error_("Enum " << name << " not found");
     99        if(notfounderror)
     100                _error_("Enum " << name << " not found");
     101        else
     102                return -1;
    100103}
    101104END
Note: See TracChangeset for help on using the changeset viewer.