| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2010-2015 Dmitry Tsarkov and The University of Manchester |
| 3 | Copyright (C) 2015-2017 Dmitry Tsarkov |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef TDATATYPEMANAGER_H |
| 21 | #define TDATATYPEMANAGER_H |
| 22 | |
| 23 | #include "tDLExpression.h" |
| 24 | #include "tNameSet.h" |
| 25 | |
| 26 | /// keeps all the TDLDataTypeName datatypes together with the names |
| 27 | class TDataTypeManager: public TNameSet<TDLDataTypeName> |
| 28 | { |
| 29 | public: // interface |
| 30 | // names to build/compare datatypes |
| 31 | |
| 32 | /// get name of the default string datatype |
| 33 | static const char* getStrTypeName ( void ) { return "http://www.w3.org/2001/XMLSchema#string"; } |
| 34 | /// get name of the default integer datatype |
| 35 | static const char* getIntTypeName ( void ) { return "http://www.w3.org/2001/XMLSchema#integer"; } |
| 36 | /// get name of the default floating point datatype |
| 37 | static const char* getRealTypeName ( void ) { return "http://www.w3.org/2001/XMLSchema#float"; } |
| 38 | /// get name of the default boolean datatype |
| 39 | static const char* getBoolTypeName ( void ) { return "http://www.w3.org/2001/XMLSchema#boolean"; } |
| 40 | /// get name of the default date-time datatype |
| 41 | static const char* getTimeTypeName ( void ) { return "http://www.w3.org/2001/XMLSchema#dateTimeAsLong"; } |
| 42 | }; // TDataTypeManager |
| 43 | |
| 44 | // helpers for the users |
| 45 | |
| 46 | /// @return true iff TYPE is a default string data type |
| 47 | inline bool isStrDataType ( const TDLDataTypeName* type ) { return std::string(type->getName()) == TDataTypeManager::getStrTypeName(); } |
| 48 | /// @return true iff TYPE is a default integer data type |
| 49 | inline bool isIntDataType ( const TDLDataTypeName* type ) { return std::string(type->getName()) == TDataTypeManager::getIntTypeName(); } |
| 50 | /// @return true iff TYPE is a default floating point data type |
| 51 | inline bool isRealDataType ( const TDLDataTypeName* type ) { return std::string(type->getName()) == TDataTypeManager::getRealTypeName(); } |
| 52 | /// @return true iff TYPE is a default boolean data type |
| 53 | inline bool isBoolDataType ( const TDLDataTypeName* type ) { return std::string(type->getName()) == TDataTypeManager::getBoolTypeName(); } |
| 54 | /// @return true iff TYPE is a default date-time data type |
| 55 | inline bool isTimeDataType ( const TDLDataTypeName* type ) { return std::string(type->getName()) == TDataTypeManager::getTimeTypeName(); } |
| 56 | |
| 57 | #endif |