from whatap.value.float_value import FloatValue
from whatap.value.text_value import TextValue

from whatap.value.list_value import ListValue
from whatap.value.map_value import MapValue
from whatap.value.decimal_value import DecimalValue

def NewDecimalValue(v):
    return DecimalValue(v)

def NewTextValue(v):
    return TextValue(v)

def NewMapValue():
    return MapValue()

def toValue(src):
    if isinstance(src, int):
        return DecimalValue(src)
    elif isinstance(src, float):
        return FloatValue(src)
    elif isinstance(src, str) or isinstance(src, unicode):
        return TextValue(src)
    else:
        return str(src)


