Alexandria
2.16
Please provide a description of the project.
Table
src
lib
ColumnDescription.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2012-2020 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
// The std regex library is not fully implemented in GCC 4.8. The following lines
26
// make use of the BOOST library and can be modified if GCC 4.9 will be used in
27
// the future.
28
// #include <regex>
29
#include <boost/regex.hpp>
30
using
boost::regex;
31
using
boost::regex_match;
32
#include "
ElementsKernel/Exception.h
"
33
34
#include "
Table/ColumnDescription.h
"
35
36
namespace
Euclid
{
37
namespace
Table {
38
39
ColumnDescription::ColumnDescription
(
std::string
name,
std::type_index
type,
40
std::string
unit,
std::string
description)
41
: name(name), type(type), unit(unit), description(description) {
42
if
(
name
.
empty
()) {
43
throw
Elements::Exception
() <<
"Empty string name is not allowed"
;
44
}
45
if
(regex_match(
name
, regex{
".*\\v.*"
})) {
46
throw
Elements::Exception
() <<
"Column name '"
<<
name
<<
"' contains "
47
<<
"vertical whitespace characters"
;
48
}
49
}
50
51
}
// Table namespace
52
}
// Euclid namespace
53
54
55
std::string::empty
T empty(T... args)
Euclid::Table::ColumnDescription::name
std::string name
Definition:
ColumnDescription.h:82
ColumnDescription.h
std::string
STL class.
Euclid
Definition:
InstOrRefHolder.h:29
std::type_index
Elements::Exception
Euclid::Table::ColumnDescription::ColumnDescription
ColumnDescription(std::string name, std::type_index type=typeid(std::string), std::string unit="", std::string description="")
Definition:
ColumnDescription.cpp:39
Exception.h
Generated by
1.8.15