Mobile API Reference  MicroStrategy 2019
NumberFormat.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : NumberFormat.h
3 // AUTHOR : Yuxiao Xiao
4 // CREATION : 10/26/01
5 // Modified by Liang Liu at May 27, 2010.
6 // Copyright (C) MicroStrategy, Inc. 2001
7 //==============================================================================================
8 #ifndef MFormat_NumberFormat_h
9 #define MFormat_NumberFormat_h
10 
11 #include "PDCHeader/PDCwtypes.h"
12 
13 #include "Base/Base/ReturnString.h"
14 #include "Synch/Defines/SmartPtr.h"
16 
17 namespace MFormat
18 {
19  typedef enum
20  {
21  NONCOLOR = 0x010101,
22  BLACK = 0x0,
23  RED = 0xFF,
24  GREEN = 0x8000,
25  YELLOW = 0xFFFF,
26  BLUE = 0xFF0000,
27  MAGENTA = 0xFF00FF,
28  CYAN = 0xFFFF00,
29  WHITE = 0xFFFFFF
30  } COLOR;
31 
33  {
34  public:
35 
36  // The following is a description of format strings.
37  // A format string is a string that specifies how a number should be formatted.
38  // It consists of two sub-patterns separated by a semi-colon.
39  // The first sub-pattern is for positive numbers. The second (optional) sub-pattern is used for negative numbers.
40  // Here are the special characters used in the parts of the sub-pattern, with notes on their usage.
41 
42  // Symbol Meaning
43  // 0 A digit, shows up as a zero if it is zero.
44  // # A digit, suppressed if zero.
45  // . Placeholder for the decimal separator.
46  // , Placeholder for the grouping separator.
47  // E Separates mantissa and exponent for exponential formats.
48  // ; Separates formats.
49  // - Default negative prefix.
50  // % Multiply by 100 and show as percentage.
51  // X Any other character can be used in the prefix or suffix.
52  // ' Used to quote special characters in a prefix or suffix.
53 
54  // These are the colors supported in the negative sub-pattern.
55  // The numeric value corresponds to the output value returned by methods on IDSSTextConvertor which return a color value. These values correspond to RGB values.
56  // VB and possibly other programming environments recognize these values.
57  // Color String Numeric Value
58  // Black [BLACK] 0x0
59  // Red [RED] 0xFF
60  // Green [GREEN] 0xFF00
61  // Yellow [YELLOW] 0xFFFF
62  // Blue [BLUE] 0xFF0000
63  // Magenta [MAGENTA] 0xFF00FF
64  // Cyan [CYAN] 0xFFFF00
65  // White [WHITE] 0xFFFFFF
66 
67  // convert double value to a string
68  // if ipcFormat is NULL, use the default format
69  // throws NumberFormatException if formatting fails
70  virtual MBase::ReturnWString DoubleToText(double ifNumber, const WCHAR* ipcFormat, LCID inLocale = 0, Int32* opColor = NULL) = 0;
71 
72 
73 
74  // virtual destructor is needed. cannot be protect.
75  virtual ~NumberFormat()
76  {
77  };
78 
79  virtual WCHAR* DoubleToText2(double ifNumber, const WCHAR* ipcFormat, LCID inLocale = 0, Int32* opColor = NULL) = 0;
80  };
81 }
82 
83 #endif // MFormat_NumberFormat_h
wchar_t WCHAR
Definition: PDCwchar.h:23
Definition: BigDecimalFormat.h:21
Definition: NumberFormat.h:32
Definition: NumberFormat.h:22
Definition: NumberFormat.h:28
virtual MBase::ReturnWString DoubleToText(double ifNumber, const WCHAR *ipcFormat, LCID inLocale=0, Int32 *opColor=NULL)=0
Definition: NumberFormat.h:23
virtual ~NumberFormat()
Definition: NumberFormat.h:75
Definition: ReturnString.h:85
Definition: NumberFormat.h:25
DWORD LCID
Definition: PDCwtypes.h:294
#define Int32
Definition: BasicTypes.h:20
Definition: NumberFormat.h:26
Definition: NumberFormat.h:29
virtual WCHAR * DoubleToText2(double ifNumber, const WCHAR *ipcFormat, LCID inLocale=0, Int32 *opColor=NULL)=0
Definition: NumberFormat.h:27
Definition: NumberFormat.h:21
COLOR
Definition: NumberFormat.h:19
#define NULL
Definition: Null.h:10
Definition: NumberFormat.h:24