Initial commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#include "DataType.h"
|
||||
#include <StringAlgorithm.h>
|
||||
|
||||
|
||||
namespace DataStorageInterface {
|
||||
namespace DataInterface {
|
||||
|
||||
DataType::type GetDataType(const std::string& value)
|
||||
{
|
||||
if (StringAlgorithm::is_numeric(value))
|
||||
return DataType::Float;
|
||||
|
||||
return DataType::String;
|
||||
}
|
||||
|
||||
namespace Conversions {
|
||||
|
||||
DataType::type DataType(const std::string& datatype)
|
||||
{
|
||||
if (StringAlgorithm::iequals(datatype, "Float"))
|
||||
return DataType::Float;
|
||||
else if (StringAlgorithm::iequals(datatype, "String"))
|
||||
return DataType::String;
|
||||
else
|
||||
return DataType::None;
|
||||
}
|
||||
|
||||
std::string DataType(DataType::type datatype)
|
||||
{
|
||||
switch (datatype)
|
||||
{
|
||||
case DataType::None:
|
||||
return "None";
|
||||
case DataType::Float:
|
||||
return "Float";
|
||||
default:
|
||||
case DataType::String:
|
||||
return "String";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Conversions
|
||||
|
||||
} // namespace DataInterface
|
||||
} // namespace DataStorageInterface
|
||||
Reference in New Issue
Block a user