Alexandria
2.31.4
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Table
src
lib
ColumnDescription.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2012-2022 Euclid Science Ground Segment
3
*
4
* This library is free software; you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License as published by the Free
6
* Software Foundation; either version 3.0 of the License, or (at your option)
7
* any later version.
8
*
9
* This library is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12
* details.
13
*
14
* You should have received a copy of the GNU Lesser General Public License
15
* along with this library; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
24
25
#include "
Table/ColumnDescription.h
"
26
#include "
AlexandriaKernel/RegexHelper.h
"
27
#include "ElementsKernel/Exception.h"
28
29
namespace
Euclid
{
30
namespace
Table
{
31
32
ColumnDescription::ColumnDescription
(
std::string
input_name,
std::type_index
input_type,
std::string
input_unit,
33
std::string
input_description)
34
:
ColumnDescription
(input_name, input_type, 0, input_unit, input_description) {}
35
36
ColumnDescription::ColumnDescription
(
std::string
input_name,
std::type_index
input_type,
std::size_t
input_size,
37
std::string
input_unit,
std::string
input_description)
38
:
name
(input_name),
type
(input_type),
unit
(input_unit),
description
(input_description),
size
(input_size) {
39
static
const
regex::regex
vertical_whitespace{
".*[\\n\\v\\f\\r].*"
};
40
41
if
(input_name.
empty
()) {
42
throw Elements::Exception() <<
"Empty string name is not allowed"
;
43
}
44
if (regex_match(input_name, vertical_whitespace)) {
45
throw
Elements::Exception
() <<
"Column name '"
<< input_name <<
"' contains "
46
<<
"vertical whitespace characters"
;
47
}
48
}
49
50
}
// namespace Table
51
}
// namespace Euclid
ColumnDescription.h
RegexHelper.h
std::regex
std::string
Elements::Exception
Euclid::Table::ColumnDescription::type
std::type_index type
Definition
ColumnDescription.h:86
Euclid::Table::ColumnDescription::name
std::string name
Definition
ColumnDescription.h:85
Euclid::Table::ColumnDescription::size
std::size_t size
Definition
ColumnDescription.h:89
Euclid::Table::ColumnDescription::description
std::string description
Definition
ColumnDescription.h:88
Euclid::Table::ColumnDescription::ColumnDescription
ColumnDescription(std::string name, std::type_index type=typeid(std::string), std::string unit="", std::string description="")
Definition
ColumnDescription.cpp:32
Euclid::Table::ColumnDescription::unit
std::string unit
Definition
ColumnDescription.h:87
std::string::empty
T empty(T... args)
Euclid::Table
Definition
Table.dox:2
Euclid
Definition
InstOrRefHolder.icpp:27
std::size_t
std::type_index
Generated by
1.14.0