Core Library 1.7.0.0 Library containing core utilities and tools for threading, networking, logging, INI and CSV file management etc.

CsvGridCell.h
Go to the documentation of this file.
1 // This file is part of CoreLibrary containing useful reusable utility
2 // classes.
3 //
4 // Copyright (C) 2014 to present, Duncan Crutchley
5 // Contact <dac1976github@outlook.com>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published
9 // by the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License and GNU Lesser General Public License
16 // for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // and GNU Lesser General Public License along with this program. If
20 // not, see <http://www.gnu.org/licenses/>.
21
27 #ifndef CSVGRIDCELL
28 #define CSVGRIDCELL
29
30 #include <cstdint>
31 #include <string>
32 #include "CoreLibraryDllGlobal.h"
33 #include "Platform/PlatformDefines.h"
34
36 namespace core_lib
37 {
39 namespace csv_grid
40 {
41
49 class CORE_LIBRARY_DLL_SHARED_API Cell final
50 {
51 public:
53 Cell() = default;
55 Cell(const Cell&) = default;
56 #ifdef USE_EXPLICIT_MOVE_
57
58 Cell(Cell&& cell);
59 #else
60
61 Cell(Cell&&) = default;
62 #endif
63
69 explicit Cell(const std::string& value);
76 explicit Cell(int32_t value);
83 explicit Cell(int64_t value);
90 explicit Cell(float value);
97 explicit Cell(double value);
104 explicit Cell(long double value);
106 ~Cell() = default;
108 Cell& operator=(const Cell&) = default;
109 #ifdef USE_EXPLICIT_MOVE_
110
111 Cell& operator=(Cell&& cell);
112 #else
113
114 Cell& operator=(Cell&&) = default;
115 #endif
116
123 Cell& operator=(const std::string& rhs);
131 Cell& operator=(int32_t rhs);
139 Cell& operator=(int64_t rhs);
147 Cell& operator=(float rhs);
155 Cell& operator=(double rhs);
163 Cell& operator=(long double rhs);
168 std::string Value() const;
175 operator std::string() const;
185 operator int32_t() const;
195 operator int64_t() const;
205 operator float() const;
215 operator double() const;
225 operator long double() const;
234 int32_t ToInt32Def(int32_t defval = 0) const NO_EXCEPT_;
243 int64_t ToInt64Def(int64_t defval = 0) const NO_EXCEPT_;
252 float ToFloatDef(float defval = 0.0f) const NO_EXCEPT_;
261 double ToDoubleDef(double defval = 0.0) const NO_EXCEPT_;
270 long double ToLongDoubleDef(long double defval = 0.0L) const NO_EXCEPT_;
271
272 private:
274 std::string m_value{};
275 };
276
277 } // namespace csv_grid
278 } // namespace core_lib
279
280 #endif // CSVGRIDCELL
core_lib
The core_lib namespace.
Definition: AsioDefines.h:59
core_lib::csv_grid::Cell
Class defining a single cell within a row of the grid.
Definition: CsvGridCell.h:49
CoreLibraryDllGlobal.h
File containing declaration of DLL import/export control defines.
PlatformDefines.h
File containing platform specific definitions.
NO_EXCEPT_
#define NO_EXCEPT_
NO_EXCEPT_ definition mapping to noexcept.
Definition: PlatformDefines.h:57