00001
00025 #ifndef INC_MI32_UNITCONV_H
00026 #define INC_MI32_UNITCONV_H
00027
00028 #ifndef INC_MI32_INIDEFNS_H
00029 #include <mi32/inidefns.h>
00030 #endif
00031
00032 #ifndef INC_MI32_UOM_H
00033 #include <mi32/uom.h>
00034 #endif
00035
00036 #ifdef GEOMDLL
00037 #define GEOMLIBEXPORT MI_DLLEXPORT
00038 #else
00039 #define GEOMLIBEXPORT MI_DLLIMPORT
00040 #endif
00041
00042
00044 struct UNITCONV {
00045
00046
00047
00048 double fr_offset;
00049 double to_offset;
00050 double scale;
00051 UINT8 type;
00052 UINT8 to;
00053 UINT8 from;
00054 UINT8 do_string;
00055
00056 public:
00057
00059 UNITCONV (
00060 ): fr_offset(0), to_offset(0), scale(1), type(0), to(0), from(0), do_string(0) { }
00061
00063 explicit UNITCONV (
00064 double inscale
00065 ): fr_offset(0), to_offset(0), scale(inscale), type(0), to(0), from(0), do_string(0) { }
00066
00068 inline explicit UNITCONV (
00069 int UnitType,
00070 int FromCode = 0,
00071 int ToCode = 0
00072 );
00073
00076 inline void IniRead (
00077 INIHANDLE IniHandle,
00078 const char *IniGroup,
00079 const char *IniName,
00080 int UnitType = -1,
00081 int UnitCode = 0
00082 );
00083
00085 void IniWrite (
00086 INIHANDLE IniHandle,
00087 const char *IniGroup,
00088 const char *IniName
00089 ) const { ::IniWrite(IniHandle,IniGroup,IniName,this->to); return; }
00090
00091 };
00092
00093
00094
00095
00096
00097
00098 #define DATECONV_NoCent 0x80
00099
00100 #define DATECONV_ORDERMASK 0x03
00101 #define DATECONV_YMD 0x00
00102 #define DATECONV_YDM 0x01
00103 #define DATECONV_MDY 0x02
00104 #define DATECONV_DMY 0x03
00105
00106 #define DATECONV_MONTHMASK 0x0C
00107 #define DATECONV_MonthNum 0x00
00108 #define DATECONV_MonthAbbr 0x04
00109 #define DATECONV_MonthName 0x08
00110
00111 #define DATECONV_SEPMASK 0x70
00112 #define DATECONV_SepNone 0x00
00113 #define DATECONV_SepSpace 0x10
00114 #define DATECONV_SepDash 0x20
00115 #define DATECONV_SepDot 0x30
00116 #define DATECONV_SepSlash 0x40
00117 #define DATECONV_SepComma 0x50
00118
00119
00120
00121
00122
00123 #if defined(__cplusplus)
00124 extern "C" {
00125 #endif
00126
00130
00133 GEOMLIBEXPORT double ConvertUnit (
00134 double val,
00135 const UNITCONV *c
00136 );
00137
00140 GEOMLIBEXPORT double ConvertUnitInv (
00141 double val,
00142 const UNITCONV *conv
00143 );
00144
00157 GEOMLIBEXPORT double ConvertUnitStrInv (
00158 char *str,
00159 const UNITCONV *conv
00160 );
00161
00181 GEOMLIBEXPORT char * ConvertUnitStr (
00182 char *str,
00183 int len,
00184 double val,
00185 const UNITCONV *conv
00186 );
00187
00190 GEOMLIBEXPORT UNITCONV *GetUnitConversion (
00191 int type,
00192 int fromcode,
00193 int tocode,
00194 UNITCONV *conv
00195 );
00196
00199 GEOMLIBEXPORT UNITCONV *GetUnitConversionIdentity (
00200 int type,
00201 UNITCONV *conv
00202 );
00203
00204 #if defined(__cplusplus)
00205 }
00206 #endif
00207
00210 GEOMLIBEXPORT const MISTRING& GetUnitName (
00211 int type,
00212 int num
00213 );
00214
00217 GEOMLIBEXPORT const MISTRING& GetUnitSymbol (
00218 int type,
00219 int num
00220 );
00221
00222 #ifndef GENERATING_DOXYGEN_OUTPUT
00223
00224
00225 inline UNITCONV::UNITCONV (
00226 int UnitType,
00227 int FromCode,
00228 int ToCode
00229 ) {
00230 GetUnitConversion(UnitType,FromCode,ToCode,this);
00231 }
00232
00233 inline void UNITCONV::IniRead (
00234 INIHANDLE IniHandle,
00235 const char *IniGroup,
00236 const char *IniName,
00237 int UnitType,
00238 int UnitCode
00239 ) {
00240 if (UnitType == -1) UnitType = this->type;
00241 ::IniRead(IniHandle,IniGroup,IniName,UnitCode);
00242 GetUnitConversion(UnitType,this->from,UnitCode,this);
00243 return;
00244 }
00245
00246 #endif // GENERATING_DOXYGEN_OUTPUT
00247
00249
00250 #endif