h5cpp
0.5.0
A modern C++ wrapper for the HDF5 C library
string.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
h5cpp/datatype/type_trait.hpp
>
4
#include <
h5cpp/datatype/string.hpp
>
5
#include <string>
6
7
namespace
hdf5
{
8
namespace
datatype {
9
10
template
<>
11
class
TypeTrait<std::string> {
12
public
:
13
using
Type
= std::string;
14
using
TypeClass
=
String
;
15
static
TypeClass
create
(
const
Type
& =
Type
()) {
16
return
datatype::String::variable
();
17
}
18
const
static
TypeClass
&
get
(
const
Type
& =
Type
()) {
19
const
static
TypeClass
& cref_ =
create
();
20
return
cref_;
21
}
22
};
23
24
25
template
<
typename
CharT>
26
class
TypeTrait<std::basic_string<CharT>> {
27
private
:
28
29
public
:
30
using
Type
= std::basic_string<CharT>;
31
using
TypeClass
=
String
;
32
33
static
TypeClass
create
(
const
Type
& =
Type
()) {
34
static_assert(std::is_same<CharT, char>::value,
"Only support 8Bit characters"
);
35
36
String
type =
String::variable
();
37
type.encoding(
CharacterEncoding::UTF8
);
38
return
type;
39
40
}
41
const
static
TypeClass
&
get
(
const
Type
& =
Type
()) {
42
const
static
TypeClass
& cref_ =
create
();
43
return
cref_;
44
}
45
46
};
47
}
// end of namespace datatype
48
49
namespace
dataspace {
50
51
}
// end of namespace dataspace
52
}
// end of namespace hdf5
hdf5::datatype::String::variable
static String variable()
construct variable-length string
hdf5::dataspace::Type
Type
Definition:
type.hpp:43
string.hpp
hdf5::datatype::TypeTrait::create
static TypeClass create(const T &=T())
create the new type instance
hdf5::datatype::TypeTrait::TypeClass
Datatype TypeClass
subtype of Datatype which will be used
Definition:
type_trait.hpp:58
hdf5::datatype::TypeTrait::get
const static TypeClass & get(const T &=T())
reference to const static type instance
hdf5::datatype::Class::String
@ String
indicates a string type
type_trait.hpp
hdf5::datatype::CharacterEncoding::UTF8
@ UTF8
UTF8.
hdf5
top-level namespace of the entire library
Definition:
attribute.hpp:45
h5cpp
src
h5cpp
contrib
stl
string.hpp
Generated on Mon May 2 2022 08:20:20 for h5cpp by
1.8.17