Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_customproperty.hpp
1/*
2##############################################################################
3# file: ms_customproperty.hpp #
4# 'msparser' toolkit #
5# Represents a custom property with unknown structure. It is useful for new #
6# properties or for properties with variable structure that can be explored #
7# at run-time #
8##############################################################################
9# COPYRIGHT NOTICE #
10# Copyright 1998-2003 Matrix Science Limited All Rights Reserved. #
11# #
12##############################################################################
13# $Archive:: /Mowse/ms_mascotresfile/include/ms_customproperty.hpp $ #
14# $Author: villek@matrixscience.com $ #
15# $Date: 2018-07-30 16:23:53 +0100 $ #
16# $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
17# $NoKeywords:: $ #
18##############################################################################
19*/
20
21#ifndef MS_CUSTOMPROPERTY_HPP
22#define MS_CUSTOMPROPERTY_HPP
23
24
25#include <string>
26#include <vector>
27
28#include "msparser_lim.hpp"
29
30namespace matrix_science {
31
33
90 class MS_MASCOTRESFILE_API ms_customproperty
91 {
92 public:
95
98
100 void defaultValues();
101
103 void copyFrom(const ms_customproperty* src);
104
106 int getNumberOfProperties() const;
107
109 std::string getPropertyName(const int index) const;
110
112 void setPropertyName(const int index, const char* name);
113
115 int findProperty(const char* name, const int startFrom = 0) const;
116
118 int findPropertyBeginning(const char* nameBeginning, const int startFrom = 0) const;
119
121 std::string getPropValStringByName(const char* name) const;
122
124 std::string getPropValStringByNumber(const int index) const;
125
127 std::string getDelimiterByNumber(const int index) const;
128
130 void appendProperty
131 ( const char* name
132 , const char* value
133 , const char* delimiter
134 , const bool bFirstPlace = false
135 );
136
138 void appendText
139 ( const char* line
140 , const bool bFirstPlace = false
141 );
142
144 void setPropValStringByName
145 ( const char* name
146 , const char* value
147 , const bool bFirstPlace = false
148 );
149
151 void setPropValCharByName
152 ( const char* name
153 , const char value
154 , const bool bFirstPlace = false
155 );
156
158 void setPropValIntByName
159 ( const char* name
160 , const int value
161 , const bool bFirstPlace = false
162 );
163
165 void setPropValInt64ByName
166 ( const char* name
167 , const INT64 value
168 , const bool bFirstPlace = false
169 );
170
172 void setPropValBoolByName
173 ( const char* name
174 , const bool value
175 , const bool bFirstPlace = false
176 );
177
179 void setPropValFloatByName
180 ( const char* name
181 , const double value
182 , const bool bFirstPlace = false
183 );
184
186 void setPropValStringByNumber
187 ( const int index
188 , const char* value
189 );
190
191
193 std::string getDefaultDelimiter() const;
194
196 void setDefaultDelimiter(const char* delim);
197
199 void delProp(const char* name);
200
202 void delPropStart(const char* nameBeginning);
203
205 void delNonEmpty();
206
208 void delPropByNumber(const int index);
209
211 bool uncommentProp(const int index, const char * delimeter = 0);
212
214 std::string getPreceedingComments() const;
215
217 void setPreceedingComments(const std::string & comments);
218
219 private:
220 std::vector< std::string > names_;
221 std::vector< std::string > values_;
222 std::vector< std::string > delimiters_;
223 std::string defaultDelimiter_;
224 std::string preceedingComments_;
225 }; // class ms_customproperty
226} // namespace matrix_science
227
228#endif // MS_CUSTOMPROPERTY_HPP
229
230/*------------------------------- End of File -------------------------------*/
The class is used as a base for property-containing classes, such as ms_mascotoptions.
Definition: ms_customproperty.hpp:91