PrevNextUpHome BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1

24.2. Primitive Type

24.2.1. Bool Type

Definition

#undef          bool
#define         bool                boolean

SFMTYPEDEFALIAS(bool, Bool)

#undef          true
#define         true                (TRUE)
#undef          false
#define         false               (FALSE)

Related Information : SFMTYPEDEFALIAS

Example

if (SFXAscii::IsDigit(ch) == true) { ... }   // wrong usage
if (SFXAscii::IsDigit(ch)) { ... }           // correct usage
[Note] Note
The function with return value of Bool type dose not necessarily return "1" as logical true value. Like C language, the values other than 0 are considered as logical true value in SophiaFramework.
Bool MyFunction(SIntN flag) {
    return (flag & 0x4000);   // wrong usage
}
[Note] Note

In SophiaFramework, Bool type dose not necessarily equal int type although the logical value is of int type in C language.

If Bool type is defined as unsigned char type, the return value is always false (=0).

Bool MyFunction(int flag) {
    return (flag & 0x4000 != 0);   // correct usage
}
        
// or
        
Bool MyFunction(int flag) {
    return !!(flag & 0x4000);      // correct usage
}

24.2.2. Void Type

Definition

typedef     void                     Void, *VoidPtr, **VoidHandle;
typedef     void volatile            VoidVolatile, *VoidVolatilePtr, **VoidVolatileHandle;
typedef     void const               VoidConst, *VoidConstPtr, **VoidConstHandle;
typedef     void volatile const      VoidVolatileConst, *VoidVolatileConstPtr, **VoidVolatileConstHandle;
SFMTYPEDEFPACK(VoidPtr)
SFMTYPEDEFPACK(VoidHandle)

24.2.3. Generic Pointer Type and Generic Handle Type

Definition

typedef     char                                &Ref, *Ptr, **Handle;
typedef     char volatile                       &VolatileRef, *VolatilePtr, **VolatileHandle;
typedef     char const                          &ConstRef, *ConstPtr, **ConstHandle;
typedef     char volatile const                 &VolatileConstRef, *VolatileConstPtr, **VolatileConstHandle;
SFMTYPEDEFPACK(Ptr)
SFMTYPEDEFPACK(Handle)

24.2.4. Integer Type

Definition

// signed integer
SFMTYPEDEFALIAS(signed int, SIntN)

// unsigned integer
SFMTYPEDEFALIAS(unsigned int, UIntN)

// 8-bit signed integer
SFMTYPEDEFALIAS(signed char, SInt08)

// 8-bit unsigned integer
SFMTYPEDEFALIAS(unsigned char, UInt08)

// 16-bit signed integer
SFMTYPEDEFALIAS(signed short, SInt16)

// 16-bit unsigned integer
SFMTYPEDEFALIAS(unsigned short, UInt16)

// 32-bit signed integer
SFMTYPEDEFALIAS(signed long, SInt32)

// 32-bit unsigned integer
SFMTYPEDEFALIAS(unsigned long, UInt32)

// 64-bit signed integer
#if defined TARGET_COMPILER_MSVCPP
SFMTYPEDEFALIAS(signed __int64, SInt64)
#else
SFMTYPEDEFALIAS(signed long long, SInt64)
#endif

// 64-bit unsigned integer
#if defined TARGET_COMPILER_MSVCPP
SFMTYPEDEFALIAS(unsigned __int64, UInt64)
#else
SFMTYPEDEFALIAS(unsigned long long, UInt64)
#endif

24.2.5. Floating Point Type

Definition

SFMTYPEDEFALIAS(float, Float32)
SFMTYPEDEFALIAS(double, Float64)
[Note] Note
Since the C/C++ floating point arithmetic operations can be used in SophiaFramework, the BREW helper functions are unnecessary.
[Caution] Using floating point arithmetic operations

The application size increases depending on the kinds of floating point arithmetic operations used, since linked with the floating point libraries.

Example

Float64 num1(255);
Float64 num2(123.5);
Float64 num3;

num3 = (num1 + num2) / (num1 - num3);

if (num3 < num1) {
      ...
}
[Note] Note

Trigonometric, exponential, and logarithmic functions not included in the BREW API are available.

The SFXTrigonometric class for fast trigonometric operations can be also used.

Detailed Information: Mathematical functions of RealView Compilation Tools for BREW V1.2

24.2.6. Byte Type

Definition

SFMTYPEDEFALIAS(UInt08, Byte)

24.2.7. Character Type

Definition

SFMTYPEDEFALIAS(char, AChar)
SFMTYPEDEFALIAS(AECHAR, WChar)
[Note] AChar and WChar

AChar is the type for the ANSI character (multi byte character).

WChar is the type for the BREW wide character.