26 struct PropertyPersistenceInfo::Impl
34 std::string NameTemplate;
35 std::string KeyTemplate;
41 PropertyPersistenceInfo::Impl::Impl()
47 MimeTypeName(PropertyPersistenceInfo::ANY_MIMETYPE_NAME())
51 PropertyPersistenceInfo::Impl::~Impl() {}
65 m_Impl->MimeTypeName = mimeTypeName;
88 m_Impl->NameTemplate.clear();
89 m_Impl->KeyTemplate.clear();
97 m_Impl->NameTemplate.clear();
98 m_Impl->KeyTemplate.clear();
103 std::regex checker(nameRegEx);
107 m_Impl->NameTemplate = nameTemplate;
108 m_Impl->KeyTemplate = nameTemplate;
112 const std::string &nameTemplate,
113 const std::string &keyRegEx,
114 const std::string keyTemplate)
116 std::regex nameChecker(nameRegEx);
117 std::regex keyChecker(keyRegEx);
121 m_Impl->NameTemplate = nameTemplate;
122 m_Impl->KeyTemplate = keyTemplate;
132 return m_Impl->KeyTemplate;
137 return m_Impl->NameTemplate;
142 return m_Impl->MimeTypeName;
147 m_Impl->MimeTypeName = mimeTypeName;
175 const std::string &templateStr,
176 const std::string ®exStr)
179 std::regex ex(regexStr);
180 std::regex_match(sourceStr, sm, ex);
182 std::string result = templateStr;
185 for (
const auto &match : sm)
189 std::ostringstream stream;
190 stream <<
"(\\$" << groupID <<
")";
191 std::regex rex(stream.str());
192 result = std::regex_replace(result, rex, match.str());
201 const std::string &propertyName)
const
204 *(resultInfo->m_Impl) = *(this->
m_Impl);
209 resultInfo->SetNameAndKey(propertyName, newKey);
218 *(resultInfo->m_Impl) = *(this->
m_Impl);
223 resultInfo->SetNameAndKey(newName, key);
237 this->Superclass::PrintSelf(os, indent);
239 os << indent <<
"Name: " << this->
m_Impl->Name << std::endl;
240 os << indent <<
"Key: " << this->
m_Impl->Key << std::endl;
241 os << indent <<
"IsRegEx: " << this->
m_Impl->IsRegEx << std::endl;
242 os << indent <<
"NameTemplate: " << this->
m_Impl->NameTemplate << std::endl;
243 os << indent <<
"KeyTemplate: " << this->
m_Impl->KeyTemplate << std::endl;
244 os << indent <<
"MimeTypeName: " << this->
m_Impl->MimeTypeName << std::endl;
255 std::string result =
"";
264 const std::string &value)
267 return result.GetPointer();
static MimeTypeNameType ANY_MIMETYPE_NAME()
const std::string & GetKeyTemplate() const
std::string GetName() const
const SerializationFunctionType GetSerializationFunction() const
MITKCORE_EXPORT std::ostream & operator<<(std::ostream &o, DataNode::Pointer &dtn)
std::string MimeTypeNameType
void SetSerializationFunction(const SerializationFunctionType &fnc)
PropertyPersistenceInfo::Pointer UnRegExByName(const std::string &propertyName) const
MITKCORE_EXPORT::std::string serializeByGetValueAsString(const mitk::BaseProperty *prop)
PropertyPersistenceInfo::Pointer UnRegExByKey(const std::string &key) const
DataCollection - Class to facilitate loading/accessing structured data.
std::string GetKey() const
const DeserializationFunctionType GetDeserializationFunction() const
MITKCORE_EXPORT mitk::BaseProperty::Pointer deserializeToStringProperty(const std::string &value)
static void info(const char *fmt,...)
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const override
Abstract base class for properties.
Property persistence info. This class is used to specify the way the persistance of a property of Bas...
static std::string DEFAULT_BASE_NAME()
std::function< mitk::BaseProperty::Pointer(const std::string &)> DeserializationFunctionType
virtual std::string GetValueAsString() const
void SetDeserializationFunction(const DeserializationFunctionType &fnc)
const MimeTypeNameType & GetMimeTypeName() const
std::string GenerateFromTemplate(const std::string &sourceStr, const std::string &templateStr, const std::string ®exStr)
void SetName(const std::string &name)
void SetMimeTypeName(const MimeTypeNameType &mimeTypeName)
PropertyPersistenceInfo(const std::string &name="")
Constructor.
static std::string GetName(std::string fileName, std::string suffix)
virtual ~PropertyPersistenceInfo()
void UseRegEx(const std::string &nameRegEx, const std::string &nameTemplate)
void SetNameAndKey(const std::string &name, const std::string &key)
std::function< std::string(const mitk::BaseProperty *)> SerializationFunctionType
const std::string & GetNameTemplate() const