GlobalObjects
Loading...
Searching...
No Matches
EuUnsignedMagicNumber.h
Go to the documentation of this file.
1#ifndef INC_EUUNSIGNEDMAGICNUMBER_H
2#define INC_EUUNSIGNEDMAGICNUMBER_H
3//-----------------------------------------------------------------------------
51//-----------------------------------------------------------------------------
52#include "EuToolTypes.h"
53#include <string>
54//-----------------------------------------------------------------------------
55namespace eut
56{
57 //---------------------------------------------------------------------------
122 {
123 private:
124 //============== Enum
125 //-------------------------------------------------------------------------
136 {
156 eSUBTRACT
157 };
158 //-------------------------------------------------------------------------
159
160 //============== Attribute
161 //-----------------------------------------------------------------------
172 //-----------------------------------------------------------------------
182 unsigned int m_uiMaxSize;
183 //-----------------------------------------------------------------------
194 //-----------------------------------------------------------------------
205 //-----------------------------------------------------------------------
216 //-----------------------------------------------------------------------
217
218 public:
219 //============= Konstruktoren
220 //-----------------------------------------------------------------------
231 //-----------------------------------------------------------------------
247 UnsignedMagicNumber( unsigned int uiMaxSize );
248 //-----------------------------------------------------------------------
270 UnsignedMagicNumber( unsigned int uiMaxSize, const char * pchValue );
271 //-----------------------------------------------------------------------
293 UnsignedMagicNumber( unsigned int uiMaxSize, const std::string & rsValue );
294 //-----------------------------------------------------------------------
315 UnsignedMagicNumber( unsigned int uiMaxSize, char chLastRangeDigit );
316 //-----------------------------------------------------------------------
344 UnsignedMagicNumber( unsigned int uiMaxSize,
345 char chLastRangeDigit,
346 const char * pchValue );
347 //-----------------------------------------------------------------------
375 UnsignedMagicNumber( unsigned int uiMaxSize,
376 char chLastRangeDigit,
377 const std::string & rsValue );
378 //-----------------------------------------------------------------------
399 UnsignedMagicNumber( unsigned int uiMaxSize,
400 char chFirstRangeDigit,
401 char chLastRangeDigit );
402 //-----------------------------------------------------------------------
433 UnsignedMagicNumber( unsigned int uiMaxSize,
434 char chFirstRangeDigit,
435 char chLastRangeDigit,
436 const char * pchValue );
437 //-----------------------------------------------------------------------
466 UnsignedMagicNumber( unsigned int uiMaxSize,
467 char chFirstRangeDigit,
468 char chLastRangeDigit,
469 const std::string & rsValue );
470 //-----------------------------------------------------------------------
483 //-----------------------------------------------------------------------
494 //-----------------------------------------------------------------------
495
496 private:
497 //============== Methoden
498 //-----------------------------------------------------------------------
517 void init( char chFirstRangeDigit,
518 char chLastRangeDigit );
519 //-----------------------------------------------------------------------
535 bool isInRange( const char chCharacter ) const;
536 //-----------------------------------------------------------------------
553 void convertAsciiCharInOwn( char & rchChar ) const;
554 //-----------------------------------------------------------------------
573 char getAsciiCharInOwn( const char & rchChar ) const;
574 //-----------------------------------------------------------------------
591 void convertOwnCharInAscii( char & rchChar ) const;
592 //-----------------------------------------------------------------------
611 char getOwnCharInAscii( const char & rchChar ) const;
612 //-----------------------------------------------------------------------
632 void convertAsciiCharArrayInOwn( char * pchChar ) const;
633 //-----------------------------------------------------------------------
653 void convertOwnCharArrayInAscii( char * pchChar ) const;
654 //-----------------------------------------------------------------------
655
656 public:
657 //============== Methoden
658 //-----------------------------------------------------------------------
678 int setValue( const char * pchValue );
679 //-----------------------------------------------------------------------
695 bool isAsciiInRange( const char chCharacter ) const;
696 //-----------------------------------------------------------------------
709 bool isNULL() const;
710 //-----------------------------------------------------------------------
720 void setNULL();
721 //-----------------------------------------------------------------------
733 unsigned int getMaxSize() const;
734 //-----------------------------------------------------------------------
746 char getFirstRangeDigit() const;
747 //-----------------------------------------------------------------------
759 char getLastRangeDigit() const;
760 //-----------------------------------------------------------------------
772 std::string toString() const;
773 //-----------------------------------------------------------------------
786 //-----------------------------------------------------------------------
787
788 private:
789 //============== Statische Methoden
790 //-----------------------------------------------------------------------
806 bool checkFirstLast( char chFirstRangeDigit,
807 char chLastRangeDigit );
808 //-----------------------------------------------------------------------
834 bool addChar( char & rchTarget,
835 const char chSource,
836 char chLastRangeDigit );
837 //-----------------------------------------------------------------------
863 bool subtractChar( char & rchTarget,
864 const char chSource,
865 char chLastRangeDigit );
866 //-----------------------------------------------------------------------
915 int addValue( char * pchTarget,
916 const char * pchSource,
917 unsigned int uiMaxSize,
918 char chFirstRangeDigit,
919 char chLastRangeDigit );
920 //-----------------------------------------------------------------------
970 int subtractValue( char * pchTarget,
971 const char * pchSource,
972 unsigned int uiMaxSize,
973 char chFirstRangeDigit,
974 char chLastRangeDigit );
975 //-----------------------------------------------------------------------
1026 int calculateValue( char * pchTarget,
1027 const char * pchSource,
1028 unsigned int uiMaxSize,
1029 char chFirstRangeDigit,
1030 char chLastRangeDigit,
1031 EnCalcType eCalcType );
1032 //-----------------------------------------------------------------------
1033
1034 public:
1035 //============== Operatoren
1036 //-----------------------------------------------------------------------
1038
1047 bool operator== ( const UnsignedMagicNumber & rT ) const;
1048 bool operator!= ( const UnsignedMagicNumber & rT ) const;
1050 //-----------------------------------------------------------------------
1052
1061 bool operator> ( const UnsignedMagicNumber & rT ) const;
1062 bool operator>= ( const UnsignedMagicNumber & rT ) const;
1063 bool operator< ( const UnsignedMagicNumber & rT ) const;
1064 bool operator<= ( const UnsignedMagicNumber & rT ) const;
1066 //-----------------------------------------------------------------------
1068
1094 UnsignedMagicNumber & operator++ ();
1095 UnsignedMagicNumber operator++ ( int );
1096 UnsignedMagicNumber & operator+= ( const UnsignedMagicNumber & rrT );
1097 UnsignedMagicNumber & operator-- ();
1098 UnsignedMagicNumber operator-- ( int );
1099 UnsignedMagicNumber & operator-= ( const UnsignedMagicNumber & rrT );
1101 //-----------------------------------------------------------------------
1113 UnsignedMagicNumber & operator= ( const UnsignedMagicNumber & rT );
1114 //-----------------------------------------------------------------------
1116 {
1117 lT += rrT;
1118 return lT;
1119 };
1120 //-----------------------------------------------------------------------
1122 {
1123 lT -= rrT;
1124 return lT;
1125 };
1126 //-----------------------------------------------------------------------
1127 friend std::ostream & operator<<( std::ostream & rOStream, const UnsignedMagicNumber & rMagicNumber )
1128 {
1129 return rOStream << rMagicNumber.toString();
1130 };
1131 //-----------------------------------------------------------------------
1132 friend std::istream & operator>>( std::istream & rIStream, UnsignedMagicNumber & rMagicNumber )
1133 {
1134 std::string t_sMagicNumber;
1135
1136 rIStream >> t_sMagicNumber;
1137 rMagicNumber.setValue( t_sMagicNumber.c_str() );
1138 return rIStream;
1139 };
1140 //-----------------------------------------------------------------------
1141 };
1142 //---------------------------------------------------------------------------
1143} // namespace eut
1144#endif
For each library, here 'EuTools' there is a type file.
#define __tool_export_dll
Definition EuToolTypes.h:77
A UnsignedMagicNumber is an artificial number consisting of numbers and letters (similar to hex numbe...
Definition EuUnsignedMagicNumber.h:122
int setValue(const char *pchValue)
UnsignedMagicNumber(unsigned int uiMaxSize, char chFirstRangeDigit, char chLastRangeDigit, const char *pchValue)
UnsignedMagicNumber(unsigned int uiMaxSize)
UnsignedMagicNumber(unsigned int uiMaxSize, const std::string &rsValue)
char * m_pchValue
Definition EuUnsignedMagicNumber.h:171
int m_iLastError
Definition EuUnsignedMagicNumber.h:215
UnsignedMagicNumber(unsigned int uiMaxSize, const char *pchValue)
unsigned int m_uiMaxSize
Definition EuUnsignedMagicNumber.h:182
void convertAsciiCharArrayInOwn(char *pchChar) const
char getFirstRangeDigit() const
bool subtractChar(char &rchTarget, const char chSource, char chLastRangeDigit)
bool checkFirstLast(char chFirstRangeDigit, char chLastRangeDigit)
char getLastRangeDigit() const
int subtractValue(char *pchTarget, const char *pchSource, unsigned int uiMaxSize, char chFirstRangeDigit, char chLastRangeDigit)
void convertAsciiCharInOwn(char &rchChar) const
std::string toString() const
UnsignedMagicNumber(unsigned int uiMaxSize, char chLastRangeDigit, const char *pchValue)
EnCalcType
Definition EuUnsignedMagicNumber.h:136
@ eADD
Definition EuUnsignedMagicNumber.h:146
char m_chLastRangeDigit
Definition EuUnsignedMagicNumber.h:204
UnsignedMagicNumber(const UnsignedMagicNumber &rT)
UnsignedMagicNumber(unsigned int uiMaxSize, char chFirstRangeDigit, char chLastRangeDigit)
char getAsciiCharInOwn(const char &rchChar) const
void convertOwnCharArrayInAscii(char *pchChar) const
UnsignedMagicNumber(unsigned int uiMaxSize, char chLastRangeDigit)
char m_chFirstRangeDigit
Definition EuUnsignedMagicNumber.h:193
friend std::istream & operator>>(std::istream &rIStream, UnsignedMagicNumber &rMagicNumber)
Definition EuUnsignedMagicNumber.h:1132
bool isInRange(const char chCharacter) const
friend std::ostream & operator<<(std::ostream &rOStream, const UnsignedMagicNumber &rMagicNumber)
Definition EuUnsignedMagicNumber.h:1127
char getOwnCharInAscii(const char &rchChar) const
int addValue(char *pchTarget, const char *pchSource, unsigned int uiMaxSize, char chFirstRangeDigit, char chLastRangeDigit)
bool addChar(char &rchTarget, const char chSource, char chLastRangeDigit)
bool isAsciiInRange(const char chCharacter) const
unsigned int getMaxSize() const
void init(char chFirstRangeDigit, char chLastRangeDigit)
UnsignedMagicNumber(unsigned int uiMaxSize, char chFirstRangeDigit, char chLastRangeDigit, const std::string &rsValue)
void convertOwnCharInAscii(char &rchChar) const
UnsignedMagicNumber(unsigned int uiMaxSize, char chLastRangeDigit, const std::string &rsValue)
int calculateValue(char *pchTarget, const char *pchSource, unsigned int uiMaxSize, char chFirstRangeDigit, char chLastRangeDigit, EnCalcType eCalcType)
Definition IniFile.h:62