aboutsummaryrefslogtreecommitdiff
path: root/src/variable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/variable.cpp')
-rw-r--r--src/variable.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/variable.cpp b/src/variable.cpp
index f638dc9..ffc41a6 100644
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -327,7 +327,7 @@ Bu::String Variable::toString() const
327VarList Variable::toList() const 327VarList Variable::toList() const
328{ 328{
329 if( eType == typeList ) 329 if( eType == typeList )
330 return *this; 330 return *uVal.lVal;
331 return VarList( *this ); 331 return VarList( *this );
332} 332}
333 333
@@ -621,7 +621,7 @@ bool Variable::operator!=( const Variable &rhs ) const
621 621
622bool Variable::operator<( const Variable &rhs ) const 622bool Variable::operator<( const Variable &rhs ) const
623{ 623{
624 Type eTop = Bu::max( eType, rhs.eType ); 624 Type eTop = Bu::buMax( eType, rhs.eType );
625 switch( eTop ) 625 switch( eTop )
626 { 626 {
627 case typeNone: 627 case typeNone:
@@ -656,7 +656,7 @@ bool Variable::operator<( const Variable &rhs ) const
656 656
657bool Variable::operator>( const Variable &rhs ) const 657bool Variable::operator>( const Variable &rhs ) const
658{ 658{
659 Type eTop = Bu::max( eType, rhs.eType ); 659 Type eTop = Bu::buMax( eType, rhs.eType );
660 switch( eTop ) 660 switch( eTop )
661 { 661 {
662 case typeNone: 662 case typeNone:
@@ -691,7 +691,7 @@ bool Variable::operator>( const Variable &rhs ) const
691 691
692bool Variable::operator<=( const Variable &rhs ) const 692bool Variable::operator<=( const Variable &rhs ) const
693{ 693{
694 Type eTop = Bu::max( eType, rhs.eType ); 694 Type eTop = Bu::buMax( eType, rhs.eType );
695 switch( eTop ) 695 switch( eTop )
696 { 696 {
697 case typeNone: 697 case typeNone:
@@ -726,7 +726,7 @@ bool Variable::operator<=( const Variable &rhs ) const
726 726
727bool Variable::operator>=( const Variable &rhs ) const 727bool Variable::operator>=( const Variable &rhs ) const
728{ 728{
729 Type eTop = Bu::max( eType, rhs.eType ); 729 Type eTop = Bu::buMax( eType, rhs.eType );
730 switch( eTop ) 730 switch( eTop )
731 { 731 {
732 case typeNone: 732 case typeNone:
@@ -761,7 +761,7 @@ bool Variable::operator>=( const Variable &rhs ) const
761 761
762Variable Variable::operator+( const Variable &rhs ) const 762Variable Variable::operator+( const Variable &rhs ) const
763{ 763{
764 Type eTop = Bu::max( eType, rhs.eType ); 764 Type eTop = Bu::buMax( eType, rhs.eType );
765 switch( eTop ) 765 switch( eTop )
766 { 766 {
767 case typeNone: 767 case typeNone:
@@ -796,7 +796,7 @@ Variable Variable::operator+( const Variable &rhs ) const
796 796
797Variable Variable::operator-( const Variable &rhs ) const 797Variable Variable::operator-( const Variable &rhs ) const
798{ 798{
799 Type eTop = Bu::max( eType, rhs.eType ); 799 Type eTop = Bu::buMax( eType, rhs.eType );
800 switch( eTop ) 800 switch( eTop )
801 { 801 {
802 case typeNone: 802 case typeNone:
@@ -818,7 +818,7 @@ Variable Variable::operator-( const Variable &rhs ) const
818 throw Bu::ExceptionBase("You cannot subtract string values."); 818 throw Bu::ExceptionBase("You cannot subtract string values.");
819 819
820 case typeList: 820 case typeList:
821 throw Bu::ExceptionBase("You cannot subtract list values."); 821 return Variable( toList() - rhs.toList() );
822 822
823 case typeRef: 823 case typeRef:
824 throw Bu::ExceptionBase("You cannot subtract reference values."); 824 throw Bu::ExceptionBase("You cannot subtract reference values.");
@@ -831,7 +831,7 @@ Variable Variable::operator-( const Variable &rhs ) const
831 831
832Variable Variable::operator*( const Variable &rhs ) const 832Variable Variable::operator*( const Variable &rhs ) const
833{ 833{
834 Type eTop = Bu::max( eType, rhs.eType ); 834 Type eTop = Bu::buMax( eType, rhs.eType );
835 switch( eTop ) 835 switch( eTop )
836 { 836 {
837 case typeNone: 837 case typeNone:
@@ -866,7 +866,7 @@ Variable Variable::operator*( const Variable &rhs ) const
866 866
867Variable Variable::operator/( const Variable &rhs ) const 867Variable Variable::operator/( const Variable &rhs ) const
868{ 868{
869 Type eTop = Bu::max( eType, rhs.eType ); 869 Type eTop = Bu::buMax( eType, rhs.eType );
870 switch( eTop ) 870 switch( eTop )
871 { 871 {
872 case typeNone: 872 case typeNone:
@@ -1038,3 +1038,18 @@ Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, Variable &v )
1038 return ar; 1038 return ar;
1039} 1039}
1040 1040
1041VarList operator-( const VarList &rBase, const VarList &rSub )
1042{
1043 VarList lRet( rBase );
1044
1045 for( VarList::const_iterator i = rSub.begin(); i; i++ )
1046 {
1047 VarList::const_iterator k;
1048 for( k = lRet.begin(); k && *k != *i; k++ ) { }
1049 if( k )
1050 lRet.erase( k );
1051 }
1052
1053 return lRet;
1054}
1055