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

Generated on Sun Nov 7 19:06:54 2004 for Mango by doxygen 1.3.6