00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef RTKREGCONFIG_H
00022 #define RTKREGCONFIG_H
00023
00024 #include "rtknamespace.h"
00025
00026 namespace RTK {
00027
00028
00029 class RegConfig {
00030
00031 public:
00032 void setLocale(const char *locale="");
00033 void setLocaleCurrencyFormat(const char *locale="");
00034 void setLocaleNumberFormat(const char *locale="");
00035 void setLocaleDateFormats(const char *locale="");
00036 void setDateFormat(const String &format);
00037 void setTimeFormat(const String &format);
00038 void setDateTimeFormat(const String &format);
00039 void setCurrencyFormat(const String& currencysymbol,
00040 int currencyfracdigits = 2,
00041 QChar currencydecimalpoint = ',',
00042 QChar currencythousandssep = '.',
00043 int p_cs_precedes = 0,
00044 int p_sep_by_space = 1,
00045 int p_sign_posn = 1,
00046 int n_cs_precedes = 0,
00047 int n_sep_by_space = 1,
00048 int n_sign_posn = 1,
00049 const char *grouping="\x03");
00050
00051 void setNumberFormat( int frac_digits = 2,
00052 QChar decimalpoint = ',',
00053 QChar thousandssep = '.',
00054 const String& positivesign = "",
00055 const String& negativesign = "-",
00056 const char *grouping="\x03");
00057
00058 const String &getCurrencyMask() const { return mCurrencyMask; }
00059 const String &getNumberMask() const { return mNumberMask; }
00060
00061 public:
00062 RegConfig(QChar decimalpoint = ',', QChar thousandssep = '.',
00063 const String& positivesign = "", const String& negativesign = "-", const String& currencysymbol = "",
00064 int currencyfracdigits = 2, QChar currencydecimalpoint = ',', QChar currencythousandssep = '.',
00065 const String& datemask = "", const String& timemask = "", const String& datetimemask = "",
00066 int psignposn = 1, int pcsprecedes = 0, int psepbyspace = 0,
00067 int nsignposn = 1, int ncsprecedes = 0, int nsepbyspace = 0, const String& grouping = "")
00068 :mDecimalPoint(decimalpoint), mThousandsSep(thousandssep),
00069 mPositiveSign(positivesign), mNegativeSign(negativesign), mCurrencySymbol(currencysymbol),
00070 mCurrencyFracDigits(currencyfracdigits), mCurrencyDecimalPoint(currencydecimalpoint), mCurrencyThousandsSep(currencythousandssep),
00071 mDateMask(datemask), mTimeMask(timemask), mDateTimeMask(datetimemask),
00072 mPSignPosn(psignposn), mPCSPrecedes(pcsprecedes), mPSepBySpace(psepbyspace),
00073 mNSignPosn(nsignposn), mNCSPrecedes(ncsprecedes), mNSepBySpace(nsepbyspace), mGrouping(grouping)
00074 {};
00076 QChar getDecimalPoint() const { return mDecimalPoint; };
00078 void setDecimalPoint(QChar decimalpoint) { mDecimalPoint = decimalpoint; };
00080 QChar getThousandsSep() const { return mThousandsSep; };
00082 void setThousandsSep(QChar thousandssep) { mThousandsSep = thousandssep; };
00084 const String& getPositiveSign() const { return mPositiveSign; };
00086 void setPositiveSign(const String& positivesign) { mPositiveSign = positivesign; };
00088 const String& getNegativeSign() const { return mNegativeSign; };
00090 void setNegativeSign(const String& negativesign) { mNegativeSign = negativesign; };
00092 const String& getCurrencySymbol() const { return mCurrencySymbol; };
00094 void setCurrencySymbol(const String& currencysymbol) { mCurrencySymbol = currencysymbol; };
00096 int getCurrencyFracDigits() const { return mCurrencyFracDigits; };
00098 void setCurrencyFracDigits(int currencyfracdigits) { mCurrencyFracDigits = currencyfracdigits; };
00100 QChar getCurrencyDecimalPoint() const { return mCurrencyDecimalPoint; };
00102 void setCurrencyDecimalPoint(QChar currencydecimalpoint) { mCurrencyDecimalPoint = currencydecimalpoint; };
00104 QChar getCurrencyThousandsSep() const { return mCurrencyThousandsSep; };
00106 void setCurrencyThousandsSep(QChar currencythousandssep) { mCurrencyThousandsSep = currencythousandssep; };
00108 const String& getDateMask() const { return mDateMask; };
00110 void setDateMask(const String& datemask) { mDateMask = datemask; };
00112 const String& getTimeMask() const { return mTimeMask; };
00114 void setTimeMask(const String& timemask) { mTimeMask = timemask; };
00116 const String& getDateTimeMask() const { return mDateTimeMask; };
00118 void setDateTimeMask(const String& datetimemask) { mDateTimeMask = datetimemask; };
00120 int getPSignPosn() const { return mPSignPosn; };
00122 void setPSignPosn(int psignposn) { mPSignPosn = psignposn; };
00124 int getPCSPrecedes() const { return mPCSPrecedes; };
00126 void setPCSPrecedes(int pcsprecedes) { mPCSPrecedes = pcsprecedes; };
00128 int getPSepBySpace() const { return mPSepBySpace; };
00130 void setPSepBySpace(int psepbyspace) { mPSepBySpace = psepbyspace; };
00132 int getNSignPosn() const { return mNSignPosn; };
00134 void setNSignPosn(int nsignposn) { mNSignPosn = nsignposn; };
00136 int getNCSPrecedes() const { return mNCSPrecedes; };
00138 void setNCSPrecedes(int ncsprecedes) { mNCSPrecedes = ncsprecedes; };
00140 int getNSepBySpace() const { return mNSepBySpace; };
00142 void setNSepBySpace(int nsepbyspace) { mNSepBySpace = nsepbyspace; };
00143 const String& getGrouping() const { return mGrouping; };
00144 void setGrouping(const String& grouping) { mGrouping = grouping; };
00145 protected:
00146 QChar mDecimalPoint;
00147 QChar mThousandsSep;
00148 String mPositiveSign;
00149 String mNegativeSign;
00150 String mCurrencySymbol;
00151 int mCurrencyFracDigits;
00152 QChar mCurrencyDecimalPoint;
00153 QChar mCurrencyThousandsSep;
00154 String mDateMask;
00155 String mTimeMask;
00156 String mDateTimeMask;
00157 int mPSignPosn;
00158 int mPCSPrecedes;
00159 int mPSepBySpace;
00160 int mNSignPosn;
00161 int mNCSPrecedes;
00162 int mNSepBySpace;
00163 String mGrouping;
00164
00165 private:
00166 String mCurrencyMask, mNumberMask;
00167 String buildNumberMask(const char *grouping, int digits);
00168 String buildDateMask(int wich_format, const char *nl_format);
00169 };
00170
00171 };
00172
00173 #endif