MDF Lib 2.2
Interface against MDF 3/4 files
Loading...
Searching...
No Matches
mdf::ETag Class Reference

Helper class for meta data items in an MDF file. More...

#include <etag.h>

Public Member Functions

void Name (const std::string &name)
 Sets the name attribute in an e-tag or a tree-tag.
 
const std::string & Name () const
 Returns the name attribute.
 
void Description (const std::string &desc)
 Optional attribute in an e-tag or tree-tag.
 
const std::string & Description () const
 Description text.
 
void Unit (const std::string &unit)
 Optional unit of the value in a nn e-tag..
 
const std::string & Unit () const
 Unit of value.
 
void UnitRef (const std::string &unit_ref)
 Reference unit.
 
const std::string & UnitRef () const
 Reference unit.
 
void DataType (ETagDataType type)
 Sets the data type.
 
ETagDataType DataType () const
 Retuns the data type.
 
void Type (const std::string &type)
 Data type of the value.
 
const std::string & Type () const
 Data type of the value.
 
void Language (const std::string &language)
 Language of the value.
 
const std::string & Language () const
 Language code.
 
void ReadOnly (bool read_only)
 The value is read-only.
 
bool ReadOnly () const
 Indicates that the value is read-only.
 
void CreatorIndex (int index)
 Index to FH block.
 
int CreatorIndex () const
 Index to file history block.
 
template<typename T >
void Value (const T &value)
 Sets the value for an e-tag.
 
template<typename T >
Value () const
 Returns the tag value.
 
void AddTag (const ETag &tag)
 Adds a tag and define this to be a list of tags (tree).
 
const std::vector< ETag > & TreeList () const
 Return a list of tags.
 
template<>
void Value (const bool &value)
 Specialization of setting boolean values.
 
template<>
bool Value () const
 Specialization of getting a boolean value.
 
template<>
std::string Value () const
 Specialization of getting a string value.
 

Detailed Description

Most of meta data related items are stored in an associated MD block which is an XML snippet. The items are stored in 'e' and 'tree' tags.

The 'tree' tag is a list of 'e' tags and shall have a unique name attribute and optional description and creator index.

The e-tag shall have a unique name attribute and a value. The other attributes are optional.

Member Function Documentation

◆ AddTag()

void mdf::ETag::AddTag ( const ETag & tag)

Adds a tag meaning that this tag should be treated as a list of tags (tree).

Parameters
tagTag item to add

◆ CreatorIndex() [1/2]

int mdf::ETag::CreatorIndex ( ) const
inlinenodiscard
Returns
Index to a file history block.

◆ CreatorIndex() [2/2]

void mdf::ETag::CreatorIndex ( int index)
inline

Default set to -1 but can be set to which an index to a FH block indicating who set the value in the block.

Parameters
indexIndex to file history block.

◆ Description() [1/2]

const std::string & mdf::ETag::Description ( ) const
inlinenodiscard
Returns
Description text (UTF8)

◆ Description() [2/2]

void mdf::ETag::Description ( const std::string & desc)
inline
Parameters
descDescription text (UTF8)

◆ Language() [1/2]

const std::string & mdf::ETag::Language ( ) const
inlinenodiscard
Returns
Language code.

◆ Language() [2/2]

void mdf::ETag::Language ( const std::string & language)
inline

Defines the language. Advanced feature.

Parameters
languageLanguage string

◆ Name() [1/2]

const std::string & mdf::ETag::Name ( ) const
inlinenodiscard
Returns
Name attribute

◆ Name() [2/2]

void mdf::ETag::Name ( const std::string & name)
inline

The name attribute should be unique making it possible to search for. It is not possible to store if the name is blank.

Parameters
nameUnique name and not empty.

◆ ReadOnly() [1/2]

bool mdf::ETag::ReadOnly ( ) const
inlinenodiscard
Returns
True if the value is read-only.

◆ ReadOnly() [2/2]

void mdf::ETag::ReadOnly ( bool read_only)
inline
Parameters
read_onlySet to true if the value is read-only.

◆ TreeList()

const std::vector< ETag > & mdf::ETag::TreeList ( ) const
inlinenodiscard
Returns
List of tag items.

◆ Type() [1/2]

const std::string & mdf::ETag::Type ( ) const
inlinenodiscard

Data types as defined in 'Primitive XML Data Types'.

Returns
Value data type.

◆ Type() [2/2]

void mdf::ETag::Type ( const std::string & type)
inline

The data type is default set to a string. Standard types are according to the XML standard primitive types. Standard types are 'string', 'decimal', 'integer', 'float', 'boolean', 'date', 'time' and 'dateTime'.

Parameters
typeData type string

◆ Unit() [1/2]

const std::string & mdf::ETag::Unit ( ) const
inlinenodiscard
Returns
Unit of value (UTF8)

◆ Unit() [2/2]

void mdf::ETag::Unit ( const std::string & unit)
inline
Parameters
unitUnit text (UTF8)

◆ UnitRef() [1/2]

const std::string & mdf::ETag::UnitRef ( ) const
inlinenodiscard
Returns
Reference unit

◆ UnitRef() [2/2]

void mdf::ETag::UnitRef ( const std::string & unit_ref)
inline

Reference to a global unit. This is an advanced MDF4 feature.

Parameters
unit_refReference to a global unit.

◆ Value() [1/5]

template<typename T >
T mdf::ETag::Value ( ) const
nodiscard
Template Parameters
TType of value.
Returns
Tag value.

◆ Value() [2/5]

template<>
bool mdf::ETag::Value ( ) const
nodiscard
Returns
Boolean value true/false

◆ Value() [3/5]

template<>
std::string mdf::ETag::Value ( ) const
nodiscard
Returns
The value as a text string.

◆ Value() [4/5]

template<>
void mdf::ETag::Value ( const bool & value)
Parameters
valueBoolean value

◆ Value() [5/5]

template<typename T >
void mdf::ETag::Value ( const T & value)
Template Parameters
TType of value.
Parameters
valueTag value.

The documentation for this class was generated from the following file: