GlobalObjects
Lade ...
Suche ...
Keine Treffer
GloFNumRecordAttribute.h
gehe zur Dokumentation dieser Datei
1#ifndef INC_GLOFNUMRECORDATTRIBUTE_H
2#define INC_GLOFNUMRECORDATTRIBUTE_H
3//-----------------------------------------------------------------------------
37//-----------------------------------------------------------------------------
38#include <sstream>
39#include <iomanip>
40#include <cmath>
41#include "GloTypes.h"
43#include "EuStdFunctions.h"
44//-----------------------------------------------------------------------------
45namespace glo
46{
47 //---------------------------------------------------------------------------
63 {
64 protected:
65 //============= Konstruktoren
66 //-----------------------------------------------------------------------
77 //-----------------------------------------------------------------------
90 //-----------------------------------------------------------------------
91
92 public:
93 //============= Konstruktoren
94 //-----------------------------------------------------------------------
118 const std::streampos & rFilePos );
119 //-----------------------------------------------------------------------
120
121 protected:
122 //============== Konstruktoren
123 //-----------------------------------------------------------------------
135 //-----------------------------------------------------------------------
136
137
138 public:
139 //============== Methods
140 //-----------------------------------------------------------------------
159 template<typename T> std::string getTValueAsString( const T & rTValue, bool bFillBlanks ) const;
160 //-----------------------------------------------------------------------
161
162 //============== Operatoren
163 //-----------------------------------------------------------------------
165
176 bool operator== ( const FNumRecordAttribute & rT ) const;
177 bool operator!= ( const FNumRecordAttribute & rT ) const;
179 //-----------------------------------------------------------------------
180
181 private:
182 //============== Operatoren
183 //-----------------------------------------------------------------------
194 //-----------------------------------------------------------------------
195 };
196 //---------------------------------------------------------------------------
197 #ifdef _MSC_VER
198 // Konvertierung von "xxx" in "yyy", möglicher Datenverlust
199 #pragma warning( disable : 4244 )
200 #endif
201 //---------------------------------------------------------------------------
202 template<typename T> std::string FNumRecordAttribute::getTValueAsString( const T & rTValue, bool bFillBlanks ) const
203 {
204 std::ostringstream t_ossTemp;
205 std::string t_strRetVal;
206 std::istringstream t_isTransform;
207 int t_iDigits(0);
208 T t_tValue( rTValue );
209
210 if ( this->getClassInfoAttribute() )
211 {
212 t_isTransform.clear();
213 t_isTransform.str( this->getTypeInfo() );
214 t_isTransform >> t_iDigits;
215 }
216 if ( t_iDigits > 0 )
217 {
218 t_tValue *= pow( (T) 10, t_iDigits);
219 if ( t_tValue >= 0 )
220 t_tValue = floor( t_tValue + 0.5 );
221 else
222 t_tValue = ceil( t_tValue - 0.5 );
223 t_tValue /= pow( (T) 10, t_iDigits );
224 t_ossTemp << std::setiosflags( std::ios::fixed )
225 << std::setprecision( t_iDigits )
226 << t_tValue;
227 }
228 else
229 {
230 t_ossTemp << std::scientific << t_tValue;
231 }
232 // Wenn Beschränkung und zu groß -> abschneiden
233 if ( t_ossTemp.str().length() > this->getDataFieldLength() )
234 {
235 t_strRetVal.clear();
236 t_strRetVal.append( t_ossTemp.str(),
237 std::size_t( 0 ),
238 std::size_t( this->getDataFieldLength() ) );
239 }
240 else
241 {
242 t_strRetVal = t_ossTemp.str();
243 if ( t_strRetVal.length() < this->getDataFieldLength() && bFillBlanks )
244 {
246 ' ',
247 this->getDataFieldLength(),
249 }
250 }
251 return t_strRetVal;
252 }
253 //---------------------------------------------------------------------------
254 #ifdef _MSC_VER
255 // Konvertierung von "xxx" in "yyy", möglicher Datenverlust
256 #pragma warning( default : 4244 )
257 #endif
258 //---------------------------------------------------------------------------
259} // namespace glo
260#endif
Header für StdStringFunctions
Header für BaseRecordAttribute
Für jede Bibliothek, hier 'GlobalObjects' gibt es eine Typen-Datei.
#define __glo_export_dll
Definition GloTypes.h:63
Basisklasse für die einzelnen Attribute eines Record.
Definition GloBaseRecordAttribute.h:109
ClassInfoAttribute * getClassInfoAttribute() const
virtual unsigned short getDataFieldLength() const =0
std::string getTypeInfo() const
In Objekten dieser Klasse sind die Information für GlobalObjects, wie ein persistentes Klassenattribu...
Definition GloClassInfoAttribute.h:76
Repräsentiert als Oberklasse alle Fließkommazahl-Attribute von einem persistenten Objekt.
Definition GloFNumRecordAttribute.h:63
std::string getTValueAsString(const T &rTValue, bool bFillBlanks) const
Definition GloFNumRecordAttribute.h:202
FNumRecordAttribute(ClassInfoAttribute *pType, const std::streampos &rFilePos)
FNumRecordAttribute(const FNumRecordAttribute &rT)
__tool_export_dll void fillString(std::string &rstr, char cFillItem, std::size_t nNumber, EnStrPos ePos)
@ eBEFORE
Definition EuStdFunctions.h:139
Definition GloAbstractBaseLot.h:42