memgraph/include/import/fillings/int32.hpp
Kruno Tomola Fabro d806d635f9 Added documentation.
Fixed test for index.
2016-09-18 23:22:36 +01:00

36 lines
879 B
C++

#pragma once
#include "import/fillings/common.hpp"
#include "import/fillings/filler.hpp"
#include "storage/model/properties/all.hpp"
#include "storage/model/properties/flags.hpp"
#include "storage/model/properties/property_family.hpp"
// Parses int32.
// TG - Type group
template <class TG>
class Int32Filler : public Filler
{
public:
Int32Filler(
typename PropertyFamily<TG>::PropertyType::PropertyFamilyKey key)
: key(key)
{
}
// Fills skeleton with data from str. Returns error description if
// error occurs.
Option<std::string> fill(ElementSkeleton &data, char *str) final
{
if (str[0] != '\0') {
data.add_property(StoredProperty<TG>(Int32(to_int32(str)), key));
}
return make_option<std::string>();
}
private:
typename PropertyFamily<TG>::PropertyType::PropertyFamilyKey key;
};