Chemical Data Processing Library C++ API - Version 1.1.1
StringDataBlock.hpp
Go to the documentation of this file.
1 /*
2  * StringDataBlock.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_CHEM_STRINGDATABLOCK_HPP
30 #define CDPL_CHEM_STRINGDATABLOCK_HPP
31 
32 #include <string>
33 
34 #include "CDPL/Chem/APIPrefix.hpp"
35 #include "CDPL/Util/Array.hpp"
36 
37 
38 namespace CDPL
39 {
40 
41  namespace Chem
42  {
43 
49  {
50 
51  public:
56 
62  StringDataBlockEntry(const std::string& header, const std::string& data):
63  header(header), data(data) {}
64 
69  const std::string& getHeader() const;
70 
75  void setHeader(const std::string& header);
76 
81  const std::string& getData() const;
82 
87  void setData(const std::string& data);
88 
94  bool operator==(const StringDataBlockEntry& entry) const;
95 
105  bool operator!=(const StringDataBlockEntry& entry) const;
106 
107  bool operator<(const StringDataBlockEntry& entry) const;
108 
109  bool operator>(const StringDataBlockEntry& entry) const;
110 
111  bool operator<=(const StringDataBlockEntry& entry) const;
112 
113  bool operator>=(const StringDataBlockEntry& entry) const;
114 
115  private:
116  std::string header;
117  std::string data;
118  };
119 
124  class CDPL_CHEM_API StringDataBlock : public Util::Array<StringDataBlockEntry>
125  {
126 
127  public:
128  typedef std::shared_ptr<StringDataBlock> SharedPointer;
129 
130  void addEntry(const std::string& header, const std::string& data)
131  {
132  addElement(StringDataBlockEntry(header, data));
133  }
134 
135  private:
136  const char* getClassName() const
137  {
138  return "StringDataBlock";
139  }
140  };
141  } // namespace Chem
142 } // namespace CDPL
143 
144 #endif // CDPL_CHEM_STRINGDATABLOCK_HPP
CDPL::Chem::StringDataBlockEntry
Represents a data item in the structure or reaction data block of a MDL SD- or RD-File data record (s...
Definition: StringDataBlock.hpp:49
CDPL::Chem::StringDataBlockEntry::operator==
bool operator==(const StringDataBlockEntry &entry) const
Equality comparison operator.
APIPrefix.hpp
Definition of the preprocessor macro CDPL_CHEM_API.
CDPL_CHEM_API
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Chem::StringDataBlock::SharedPointer
std::shared_ptr< StringDataBlock > SharedPointer
Definition: StringDataBlock.hpp:128
CDPL::Util::Array
A dynamic array class providing amortized constant time access to arbitrary elements.
Definition: Array.hpp:92
Array.hpp
Definition of the class CDPL::Util::Array.
CDPL::Chem::StringDataBlockEntry::getData
const std::string & getData() const
Returns the stored data content.
CDPL::Chem::StringDataBlockEntry::operator>
bool operator>(const StringDataBlockEntry &entry) const
CDPL::Chem::StringDataBlockEntry::operator>=
bool operator>=(const StringDataBlockEntry &entry) const
CDPL::Chem::StringDataBlock
An array of Chem::StringDataBlockEntry objects used to store the structure or reaction data block of ...
Definition: StringDataBlock.hpp:125
CDPL::Chem::StringDataBlock::addEntry
void addEntry(const std::string &header, const std::string &data)
Definition: StringDataBlock.hpp:130
CDPL::Chem::StringDataBlockEntry::operator<
bool operator<(const StringDataBlockEntry &entry) const
CDPL::Chem::StringDataBlockEntry::operator!=
bool operator!=(const StringDataBlockEntry &entry) const
Inequality comparison operator.
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Chem::StringDataBlockEntry::operator<=
bool operator<=(const StringDataBlockEntry &entry) const
CDPL::Chem::StringDataBlockEntry::getHeader
const std::string & getHeader() const
Returns the data header.
CDPL::Chem::StringDataBlockEntry::setData
void setData(const std::string &data)
Sets the data content.
CDPL::Chem::StringDataBlockEntry::setHeader
void setHeader(const std::string &header)
Sets the data header.
CDPL::Chem::StringDataBlockEntry::StringDataBlockEntry
StringDataBlockEntry()
Constructs a StringDataBlockEntry object with an empty data header and content.
Definition: StringDataBlock.hpp:55
CDPL::Chem::StringDataBlockEntry::StringDataBlockEntry
StringDataBlockEntry(const std::string &header, const std::string &data)
Constructs a StringDataBlockEntry object with the specified data header and content.
Definition: StringDataBlock.hpp:62