Alexandria
2.31.0
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
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
Exception.h
RegexHelper.h
std::regex
std::string
Elements::Exception
Euclid::Table::ColumnDescription
Contains the description of a specific column of a Table.
Definition
ColumnDescription.h:55
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
std::string::empty
T empty(T... args)
Euclid
Definition
index_sequence.h:27
std::size_t
std::type_index
Generated by
1.9.8