Changeset 570

Show
Ignore:
Timestamp:
06/25/08 10:13:18 (5 months ago)
Author:
weyrick
Message:

fix visitors now that p3state is an enum

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rphp/runtime/var-test.cpp

    r569 r570  
    5959    int operator()(const RPHP::p3state &i) const 
    6060    { 
    61        if (i >= 0) { 
    62                std::cout << "i see a bool" << std::endl; 
    63        
    64        else { 
    65                std::cout << "i see a null" << std::endl; 
    66        
     61        if (i == RPHP::Null) { 
     62            std::cout << "i see a null" << std::endl; 
     63       
     64        else { 
     65            std::cout << "i see a bool" << std::endl; 
     66       
    6767        return i; 
    6868    } 
     
    105105    pvartype operator()(const double &i) const 
    106106    { 
    107                return PVAR_DOUBLE; 
     107        return PVAR_DOUBLE; 
    108108    } 
    109109 
    110110    pvartype operator()(const std::string &str) const 
    111111    { 
    112        return PVAR_STRING; 
     112        return PVAR_STRING; 
    113113    } 
    114114 
    115115    pvartype operator()(const php_hash &h) const 
    116116    { 
    117        return PVAR_HASH; 
     117        return PVAR_HASH; 
    118118    } 
    119119 
    120120    pvartype operator()(const RPHP::p3state &h) const 
    121121    { 
    122        return (h >= 0) ? PVAR_BOOL : PVAR_NULL; 
     122        (h == RPHP::Null) ? PVAR_NULL : PVAR_BOOL; 
    123123    } 
    124124 
     
    143143  void operator()(const double &i) const 
    144144  { 
    145          // nothing, already numeric 
     145        // nothing, already numeric 
    146146  } 
    147147 
    148148  void operator()(const php_hash &h) const 
    149149  { 
    150          var = (long)h.getSize(); 
     150        var = (long)h.getSize(); 
    151151  } 
    152152 
    153153    void operator()(const RPHP::p3state &h) const 
    154154  { 
    155          (h <= 0) ? var = 0l : var = 1l; 
     155        (h == RPHP::True) ? var = 1l : var = 0l; 
    156156  } 
    157157 
    158158  void operator()(const long &a) const { 
    159     // Do nothing - already correct type 
     159        // Do nothing - already correct type 
    160160  } 
    161161};