Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

UNumberFormat.d

Go to the documentation of this file.
00001 /*******************************************************************************
00002 
00003         @file UNumberFormat.d
00004         
00005         Copyright (c) 2004 Kris Bell
00006         
00007         This software is provided 'as-is', without any express or implied
00008         warranty. In no event will the authors be held liable for damages
00009         of any kind arising from the use of this software.
00010         
00011         Permission is hereby granted to anyone to use this software for any 
00012         purpose, including commercial applications, and to alter it and/or 
00013         redistribute it freely, subject to the following restrictions:
00014         
00015         1. The origin of this software must not be misrepresented; you must 
00016            not claim that you wrote the original software. If you use this 
00017            software in a product, an acknowledgment within documentation of 
00018            said product would be appreciated but is not required.
00019 
00020         2. Altered source versions must be plainly marked as such, and must 
00021            not be misrepresented as being the original software.
00022 
00023         3. This notice may not be removed or altered from any distribution
00024            of the source.
00025 
00026         4. Derivative works are permitted, but they must carry this notice
00027            in full and credit the original source.
00028 
00029 
00030                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00031 
00032 
00033         @version        Initial version, November 2004      
00034         @author         Kris
00035 
00036         Note that this package and documentation is built around the ICU 
00037         project (http://oss.software.ibm.com/icu/). Below is the license 
00038         statement as specified by that software:
00039 
00040 
00041                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00042 
00043 
00044         ICU License - ICU 1.8.1 and later
00045 
00046         COPYRIGHT AND PERMISSION NOTICE
00047 
00048         Copyright (c) 1995-2003 International Business Machines Corporation and 
00049         others.
00050 
00051         All rights reserved.
00052 
00053         Permission is hereby granted, free of charge, to any person obtaining a
00054         copy of this software and associated documentation files (the
00055         "Software"), to deal in the Software without restriction, including
00056         without limitation the rights to use, copy, modify, merge, publish,
00057         distribute, and/or sell copies of the Software, and to permit persons
00058         to whom the Software is furnished to do so, provided that the above
00059         copyright notice(s) and this permission notice appear in all copies of
00060         the Software and that both the above copyright notice(s) and this
00061         permission notice appear in supporting documentation.
00062 
00063         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00064         OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00065         MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
00066         OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
00067         HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
00068         INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
00069         FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
00070         NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
00071         WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00072 
00073         Except as contained in this notice, the name of a copyright holder
00074         shall not be used in advertising or otherwise to promote the sale, use
00075         or other dealings in this Software without prior written authorization
00076         of the copyright holder.
00077 
00078         ----------------------------------------------------------------------
00079 
00080         All trademarks and registered trademarks mentioned herein are the 
00081         property of their respective owners.
00082 
00083 *******************************************************************************/
00084 
00085 module mango.icu.UNumberFormat;
00086 
00087 private import  mango.icu.ICU,
00088                 mango.icu.UString;
00089 
00090 public  import mango.icu.ULocale;
00091 
00092 /*******************************************************************************
00093 
00094 *******************************************************************************/
00095 
00096 class UDecimalFormat : UCommonFormat
00097 {
00098         /***********************************************************************
00099         
00100         ***********************************************************************/
00101 
00102         this (inout ULocale locale)
00103         {
00104                 super (Style.Decimal, null, locale);
00105         }
00106 
00107         /***********************************************************************
00108         
00109                 Set the pattern for a UDecimalFormat
00110 
00111         ***********************************************************************/
00112 
00113         void setPattern (UText pattern, bool localized)
00114         {
00115                 Error e;
00116 
00117                 unum_applyPattern (handle, localized, pattern.get, pattern.length, null, e);        
00118                 testError (e, "failed to set numeric pattern");
00119         }
00120 }
00121 
00122 
00123 /*******************************************************************************
00124 
00125 *******************************************************************************/
00126 
00127 class UCurrencyFormat : UCommonFormat
00128 {
00129         /***********************************************************************
00130         
00131         ***********************************************************************/
00132 
00133         this (inout ULocale locale)
00134         {
00135                 super (Style.Currency, null, locale);
00136         }
00137 }
00138 
00139 
00140 /*******************************************************************************
00141 
00142 *******************************************************************************/
00143 
00144 class UPercentFormat : UCommonFormat
00145 {
00146         /***********************************************************************
00147         
00148         ***********************************************************************/
00149 
00150         this (inout ULocale locale)
00151         {
00152                 super (Style.Percent, null, locale);
00153         }
00154 }
00155 
00156 
00157 /*******************************************************************************
00158 
00159 *******************************************************************************/
00160 
00161 class UScientificFormat : UCommonFormat
00162 {
00163         /***********************************************************************
00164         
00165         ***********************************************************************/
00166 
00167         this (inout ULocale locale)
00168         {
00169                 super (Style.Scientific, null, locale);
00170         }
00171 }
00172 
00173 
00174 /*******************************************************************************
00175 
00176 *******************************************************************************/
00177 
00178 class USpelloutFormat : UCommonFormat
00179 {
00180         /***********************************************************************
00181         
00182         ***********************************************************************/
00183 
00184         this (inout ULocale locale)
00185         {
00186                 super (Style.Spellout, null, locale);
00187         }
00188 }
00189 
00190 
00191 /*******************************************************************************
00192 
00193 *******************************************************************************/
00194 
00195 class UDurationFormat : UCommonFormat
00196 {
00197         /***********************************************************************
00198         
00199         ***********************************************************************/
00200 
00201         this (inout ULocale locale)
00202         {
00203                 super (Style.Duration, null, locale);
00204         }
00205 }
00206 
00207 
00208 /*******************************************************************************
00209 
00210 *******************************************************************************/
00211 
00212 class URuleBasedFormat : UNumberFormat
00213 {
00214         /***********************************************************************
00215         
00216         ***********************************************************************/
00217 
00218         this (inout ULocale locale)
00219         {
00220                 super (Style.RuleBased, null, locale);
00221         }
00222 
00223         /***********************************************************************
00224         
00225         ***********************************************************************/
00226 
00227         void setLenientParse (bool yes)
00228         {
00229                 unum_setAttribute (handle, Attribute.LenientParse, yes);
00230         }
00231 
00232 
00233         /***********************************************************************
00234         
00235         ***********************************************************************/
00236 
00237         bool isLenientParse ()
00238         {
00239                 return unum_getAttribute (handle, Attribute.LenientParse) != 0;
00240         }
00241 }
00242 
00243 
00244 /*******************************************************************************
00245 
00246 *******************************************************************************/
00247 
00248 private class UCommonFormat : UNumberFormat
00249 {
00250         /***********************************************************************
00251         
00252         ***********************************************************************/
00253 
00254         this (Style style, char[] pattern, inout ULocale locale)
00255         {
00256                 super (style, pattern, locale);
00257         }
00258 
00259         /***********************************************************************
00260         
00261                 Return true if this format will parse numbers as integers 
00262                 only
00263 
00264         ***********************************************************************/
00265 
00266         bool isParseIntegerOnly ()
00267         {
00268                 return unum_getAttribute (handle, Attribute.ParseIntOnly) != 0;
00269         } 
00270 
00271         /***********************************************************************
00272         
00273                 Returns true if grouping is used in this format.
00274 
00275         ***********************************************************************/
00276 
00277         bool isGroupingUsed ()
00278         {
00279                 return unum_getAttribute (handle, Attribute.GroupingUsed) != 0;
00280         } 
00281 
00282         /***********************************************************************
00283         
00284                 Always show decimal point?
00285 
00286         ***********************************************************************/
00287 
00288         bool isDecimalSeparatorAlwaysShown ()
00289         {
00290                 return unum_getAttribute (handle, Attribute.DecimalAlwaysShown) != 0;
00291         } 
00292 
00293         /***********************************************************************
00294         
00295                 Sets whether or not numbers should be parsed as integers 
00296                 only
00297 
00298         ***********************************************************************/
00299 
00300         void setParseIntegerOnly (bool yes)
00301         {
00302                 unum_setAttribute (handle, Attribute.ParseIntOnly, yes);
00303         } 
00304 
00305         /***********************************************************************
00306                
00307                Set whether or not grouping will be used in this format.
00308 
00309         ***********************************************************************/
00310 
00311         void setGroupingUsed (bool yes)
00312         {
00313                 unum_setAttribute (handle, Attribute.GroupingUsed, yes);
00314         } 
00315 
00316         /***********************************************************************
00317 
00318                 Always show decimal point.
00319 
00320         ***********************************************************************/
00321 
00322         void setDecimalSeparatorAlwaysShown (bool yes)
00323         {
00324                 unum_setAttribute (handle, Attribute.DecimalAlwaysShown, yes);
00325         } 
00326 
00327         /***********************************************************************
00328         
00329                 Sets the maximum number of digits allowed in the integer 
00330                 portion of a number.
00331 
00332         ***********************************************************************/
00333 
00334         void setMaxIntegerDigits (uint x)
00335         {
00336                 unum_setAttribute (handle, Attribute.MaxIntegerDigits, x);
00337         }
00338 
00339         /***********************************************************************
00340         
00341                 Sets the minimum number of digits allowed in the integer 
00342                 portion of a number.
00343 
00344         ***********************************************************************/
00345 
00346         void setMinIntegerDigits (uint x)
00347         {
00348                 unum_setAttribute (handle, Attribute.MinIntegerDigits, x);
00349         }
00350 
00351         /***********************************************************************
00352         
00353                 Integer digits displayed
00354 
00355         ***********************************************************************/
00356 
00357         void setIntegerDigits (uint x)
00358         {
00359                 unum_setAttribute (handle, Attribute.IntegerDigits, x);
00360         }
00361 
00362         /***********************************************************************
00363         
00364                 Sets the maximum number of digits allowed in the fraction 
00365                 portion of a number.
00366 
00367         ***********************************************************************/
00368 
00369         void setMaxFractionDigits (uint x)
00370         {
00371                 unum_setAttribute (handle, Attribute.MaxFractionDigits, x);
00372         }
00373 
00374         /***********************************************************************
00375         
00376                 Sets the minimum number of digits allowed in the fraction 
00377                 portion of a number.
00378 
00379         ***********************************************************************/
00380 
00381         void setMinFractionDigits (uint x)
00382         {
00383                 unum_setAttribute (handle, Attribute.MinFractionDigits, x);
00384         }
00385 
00386         /***********************************************************************
00387         
00388                 Fraction digits.
00389 
00390         ***********************************************************************/
00391 
00392         void setFractionDigits (uint x)
00393         {
00394                 unum_setAttribute (handle, Attribute.FractionDigits, x);
00395         }
00396 
00397         /***********************************************************************
00398         
00399         ***********************************************************************/
00400 
00401         void setMultiplier (uint x)
00402         {
00403                 unum_setAttribute (handle, Attribute.Multiplier, x);
00404         }
00405 
00406         /***********************************************************************
00407         
00408         ***********************************************************************/
00409 
00410         void setGroupingSize (uint x)
00411         {
00412                 unum_setAttribute (handle, Attribute.GroupingSize, x);
00413         }
00414 
00415         /***********************************************************************
00416         
00417         ***********************************************************************/
00418 
00419         void setRoundingMode (Rounding x)
00420         {
00421                 unum_setAttribute (handle, Attribute.RoundingMode, x);
00422         }
00423 
00424         /***********************************************************************
00425         
00426         ***********************************************************************/
00427 
00428         void setRoundingIncrement (uint x)
00429         {
00430                 unum_setAttribute (handle, Attribute.RoundingIncrement, x);
00431         }
00432 
00433         /***********************************************************************
00434         
00435                 The width to which the output of format() is padded
00436 
00437         ***********************************************************************/
00438 
00439         void setFormatWidth (uint x)
00440         {
00441                 unum_setAttribute (handle, Attribute.FormatWidth, x);
00442         }
00443 
00444         /***********************************************************************
00445         
00446                 The position at which padding will take place.
00447 
00448         ***********************************************************************/
00449 
00450         void setPaddingPosition (Pad x)
00451         {
00452                 unum_setAttribute (handle, Attribute.PaddingPosition, x);
00453         }
00454 
00455         /***********************************************************************
00456         
00457         ***********************************************************************/
00458 
00459         void setSecondaryGroupingSize (uint x)
00460         {
00461                 unum_setAttribute (handle, Attribute.SecondaryGroupingSize, x);
00462         }
00463 
00464         /***********************************************************************
00465         
00466         ***********************************************************************/
00467 
00468         void setSignificantDigitsUsed (uint x)
00469         {
00470                 unum_setAttribute (handle, Attribute.SignificantDigitsUsed, x);
00471         }
00472 
00473         /***********************************************************************
00474         
00475         ***********************************************************************/
00476 
00477         void setMinSignificantDigits (uint x)
00478         {
00479                 unum_setAttribute (handle, Attribute.MinSignificantDigits, x);
00480         }
00481 
00482         /***********************************************************************
00483         
00484         ***********************************************************************/
00485 
00486         void setMaxSignificantDigits (uint x)
00487         {
00488                 unum_setAttribute (handle, Attribute.MaxSignificantDigits, x);
00489         }
00490 
00491 
00492         /***********************************************************************
00493 
00494                 Returns the maximum number of digits allowed in the integer 
00495                 portion of a number.
00496         
00497         ***********************************************************************/
00498 
00499         uint getMaxIntegerDigits ()
00500         {
00501                 return unum_getAttribute (handle, Attribute.MaxIntegerDigits);
00502         }
00503 
00504         /***********************************************************************
00505                 
00506                 Returns the minimum number of digits allowed in the integer 
00507                 portion of a number.
00508 
00509         ***********************************************************************/
00510 
00511         uint getMinIntegerDigits ()
00512         {
00513                 return unum_getAttribute (handle, Attribute.MinIntegerDigits);
00514         }
00515 
00516         /***********************************************************************
00517         
00518         ***********************************************************************/
00519 
00520         uint getIntegerDigits ()
00521         {
00522                 return unum_getAttribute (handle, Attribute.IntegerDigits);
00523         }
00524 
00525         /***********************************************************************
00526         
00527                 Returns the maximum number of digits allowed in the fraction 
00528                 portion of a number.
00529 
00530         ***********************************************************************/
00531 
00532         uint getMaxFractionDigits ()
00533         {
00534                 return unum_getAttribute (handle, Attribute.MaxFractionDigits);
00535         }
00536 
00537         /***********************************************************************
00538         
00539         ***********************************************************************/
00540 
00541         uint getMinFractionDigits ()
00542         {
00543                 return unum_getAttribute (handle, Attribute.MinFractionDigits);
00544         }
00545 
00546         /***********************************************************************
00547         
00548         ***********************************************************************/
00549 
00550         uint getFractionDigits ()
00551         {
00552                 return unum_getAttribute (handle, Attribute.FractionDigits);
00553         }
00554 
00555         /***********************************************************************
00556         
00557         ***********************************************************************/
00558 
00559         uint getMultiplier ()
00560         {
00561                 return unum_getAttribute (handle, Attribute.Multiplier);
00562         }
00563 
00564         /***********************************************************************
00565         
00566         ***********************************************************************/
00567 
00568         uint getGroupingSize ()
00569         {
00570                 return unum_getAttribute (handle, Attribute.GroupingSize);
00571         }
00572 
00573         /***********************************************************************
00574         
00575         ***********************************************************************/
00576 
00577         Rounding getRoundingMode ()
00578         {
00579                 return cast(Rounding) unum_getAttribute (handle, Attribute.RoundingMode);
00580         }
00581 
00582         /***********************************************************************
00583         
00584         ***********************************************************************/
00585 
00586         uint getRoundingIncrement ()
00587         {
00588                 return unum_getAttribute (handle, Attribute.RoundingIncrement);
00589         }
00590 
00591         /***********************************************************************
00592         
00593         ***********************************************************************/
00594 
00595         uint getFormatWidth ()
00596         {
00597                 return unum_getAttribute (handle, Attribute.FormatWidth);
00598         }
00599 
00600         /***********************************************************************
00601         
00602         ***********************************************************************/
00603 
00604         Pad getPaddingPosition ()
00605         {
00606                 return cast(Pad) unum_getAttribute (handle, Attribute.PaddingPosition);
00607         }
00608 
00609         /***********************************************************************
00610         
00611         ***********************************************************************/
00612 
00613         uint getSecondaryGroupingSize ()
00614         {
00615                 return unum_getAttribute (handle, Attribute.SecondaryGroupingSize);
00616         }
00617 
00618         /***********************************************************************
00619         
00620         ***********************************************************************/
00621 
00622         uint getSignificantDigitsUsed ()
00623         {
00624                 return unum_getAttribute (handle, Attribute.SignificantDigitsUsed);
00625         }
00626 
00627         /***********************************************************************
00628         
00629         ***********************************************************************/
00630 
00631         uint getMinSignificantDigits ()
00632         {
00633                 return unum_getAttribute (handle, Attribute.MinSignificantDigits);
00634         }
00635 
00636         /***********************************************************************
00637         
00638         ***********************************************************************/
00639 
00640         uint getMaxSignificantDigits ()
00641         {
00642                 return unum_getAttribute (handle, Attribute.MaxSignificantDigits);
00643         }
00644 
00645         /***********************************************************************
00646         
00647         ***********************************************************************/
00648 
00649         void getPattern (UString dst, bool localize)
00650         {
00651                 uint fmat (wchar* result, uint len, inout Error e)
00652                 {
00653                         return unum_toPattern (handle, localize, result, len, e);
00654                 }
00655 
00656                 dst.format (&fmat, "failed to retrieve numeric format pattern");
00657         }
00658 }
00659 
00660 
00661 /*******************************************************************************
00662 
00663         UNumberFormat provides functions for formatting and parsing 
00664         a number. Also provides methods for determining which locales have 
00665         number formats, and what their names are.
00666 
00667         UNumberFormat helps you to format and parse numbers for any locale. 
00668         Your code can be completely independent of the locale conventions 
00669         for decimal points, thousands-separators, or even the particular 
00670         decimal digits used, or whether the number format is even decimal. 
00671         There are different number format styles like decimal, currency, 
00672         percent and spellout
00673 
00674         See <A HREF="http://oss.software.ibm.com/icu/apiref/unum_8h.html">
00675         this page</A> for full details.
00676 
00677 *******************************************************************************/
00678 
00679 class UNumberFormat : ICU
00680 {       
00681         package Handle  handle;  
00682 
00683         typedef void*   UFieldPos;
00684         typedef void*   ParseError;
00685 
00686 
00687         public  enum    Rounding    
00688                         {  
00689                         Ceiling, 
00690                         Floor, 
00691                         Down,
00692                         Up,
00693                         HalfEven,
00694                         HalfDown,
00695                         HalfUp
00696                         };
00697 
00698         public  enum    Pad     
00699                         {
00700                         BeforePrefix,
00701                         AfterPrefix,
00702                         BeforeSuffix,
00703                         AfterSuffix
00704                         };
00705                         
00706         private enum    Style     
00707                         {  
00708                         PatternDecimal, 
00709                         Decimal, 
00710                         Currency, 
00711                         Percent, 
00712                         Scientific,
00713                         Spellout, 
00714                         Ordinal, 
00715                         Duration, 
00716                         RuleBased, 
00717                         Default = Decimal,
00718                         Ignore = PatternDecimal
00719                         };
00720 
00721         private enum    Attribute 
00722                         {
00723                         ParseIntOnly, 
00724                         GroupingUsed, 
00725                         DecimalAlwaysShown, 
00726                         MaxIntegerDigits,
00727                         MinIntegerDigits, 
00728                         IntegerDigits, 
00729                         MaxFractionDigits, 
00730                         MinFractionDigits,
00731                         FractionDigits, 
00732                         Multiplier, 
00733                         GroupingSize, 
00734                         RoundingMode,
00735                         RoundingIncrement, 
00736                         FormatWidth, 
00737                         PaddingPosition, 
00738                         SecondaryGroupingSize,
00739                         SignificantDigitsUsed, 
00740                         MinSignificantDigits, 
00741                         MaxSignificantDigits, 
00742                         LenientParse
00743                         };
00744 
00745         private enum    Symbol 
00746                         {
00747                         DecimalSeparator, 
00748                         GroupingSeparator, 
00749                         PatternSeparator, 
00750                         Percent,
00751                         ZeroDigit, 
00752                         Digit, 
00753                         MinusSign, 
00754                         PlusSign,
00755                         Currency, 
00756                         IntlCurrency, 
00757                         MonetarySeparator, 
00758                         Exponential,
00759                         Permill, 
00760                         PadEscape, 
00761                         Infinity, 
00762                         Nan,
00763                         SignificantDigit, 
00764                         FormatSymbolCount
00765                         };
00766 
00767         /***********************************************************************
00768         
00769         ***********************************************************************/
00770 
00771         this (Style style, char[] pattern, inout ULocale locale)
00772         {
00773                 Error e;
00774 
00775                 handle = unum_open (style, pattern, pattern.length, toString(locale.name), null, e);
00776                 testError (e, "failed to create NumberFormat");
00777         }
00778 
00779         /***********************************************************************
00780         
00781         ***********************************************************************/
00782 
00783         ~this ()
00784         {
00785                 unum_close (handle);
00786         }
00787 
00788         /***********************************************************************
00789         
00790         ***********************************************************************/
00791 
00792         void format (UString dst, int number, UFieldPos p = null)
00793         {
00794                 uint fmat (wchar* result, uint len, inout Error e)
00795                 {
00796                         return unum_format (handle, number, result, len, p, e);
00797                 }
00798 
00799                 dst.format (&fmat, "int format failed");
00800         }
00801 
00802         /***********************************************************************
00803         
00804         ***********************************************************************/
00805 
00806         void format (UString dst, long number, UFieldPos p = null)
00807         {
00808                 uint fmat (wchar* result, uint len, inout Error e)
00809                 {
00810                         return unum_formatInt64 (handle, number, result, len, p, e);
00811                 }
00812 
00813                 dst.format (&fmat, "int64 format failed");
00814         }
00815 
00816         /***********************************************************************
00817         
00818         ***********************************************************************/
00819 
00820         void format (UString dst, double number, UFieldPos p = null)
00821         {
00822                 uint fmat (wchar* result, uint len, inout Error e)
00823                 {
00824                         return unum_formatDouble (handle, number, result, len, p, e);
00825                 }
00826 
00827                 dst.format (&fmat, "double format failed");
00828         }
00829 
00830         /***********************************************************************
00831         
00832         ***********************************************************************/
00833 
00834         int parseInteger (UText src, uint* index=null)
00835         {
00836                 Error e;
00837 
00838                 return unum_parse (handle, src.content, src.len, index, e); 
00839         }
00840 
00841         /***********************************************************************
00842         
00843         ***********************************************************************/
00844 
00845         long parseLong (UText src, uint* index=null)
00846         {
00847                 Error e;
00848 
00849                 return unum_parseInt64 (handle, src.content, src.len, index, e); 
00850         }
00851 
00852         /***********************************************************************
00853         
00854         ***********************************************************************/
00855 
00856         double parseDouble (UText src, uint* index=null)
00857         {
00858                 Error e;
00859 
00860                 return unum_parseDouble (handle, src.content, src.len, index, e); 
00861         }
00862 
00863 
00864 
00865         /***********************************************************************
00866         
00867                 Bind the ICU functions from a shared library. This is
00868                 complicated by the issues regarding D and DLLs on the
00869                 Windows platform
00870 
00871         ***********************************************************************/
00872 
00873         private static void* library;
00874 
00875         /***********************************************************************
00876 
00877         ***********************************************************************/
00878 
00879         private static extern (C) 
00880         {
00881                 Handle function (uint, char*, uint, char*, ParseError, inout Error) unum_open;
00882                 void   function (Handle) unum_close;
00883                 int    function (Handle, int,    wchar*, uint, UFieldPos, inout Error) unum_format;
00884                 int    function (Handle, long,   wchar*, uint, UFieldPos, inout Error) unum_formatInt64;
00885                 int    function (Handle, double, wchar*, uint, UFieldPos, inout Error) unum_formatDouble;
00886                 int    function (Handle, wchar*, uint, uint*, inout Error) unum_parse;
00887                 long   function (Handle, wchar*, uint, uint*, inout Error) unum_parseInt64;
00888                 double function (Handle, wchar*, uint, uint*, inout Error) unum_parseDouble;
00889                 int    function (Handle, uint) unum_getAttribute;
00890                 void   function (Handle, uint, uint) unum_setAttribute;
00891                 uint   function (Handle, byte, wchar*, uint, inout Error) unum_toPattern;
00892                 void   function (Handle, byte, wchar*, uint, ParseError, inout Error) unum_applyPattern;
00893         }
00894 
00895         /***********************************************************************
00896 
00897         ***********************************************************************/
00898 
00899         static  FunctionLoader.Bind[] targets = 
00900                 [
00901                 {cast(void**) &unum_open,        "unum_open"}, 
00902                 {cast(void**) &unum_close,       "unum_close"},
00903                 {cast(void**) &unum_format,      "unum_format"},
00904                 {cast(void**) &unum_formatInt64  "unum_formatInt64"},
00905                 {cast(void**) &unum_formatDouble "unum_formatDouble"},
00906                 {cast(void**) &unum_parse,       "unum_parse"},
00907                 {cast(void**) &unum_parseInt64   "unum_parseInt64"},
00908                 {cast(void**) &unum_parseDouble  "unum_parseDouble"},
00909                 {cast(void**) &unum_getAttribute "unum_getAttribute"},
00910                 {cast(void**) &unum_setAttribute "unum_setAttribute"},
00911                 {cast(void**) &unum_toPattern    "unum_toPattern"},
00912                 ];
00913 
00914         /***********************************************************************
00915 
00916         ***********************************************************************/
00917 
00918         static this ()
00919         {
00920                 library = FunctionLoader.bind (icuin, targets);
00921         }
00922 
00923         /***********************************************************************
00924 
00925         ***********************************************************************/
00926 
00927         static ~this ()
00928         {
00929                 FunctionLoader.unbind (library);
00930         }
00931 }
00932 
00933 

Generated on Sun Mar 6 00:31:00 2005 for Mango by doxygen 1.3.6