void VcsBaseClientSettings::setValue(const QString &key, const QVariant &v)
{
    if (SettingValue::isUsableVariantType(valueType(key))) {
        d->m_valueHash.insert(key, SettingValue(v));
        d->m_binaryFullPath.clear();
    }
}
QDeclarativeValueTypeFactory::QDeclarativeValueTypeFactory()
{
    static int isGuiApp = -1;
    memset(valueTypes, 0, sizeof(valueTypes));
    /*FIXME: is there a better way to tell if an app is Gui or not?*/
    if (isGuiApp == -1)
        isGuiApp = (int) qApp->inherits("QGuiApplication");
    // ### Optimize
    for (unsigned int ii = 0; ii <= QVariant::LastCoreType; ++ii)
        valueTypes[ii] = valueType(ii);

    if (isGuiApp) {
        for (unsigned int ii = QVariant::LastCoreType + 1; ii < (QVariant::UserType - 1); ++ii)
            valueTypes[ii] = valueType(ii);
    }
}
Exemple #3
0
UInt8 QueryReader::followingType() {
	if (_type)
		return _type;

	bool hasProperty(false);
	Util::ForEachParameter forEach([this,&hasProperty](const string& key, const char* value) {
		if (value) {
			_property = std::move(key);
			hasProperty = true;
			_value.assign(value);
		} else
			_value = std::move(key);
		return false; // we just want the first following key
	});

	if (Util::UnpackQuery(STR packet.current(), packet.available(), forEach) == 0)
		return END;

	if (hasProperty)
		_type = OBJECT;
	else
		_type = valueType();
	
	return _type;
}
Exemple #4
0
bool QueryReader::readOne(UInt8 type, DataWriter& writer) {
	
	const UInt8* cur = packet.current();
	const UInt8* end = cur+packet.available();
	if (type==OBJECT) {

		// OBJECT
		writer.beginObject();
		do {
			cur = packet.current();
			writer.writePropertyName(_property.c_str());
			writeValue(valueType(), writer);

			// next!
			while (cur<end && *cur != '&')
				cur++;
			packet.next(cur-packet.current() + (*cur=='&'));

			_type = END;
		} while (cur<end && (_type=followingType())==OBJECT);
		writer.endObject();
		return true;
	}

	writeValue(type, writer);

	// next!
	while (cur<end && *cur != '&')
		cur++;
	packet.next(cur-packet.current() + (*cur=='&'));
	_type = END;
	return true;
}
Exemple #5
0
EmojicodeInstruction Type::boxIdentifier() const {
    EmojicodeInstruction value;
    switch (type()) {
        case TypeType::ValueType:
        case TypeType::Enum:
            value = valueType()->boxIdFor(genericArguments_);
            break;
        case TypeType::Callable:
        case TypeType::Class:
        case TypeType::Someobject:
            value = T_OBJECT;
            break;
        case TypeType::NoReturn:
        case TypeType::Protocol:
        case TypeType::MultiProtocol:
        case TypeType::Something:
        case TypeType::GenericVariable:
        case TypeType::LocalGenericVariable:
        case TypeType::Error:
            return 0;  // This can only be executed in the case of a semantic error, return any value
        case TypeType::StorageExpectation:
        case TypeType::Extension:
            throw std::logic_error("Box identifier for StorageExpectation/Extension");
    }
    return remotelyStored() ? value | REMOTE_MASK : value;
}
Exemple #6
0
static inline std::wstring registerDescription(const DEBUG_REGISTER_DESCRIPTION &d)
{
    std::wostringstream str;
    str << valueType(d.Type);
    if (d.Flags & DEBUG_REGISTER_SUB_REGISTER)
        str << ", sub-register of " << d.SubregMaster;
    return str.str();
}
Exemple #7
0
void CudaCSRMatrix::initOnDevice()
{
    m_deviceValue->create(numNonZero() * valueType());
    m_deviceRowPtr->create((dimension() + 1) * 4);
    m_deviceColInd->create(numNonZero() * 4);
    
    m_deviceRowPtr->hostToDevice(rowPtr());
    m_deviceColInd->hostToDevice(colInd());
}
ExpressionResult StackExpressionResult::pop()
{
    if(!(size()>0)) {
        FatalErrorIn("StackExpressionResult::pop()")
            << "Trying to pop result from a empty queue"
                << endl
                << abort(FatalError);

        return ExpressionResult();
    }

    if(valueType()==pTraits<scalar>::typeName) {
        return popInternal<scalar>();
    } else if(valueType()==pTraits<vector>::typeName) {
        return popInternal<vector>();
    } else if(valueType()==pTraits<tensor>::typeName) {
        return popInternal<tensor>();
    } else if(valueType()==pTraits<symmTensor>::typeName) {
        return popInternal<symmTensor>();
    } else if(valueType()==pTraits<sphericalTensor>::typeName) {
        return popInternal<sphericalTensor>();
    } else {
            FatalErrorIn("StackExpressionResult::pop()")
                << " Unsopported value type " << valueType()
                    << endl
                    << abort(FatalError);

            return ExpressionResult();
    }
}
Exemple #9
0
void ZArray::printInfo()
{
  if (m_data == NULL) {
    std::cout << "Empty array: null data" << std::endl;
  } else {
    if (ndims() == 0) {
      std::cout << "Empty array: 0-dimentional" << std::endl;
    } else {
      std::cout << "Array(#): " << mylib::Array_Refcount(m_data) << std::endl;
      std::cout << "  size: " << dim(0);
      for (int i = 1; i < ndims(); i++) {
        std::cout << " x " << dim(i);
      }
      std::cout << std::endl;

      switch (valueType()) {
      case mylib::UINT8_TYPE:
        std::cout << "  uint8" << std::endl;
        break;
      case mylib::UINT16_TYPE:
        std::cout << "  uint16" << std::endl;
        break;
      case mylib::UINT32_TYPE:
        std::cout << "  uint32" << std::endl;
        break;
      case mylib::UINT64_TYPE:
        std::cout << "  uint64" << std::endl;
        break;
      case mylib::INT8_TYPE:
        std::cout << "  int8" << std::endl;
        break;
      case mylib::INT16_TYPE:
        std::cout << "  int16" << std::endl;
        break;
      case mylib::INT32_TYPE:
        std::cout << "  int32" << std::endl;
        break;
      case mylib::INT64_TYPE:
        std::cout << "  int64" << std::endl;
        break;
      case mylib::FLOAT32_TYPE:
        std::cout << "  single float" << std::endl;
      case mylib::FLOAT64_TYPE:
        std::cout << "  double float" << std::endl;
      default:
          std::cout << "  unknown type" << std::endl;
      }
    }
  }
}
Exemple #10
0
void Type::objectVariableRecords(int index, std::vector<T> *information, Us... args) const {
    switch (type()) {
        case TypeType::ValueType: {
            if (storageType() == StorageType::Box) {
                information->push_back(T(index, ObjectVariableType::Box, args...));
                return;
            }

            auto optional = storageType() == StorageType::SimpleOptional;
            auto size = information->size();
            for (auto variable : valueType()->instanceScope().map()) {
                // TODO:               auto vindex = index + variable.second.id() + (optional ? 1 : 0);
                // variable.second.type().objectVariableRecords(vindex, information, args...);
            }
            if (optional) {
                auto info = T(static_cast<unsigned int>(information->size() - size), index,
                              ObjectVariableType::ConditionalSkip, args...);
                information->insert(information->begin() + size, info);
            }
            return;
        }
        case TypeType::Class:
        case TypeType::Someobject:
        case TypeType::Callable:
        case TypeType::Protocol:
        case TypeType::MultiProtocol:
        case TypeType::Something:
        case TypeType::GenericVariable:
        case TypeType::LocalGenericVariable:
        case TypeType::Error:  // Is or may be an object pointer
            switch (storageType()) {
                case StorageType::SimpleOptional:
                    information->push_back(T(index + 1, index, ObjectVariableType::Condition, args...));
                    return;
                case StorageType::Simple:
                    information->push_back(T(index, ObjectVariableType::Simple, args...));
                    return;
                case StorageType::Box:
                    information->push_back(T(index, ObjectVariableType::Box, args...));
                    return;
                default:
                    throw std::domain_error("invalid storage type");
            }
        case TypeType::Enum:
        case TypeType::NoReturn:
        case TypeType::StorageExpectation:
        case TypeType::Extension:
            return;  // Can't be object pointer
    }
}
bool ShDataVariant<T, DT>::equals(const ShVariant* other) const
{
    if(!other || (size() != other->size())
            || !other->typeMatches(valueType(), dataType())) return false;

    const ShDataVariant* castOther = variant_cast<T, DT>(other);
    const_iterator I, J;
    I = m_begin;
    J = castOther->begin();
    for(; I != m_end; ++I, ++J) {
        if(!shDataTypeEqual((*I), (*J))) return false;
    }
    return true;
}
QVariant VcsBaseClientSettings::value(const QString &key) const
{
    switch (valueType(key)) {
    case QVariant::Int:
        return intValue(key);
    case QVariant::Bool:
        return boolValue(key);
    case QVariant::String:
        return stringValue(key);
    case QVariant::Invalid:
        return QVariant();
    default:
        return QVariant();
    }
}
void StackExpressionResult::push(ExpressionResult &atEnd)
{
    if(debug) {
        Info << "StackExpressionResult::push(ExpressionResult &atEnd)" << endl;
        Info << "Pushing: " << atEnd << endl;
    }
    if(!hasValue()) {
        // this is the first push
        //        static_cast<ExpressionResult>(*this)=atEnd;
        ExpressionResult::operator=(atEnd);
    } else {
        if(valueType()!=atEnd.valueType()) {
            FatalErrorIn("StackExpressionResult::push(const ExpressionResult &atEnd)")
                << "Type of pushed value " << atEnd.valueType()
                    << " is not the expected type " << valueType()
                    << endl
                    << abort(FatalError);
        }
        if(valueType()==pTraits<scalar>::typeName) {
            pushInternal<scalar>(atEnd);
        } else if(valueType()==pTraits<vector>::typeName) {
            pushInternal<vector>(atEnd);
        } else if(valueType()==pTraits<tensor>::typeName) {
            pushInternal<tensor>(atEnd);
        } else if(valueType()==pTraits<symmTensor>::typeName) {
            pushInternal<symmTensor>(atEnd);
        } else if(valueType()==pTraits<sphericalTensor>::typeName) {
            pushInternal<sphericalTensor>(atEnd);
        } else {
            FatalErrorIn("StackExpressionResult::push(const ExpressionResult &atEnd)")
                << " Unsopported value type " << valueType()
                    << endl
                    << abort(FatalError);
        }
    }
    if(debug) {
        Info << "After push: " << *this << endl;
    }
}
void VcsBaseClientSettings::readSettings(const QSettings *settings)
{
    const QString keyRoot = settingsGroup() + QLatin1Char('/');
    foreach (const QString &key, keys()) {
        const QVariant value = settings->value(keyRoot + key, keyDefaultValue(key));
        // For some reason QSettings always return QVariant(QString) when the
        // key exists. The type is explicited to avoid wrong conversions
        switch (valueType(key)) {
        case QVariant::Int:
            setValue(key, value.toInt());
            break;
        case QVariant::Bool:
            setValue(key, value.toBool());
            break;
        case QVariant::String:
            setValue(key, value.toString());
            break;
        default:
            break;
        }
    }
}
Exemple #15
0
// *****************************************************************************
void PodNode::write(std::ostream& output, int indent) const
{
    if (!isValid()) return;

    if (valueType() == BLOCK 
        && (!parent() && m_podName.empty() && m_podType.empty()))
    {
        
        // At the top-level, don't output enclosing braces, just the
        // nodes in the block.
        for (PodNodeDeque::const_iterator iter = asBlock().begin();
                iter != asBlock().end(); ++iter)
        {
            assert(*iter);
            (*iter)->write(output, indent);
        }
    }
    else
    {
        for (int i = 0; i < indent; ++i) output << "    ";

        if (!m_podType.empty())
        {
            output << m_podType << " ";
        }
        if (!m_podName.empty())
        {
            output << m_podName;
        }
        if (m_value)
        {
            if (!m_podName.empty()) output << " = ";
            m_value->write(output, indent);
        }
        output << ";" << std::endl;
    }
}
void VcsBaseClientSettings::setValue(const QString &key, const QVariant &v)
{
    if (SettingValue::isUsableVariantType(valueType(key)))
        d->m_valueHash.insert(key, SettingValue(v));
}
// -----------------------------------------------------------------------------
// CSensorDataCompensatorItem::Parse
// -----------------------------------------------------------------------------
//
TBool CSensorDataCompensatorItem::Parse( const TDesC& aValueType, const TDesC& aValue )
    {
    FUNC_LOG;

    TBool ret( EFalse );
    TInt valueType( DesToValueType( aValueType ) );
    if ( valueType >= 0 )
        {
        TInt value = 0;
        if (    valueType == ETappingAxisX
             || valueType == ETappingAxisY
             || valueType == ETappingAxisZ )
            {
            // Parse enum value
            if( !aValue.CompareF( KDeg0 ) )
                {
                value = TCompensationTypeDirectionData::ECw0;
                }
            else if( !aValue.CompareF( KDeg90 ) )
                {
                value = TCompensationTypeDirectionData::ECw90;
                }
            else if( !aValue.CompareF( KDeg180 ) )
                {
                value = TCompensationTypeDirectionData::ECw180;
                }
            else if( !aValue.CompareF( KDeg270 ) )
                {
                value = TCompensationTypeDirectionData::ECw270;
                }
            else
                {
                INFO_1( "CSensorDataCompensatorItem::ParseItem() - Unknown text value: [%S]", &aValue );

                value = TCompensationTypeDirectionData::ECw0;
                }
            }
        else
            {
            ParseInt( value, aValue );
            }

        // Update value if it has changed

        TInt previousValue = iValues[ valueType ];

        if ( previousValue != value )
            {
            INFO_3( "CSensorDataCompensatorItem::ParseItem() - ValueType %S changed [%D, %D]", &aValueType, previousValue, value );

            iValues[ valueType ] = value;
            ret = ETrue;
            }
        else
            {
            INFO_2( "CSensorDataCompensatorItem::ParseItem() - ValueType %S not changed [%D]", &aValueType, previousValue );
            }
        }
    else
        {
        INFO_1( "CSensorDataCompensatorItem::ParseItem() - Unknown value type: %S", &aValueType );
        }
    return ret;
    }
Exemple #18
0
QDeclarativeValueTypeFactory::QDeclarativeValueTypeFactory()
{
    // ### Optimize
    for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii)
        valueTypes[ii] = valueType(ii);
}
Exemple #19
0
Registers getRegisters(CIDebugRegisters *regs,
                       unsigned flags,
                       std::string *errorMessage)
{
    enum { bufSize= 128 };
    WCHAR buf[bufSize];

    ULONG registerCount = 0;
    HRESULT hr = regs->GetNumberRegisters(&registerCount);
    if (FAILED(hr)) {
        *errorMessage = msgDebugEngineComFailed("GetNumberRegisters", hr);
        return Registers();
    }
    ULONG pseudoRegisterCount = 0;
    if (flags & IncludePseudoRegisters) {
        hr = regs->GetNumberPseudoRegisters(&pseudoRegisterCount);
        if (FAILED(hr)) {
            *errorMessage = msgDebugEngineComFailed("GetNumberPseudoRegisters", hr);
            return Registers();
        }
    }

    Registers rc;
    rc.reserve(registerCount + pseudoRegisterCount);

    // Standard registers
    DEBUG_REGISTER_DESCRIPTION description;
    DEBUG_VALUE value;
    for (ULONG r = 0; r < registerCount; ++r) {
        hr = regs->GetDescriptionWide(r, buf, bufSize, NULL, &description);
        if (FAILED(hr)) {
            *errorMessage = msgDebugEngineComFailed("GetDescription", hr);
            return Registers();
        }
        hr = regs->GetValue(r, &value);
        if (FAILED(hr)) {
            *errorMessage = msgDebugEngineComFailed("GetValue", hr);
            return Registers();
        }
        const bool isSubRegister = (description.Flags & DEBUG_REGISTER_SUB_REGISTER);
        if (!isSubRegister || (flags & IncludeSubRegisters)) {
            Register reg;
            reg.name = buf;
            reg.description = registerDescription(description);
            reg.subRegister = isSubRegister;
            reg.value = value;
            rc.push_back(reg);
        }
    }

    // Pseudo
    for (ULONG r = 0; r < pseudoRegisterCount; ++r) {
        ULONG type;
        hr = regs->GetPseudoDescriptionWide(r, buf, bufSize, NULL, NULL, &type);
        if (FAILED(hr))
            continue; // Fails for some pseudo registers
        hr = regs->GetValue(r, &value);
        if (FAILED(hr))
            continue; // Fails for some pseudo registers
        Register reg;
        reg.pseudoRegister = true;
        reg.name = buf;
        reg.description = valueType(type);
        reg.value = value;
        rc.push_back(reg);
    }
    return rc;
}
QString *VcsBaseClientSettings::stringPointer(const QString &key)
{
    if (hasKey(key) && valueType(key) == QVariant::String)
        return d->m_valueHash[key].m_comp.strPtr;
    return 0;
}
int VcsBaseClientSettings::intValue(const QString &key, int defaultValue) const
{
    if (hasKey(key) && valueType(key) == QVariant::Int)
        return d->m_valueHash[key].m_comp.intValue;
    return defaultValue;
}
bool VcsBaseClientSettings::boolValue(const QString &key, bool defaultValue) const
{
    if (hasKey(key) && valueType(key) == QVariant::Bool)
        return d->m_valueHash[key].m_comp.boolValue;
    return defaultValue;
}
Exemple #23
0
 unsigned int ImageWrapper::valueSize() const
 {
     return Matrix::valueSize(valueType());
 }
QVariant VcsBaseClientSettings::keyDefaultValue(const QString &key) const
{
    if (d->m_defaultValueHash.contains(key))
        return d->m_defaultValueHash.value(key);
    return QVariant(valueType(key));
}
/**
 * This will evalute the tree
 * It uses type safety returns a string of the result
 */
string ExpressionTree::evaluate() {
	string num;

	if (!replaceable) {
		if (left == NULL || right == NULL) {
			throw DatabaseException(18,
					"Must have both left and right side to evaluate.");
		}
		string left_side = left->evaluate();
		string right_side = right->evaluate();

		string result;
		int type1 = valType(left_side); //0 is string
		//1 is float
		//2 is int
		//3 is date
		//4 is time
		int type2 = valType(right_side);
//		cout << "LEFT TYPE IS " << type1;
//		cout << " LEFT IS " << left_side << endl;
//		cout << "RIGHT TYPE IS " << type2;
//		cout << " RIGHT IS " << right_side << endl;
//		cout << "OPERATION IS" << value << endl;
		int intLeft;
		int intRight;
		float floatLeft;
		float floatRight;
		string stringLeft = left_side;
		string stringRight = right_side;
		Date dateLeft;
		Date dateRight;
		Time timeLeft;
		Time timeRight;
		stringstream leftStream(left_side);
		stringstream rightStream(right_side);
		switch (type1) {
		case 2:
			leftStream >> intLeft;
			break;
		case 1:
			leftStream >> floatLeft;
			break;
		case 3:
			leftStream >> dateLeft;
			break;
		case 4:
			leftStream >> timeLeft;
			break;
		}
		switch (type2) {
		case 2:
			rightStream >> intRight;
			break;
		case 1:
			rightStream >> floatRight;
			break;
		case 3:
			rightStream >> dateRight;
			break;
		case 4:
			rightStream >> timeRight;
			break;
		}
		//FIXX: Make sure type1 == type2, except for int and float
		Operations SWITCH = operation_map[value];
		switch (SWITCH) {
		//what she is doing
		case EQUAL: {
			bool tempResult;
			if (type1 == 0 && type2 == 0) {
				tempResult = (stringLeft == stringRight);
			} else if (type1 == 1 && type2 == 1) {
				tempResult = (floatLeft == floatRight);
			} else if (type1 == 1 && type2 == 2) {
				tempResult = (floatLeft == (float) intRight);
			} else if (type1 == 2 && type2 == 1) {
				tempResult = ((float) intLeft == floatRight);
			} else if (type1 == 2 && type2 == 2) {
				tempResult = (intLeft == intRight);
			} else if (type1 == 3 && type2 == 3) {
				tempResult = (dateLeft == dateRight);
			} else if (type1 == 4 && type2 == 4) {
				tempResult = (timeLeft == timeRight);
			} else {
				throw DatabaseException(
						18,
						intTypeToString(type1) + " and "
								+ intTypeToString(type2)
								+ " can not be compared using the == operator");
			}
			result = tempResult ? "1" : "0";
		}
			break;
		case NOT_EQUAL: {
			bool tempResult;
			if (type1 == 0 && type2 == 0) {
				tempResult = (stringLeft != stringRight);
			} else if (type1 == 1 && type2 == 1) {
				tempResult = (floatLeft != floatRight);
			} else if (type1 == 1 && type2 == 2) {
				tempResult = (floatLeft != (float) intRight);
			} else if (type1 == 2 && type2 == 1) {
				tempResult = ((float) intLeft != floatRight);
			} else if (type1 == 2 && type2 == 2) {
				tempResult = (intLeft != intRight);
			} else if (type1 == 3 && type2 == 3) {
				tempResult = (dateLeft != dateRight);
			} else if (type1 == 4 && type2 == 4) {
				tempResult = (timeLeft != timeRight);
			} else {
				throw DatabaseException(
						18,
						intTypeToString(type1) + " and "
								+ intTypeToString(type2)
								+ " can not be compared using the != operator");
			}
			result = tempResult ? "1" : "0";
		}
			break;
		case LTE: {
			bool tempResult;
			if (type1 == 0 && type2 == 0) {
				tempResult = (stringLeft <= stringRight);
			} else if (type1 == 1 && type2 == 1) {
				tempResult = (floatLeft <= floatRight);
			} else if (type1 == 1 && type2 == 2) {
				tempResult = (floatLeft <= (float) intRight);
			} else if (type1 == 2 && type2 == 1) {
				tempResult = ((float) intLeft <= floatRight);
			} else if (type1 == 2 && type2 == 2) {
				tempResult = (intLeft <= intRight);
			} else if (type1 == 3 && type2 == 3) {
				tempResult = (dateLeft <= dateRight);
			} else if (type1 == 4 && type2 == 4) {
				tempResult = (timeLeft <= timeRight);
			} else {
				throw DatabaseException(
						18,
						intTypeToString(type1) + " and "
								+ intTypeToString(type2)
								+ " can not be compared using the <= operator");
			}
			result = tempResult ? "1" : "0";
		}
			break;
		case GTE: {
			bool tempResult;
			if (type1 == 0 && type2 == 0) {
				tempResult = (stringLeft >= stringRight);
			} else if (type1 == 1 && type2 == 1) {
				tempResult = (floatLeft >= floatRight);
			} else if (type1 == 1 && type2 == 2) {
				tempResult = (floatLeft >= (float) intRight);
			} else if (type1 == 2 && type2 == 1) {
				tempResult = ((float) intLeft >= floatRight);
			} else if (type1 == 2 && type2 == 2) {
				tempResult = (intLeft >= intRight);
			} else if (type1 == 3 && type2 == 3) {
				tempResult = (dateLeft >= dateRight);
			} else if (type1 == 4 && type2 == 4) {
				tempResult = (timeLeft >= timeRight);
			} else {
				throw DatabaseException(
						18,
						intTypeToString(type1) + " and "
								+ intTypeToString(type2)
								+ " can not be compared using the >= operator");
			}
			result = tempResult ? "1" : "0";
		}
			break;
		case LT: {
			bool tempResult;
			if (type1 == 0 && type2 == 0) {
				tempResult = (stringLeft < stringRight);
			} else if (type1 == 1 && type2 == 1) {
				tempResult = (floatLeft < floatRight);
			} else if (type1 == 1 && type2 == 2) {
				tempResult = (floatLeft < (float) intRight);
			} else if (type1 == 2 && type2 == 1) {
				tempResult = ((float) intLeft < floatRight);
			} else if (type1 == 2 && type2 == 2) {
				tempResult = (intLeft < intRight);
			} else if (type1 == 3 && type2 == 3) {
				tempResult = (dateLeft < dateRight);
			} else if (type1 == 4 && type2 == 4) {
				tempResult = (timeLeft < timeRight);
			} else {
				throw DatabaseException(
						18,
						intTypeToString(type1) + " and "
								+ intTypeToString(type2)
								+ " can not be compared using the < operator");
			}
			result = tempResult ? "1" : "0";
		}
			break;
		case GT: {
			bool tempResult;
			if (type1 == 0 && type2 == 0) {
				tempResult = (stringLeft > stringRight);
			} else if (type1 == 1 && type2 == 1) {
				tempResult = (floatLeft > floatRight);
			} else if (type1 == 1 && type2 == 2) {
				tempResult = (floatLeft > (float) intRight);
			} else if (type1 == 2 && type2 == 1) {
				tempResult = ((float) intLeft > floatRight);
			} else if (type1 == 2 && type2 == 2) {
				tempResult = (intLeft > intRight);
			} else if (type1 == 3 && type2 == 3) {
				tempResult = (dateLeft > dateRight);
			} else if (type1 == 4 && type2 == 4) {
				tempResult = (timeLeft > timeRight);
			} else {
				throw DatabaseException(
						18,
						intTypeToString(type1) + " and "
								+ intTypeToString(type2)
								+ " can not be compared using the > operator");
			}
			result = tempResult ? "1" : "0";
		}
			break;

			//parse it into a 1 or 0 do operation store in result
		case AND: {
			if ((type1 == 2 && type2 == 2) && intLeft < 2 && intRight < 2
					&& intLeft >= 0 && intRight >= 0) {
				//the bitwise and operation will the same as the normal && operation on a bool
				result = ((intLeft & intRight) == 1) ? "1" : "0";
			} else {
				throw DatabaseException(
						18,
						intTypeToString(type1) + " and "
								+ intTypeToString(type2)
								+ " can not be compared using the && operator");
			}
		}
			break;

		case OR: {
			if ((type1 == 2 && type2 == 2) && intLeft < 2 && intRight < 2
					&& intLeft >= 0 && intRight >= 0) {
				//the bitwise or operation will the same as the normal || operation on a bool
				result = ((intLeft | intRight) == 1) ? "1" : "0";
			} else {
				throw DatabaseException(
						18,
						intTypeToString(type1) + " and "
								+ intTypeToString(type2)
								+ " can not be compared using the && operator");
			}
		}
			break;

			//parse it into a number do operation, store into result
		case EXP:
			if (type1 != 1 && type1 != 2) {
				throw DatabaseException(18,
						stringLeft + " must be a float or int type.");
			} else if (type2 != 1 && type2 != 2) {
				throw DatabaseException(18,
						stringRight + " must be a float or int type.");
			}

			float val;

			//Convert the first value to a float
			if (type2 == 1) {
				val = (float) intRight;
			} else {
				val = floatRight;
			}

			//Get the result depending on the left value
			if (type1 == 1) {
				result = (int) pow(intLeft, val);
			} else {
				result = pow(floatLeft, val);
			}
			break;
		case MULT:
			if (type1 != 1 && type1 != 2) {
				throw DatabaseException(18,
						stringLeft + " must be a float or int type.");
			} else if (type2 != 1 && type2 != 2) {
				throw DatabaseException(18,
						stringRight + " must be a float or int type.");
			}

			if (type1 == 1) {
				if (type2 == 1) {
					result = intLeft * intRight;
				} else {
					result = intLeft * floatRight;
				}
			} else {
				if (type2 == 1) {
					result = floatLeft * intRight;
				} else {
					result = floatLeft * floatRight;
				}
			}

			break;
		case DIVIDE:
			if (type1 != 1 && type1 != 2) {
				throw DatabaseException(18,
						stringLeft + " must be a float or int type.");
			} else if (type2 != 1 && type2 != 2) {
				throw DatabaseException(18,
						stringRight + " must be a float or int type.");
			}
			if (type1 == 1) {
				if (type2 == 1) {
					result = intLeft / intRight;
				} else {
					result = intLeft / floatRight;
				}
			} else {
				if (type2 == 1) {
					result = floatLeft / intRight;
				} else {
					result = floatLeft / floatRight;
				}
			}

			break;
		case PLUS:
			if (type1 != 1 && type1 != 2) {
				throw DatabaseException(18,
						stringLeft + " must be a float or int type.");
			} else if (type2 != 1 && type2 != 2) {
				throw DatabaseException(18,
						stringRight + " must be a float or int type.");
			}
			if (type1 == 1) {
				if (type2 == 1) {
					result = intLeft + intRight;
				} else {
					result = intLeft + floatRight;
				}
			} else {
				if (type2 == 1) {
					result = floatLeft + intRight;
				} else {
					result = floatLeft + floatRight;
				}
			}

			break;
		case MINUS:
			if (type1 != 1 && type1 != 2) {
				throw DatabaseException(18,
						stringLeft + " must be a float or int type.");
			} else if (type2 != 1 && type2 != 2) {
				throw DatabaseException(18,
						stringRight + " must be a float or int type.");
			}
			if (type1 == 1) {
				if (type2 == 1) {
					result = intLeft - intRight;
				} else {
					result = intLeft - floatRight;
				}
			} else {
				if (type2 == 1) {
					result = floatLeft - intRight;
				} else {
					result = floatLeft - floatRight;
				}
			}

			break;
		case ALL:
		case ANY: {
//			cout<<"ANY OR ALL"<<endl;
//			cout<<stringLeft<<endl;
//			cout<<stringRight<<endl;
			//stringLeft = table.col
			//stringRight = table_one_col
			Column * leftCol = NULL;
			try {
				leftCol = db->findColumn(stringLeft);
			} catch (DatabaseException e) {
//				cout<<"ignore exception"<<endl;
			}
			if (leftCol == NULL) {
				leftCol = new Column(valueType(stringLeft));
				leftCol->addRow(stringLeft);
			}
			string leftColType = leftCol->getColumnType();

			Table * rightTable = db->findTable(stringRight);
			if (rightTable == NULL) {
				throw DatabaseException(10, stringRight + " does not exist.");
			}
			Column * rightTableColumn = rightTable->findColumn(
					rightTable->columnNames()[0]);
			string rightTableColType = rightTableColumn->getColumnType();

			if (rightTable->columnCount() != 1) {
				throw DatabaseException(18,
						stringRight + " must have 1 column for ANY/ALL.");
			} else if (leftColType.compare(rightTableColType) != 0
					&& !((leftColType == "int" && rightTableColType == "float")
							|| (leftColType == "float"
									&& rightTableColType == "int"))) {
				throw DatabaseException(
						13,
						leftColType + " is not the same as "
								+ rightTableColType);
			}

			int funcType = -1;
			string op = "";
			switch (SWITCH) {
			case ANY:
				funcType = 1;
				op = value.substr(0, value.find("ANY"));
				break;
			case ALL:
				funcType = 2;
				op = value.substr(0, value.find("ALL"));
				break;
			}
			LogicHandler * temp = new LogicHandler("LEFT" + op + "RIGHT");
			temp->parse();
			vector<string> inserts;
			inserts.push_back("LEFT");
			inserts.push_back("RIGHT");
			ExpressionTree * tree = temp->getTree();

			for (int i = 0; i < leftCol->rowCount(); i++) {

				string leftInput = leftCol->getValueAtRowIndex(i);

//				cout<<"\n\nLEFT INPUT IS "<<leftInput<<endl;
//				cout<<"\n\nfollows "<<leftCol->printDataList()<<"index is "<<i<<endl;

				for (int j = 0; j < rightTableColumn->rowCount(); j++) {
					string rightInput = rightTableColumn->getValueAtRowIndex(j);
					vector<string> throwaway;
					throwaway.push_back(leftInput);
					throwaway.push_back(rightInput);
					bool eval = tree->isTrue(inserts, throwaway);

					if (funcType == 1 && eval) {
						return "1";
					} else if (funcType == 2 && !eval) {
						return "0";
					}
				}
			}

			result = (funcType == 1) ? "0" : "1";

		}
			break;
		case IN: //FIXX: Does not catch if the column types differ. Convert types
		{
			result = "0";

			if (db->countColumnsByTable(stringRight) != 1) {
				throw DatabaseException(18,
						stringRight + " does not have only 1 column.");
			}

			Table *theTable = db->findTable(stringRight);

			vector<string> column = theTable->columnNames();

			Column *theColumn = theTable->findColumn(column[0]);

			for (int i = 0; i < theColumn->rowCount(); i++) {
				if (stringLeft == theColumn->getValueAtRowIndex(i)) {
					result = "1";
					break;
				}
			}

		}
			break;
		case EXIST: {
			Table * table = db->findTable(stringRight);
			if (table == NULL) {
				result = "0";
			} else if (table->columnCount() >= 1) {
				result = "1";
			} else {
				result = "0";
			}
		}
			break;
		}
		num = result;
		//this is an operation
	} else {