File indexing completed on 2024-04-21 03:41:35
0001 /* 0002 SPDX-FileCopyrightText: 2003, 2004, 2005 Carsten Niehaus <cniehaus@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef ELEMENT_H 0008 #define ELEMENT_H 0009 0010 #include "science_export.h" 0011 0012 #include <QList> 0013 #include <QVariant> 0014 0015 #include "chemicaldataobject.h" 0016 0017 /** 0018 * In this class all information about an element are stored. This means that 0019 * both the chemical date and the data about the position are stored 0020 * in this class. 0021 * @short This class is the representation of a chemical element 0022 * @author Carsten Niehaus 0023 */ 0024 class SCIENCE_EXPORT Element 0025 { 0026 public: 0027 Element(); 0028 0029 virtual ~Element(); 0030 0031 /** 0032 * Add the ChemicalDataObject @p o to this Element 0033 * @param o the ChemicalDataObject to be added 0034 */ 0035 void addData(const ChemicalDataObject &o); 0036 0037 /** 0038 * Add a ChemicalDataObject with @p value of @p type to this 0039 * Element 0040 * @param value the QVariant to be added 0041 * @param type the BlueObelisk type to be added 0042 */ 0043 void addData(const QVariant &value, ChemicalDataObject::BlueObelisk type); 0044 0045 /** 0046 * @return the requested data of the type @p type as a QVariant 0047 */ 0048 QVariant dataAsVariant(ChemicalDataObject::BlueObelisk type) const; 0049 0050 /** 0051 * @return the requested data of the type @p type with the unit @p unit as a QVariant 0052 */ 0053 QVariant dataAsVariant(ChemicalDataObject::BlueObelisk type, int unit) const; 0054 0055 /** 0056 * @return the requested data of the type @p type as a QString 0057 */ 0058 QString dataAsString(ChemicalDataObject::BlueObelisk type) const; 0059 /** 0060 * @return the requested data of the type @p type with the given unit @p unit as a QString 0061 */ 0062 QString dataAsString(ChemicalDataObject::BlueObelisk type, int unit) const; 0063 0064 /** 0065 * @return the requested data of the type @p type with the unit @p unit as a QString 0066 * The unit symbol is appended to the value. The value is round to show 4 significant decimals. 0067 */ 0068 QString dataAsStringWithUnit(ChemicalDataObject::BlueObelisk type, int unit) const; 0069 0070 /** 0071 * @return the data of the Element 0072 */ 0073 QList<ChemicalDataObject> data() const 0074 { 0075 return dataList; 0076 } 0077 0078 private: 0079 /** 0080 * this QList stores all information about an element 0081 */ 0082 QList<ChemicalDataObject> dataList; 0083 }; 0084 0085 #endif // ELEMENT_H