diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-08 13:39:12 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-08 13:39:12 +0100 |
| commit | 1e9d90bdf9ef5fc05093d3449d883597c7f896de (patch) | |
| tree | cc5334baec6ec10a0d99bc925499512bc44f2cd0 /cpp06/ex00/DynamicConverter.cpp | |
| parent | c426fe76ec5925e8c94aae3db04e5e1f1ce1585e (diff) | |
| download | piscine_cpp-1e9d90bdf9ef5fc05093d3449d883597c7f896de.tar.gz piscine_cpp-1e9d90bdf9ef5fc05093d3449d883597c7f896de.tar.bz2 piscine_cpp-1e9d90bdf9ef5fc05093d3449d883597c7f896de.zip | |
Added cpp06 boilerplate
Diffstat (limited to 'cpp06/ex00/DynamicConverter.cpp')
| -rw-r--r-- | cpp06/ex00/DynamicConverter.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/cpp06/ex00/DynamicConverter.cpp b/cpp06/ex00/DynamicConverter.cpp new file mode 100644 index 0000000..c22d469 --- /dev/null +++ b/cpp06/ex00/DynamicConverter.cpp @@ -0,0 +1,51 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* DynamicConverter.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/16 11:48:33 by charles #+# #+# */ +/* Updated: 2020/04/16 12:25:58 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "DynamicConverter.hpp" + +DynamicConverter(DynamicConverter const& other) +{ + *this = other; +} + +DynamicConverter& operator=(DynamicConverter const& other) +{ + if (*this == other) + return *this; + m_origin = other.m_origin; + m_type = other.m_type; + m_int = other.m_int; + m_char = other.m_char; + m_float = other.m_float; + m_double = other.m_double; + return *this; +} + +~DynamicConverter() +{} + +DynamicConverter(std::string const& origin) + : m_origin(origin) +{ + if (isCharLitteral(origin)) + m_type = DetectedTypeChar; + else if (isIntLitteral(origin)) + else if (isFloatLitteral(origin)) + else if (isDoubleLitteral(origin)) + + +} + +bool isCharLitteral(std::string const& s) +{ + if (!origin.length() == 3 && origin[0] == '\'' && origin[2] == '\''); +} |
