Support classes
Home Up

 

TFileStatus structure

Header File
    <owl/file.h>

struct TFileStatus {
    TTime createTime;
    TTime modifyTime;
    TTime accessTime;
    long size;
    uint attribute;
    TCHAR fullName[_MAX_PATH];
};

Description
    Structure to hold file status info

ostream _OWLFAR & operator << (ostream _OWLFAR&, const TFileStatus _OWLFAR&);
    Inserter: For using in diagnostic messages.

TByteOrderType enum

Header File
    <owl/file.h>

enum TByteOrderType {
    boLittle_Endian, /* LSB at lowest address: Intel */
    boBig_Endian, /* MSB at lowest address: Motorola */
};

Description
    Describes machine type of binary data to store.

TVarType enum

Header File
    <owl/file.h>

enum TVarType{
    varEnd,
    varPOINTER,
    varCHAR,
    varUCHAR,
    varSHORT,
    varLONG,
    varINT8,
    varINT16,
    varINT32,
    varUSHORT,
    varULONG,
    varUINT8,
    varUINT16,
    varUINT32,
    varFLOAT,
    varDOUBLE,
    varINT64,
    varUINT64,
    varLastMember,
};

    Description
       These identify host program variable types and let the binary I/O package read and write routines know how to store or retrieve bytes from host buffer arrays and when to sign-extend.

TBinField struct

Header File
    <owl/file.h>

struct TBinField {
    TVarType     Type;         /* Declared type of struct field*/
    int                 Bytes;        /* # of bytes occupied in file    */
    int                 Count;      /* # of repeatitions of this item*/
};

    Description
        The TBinField struct describes a group of like-typed fields in a structure to be read or written using the binary I/O struct calls.

Function EndianType()

Header File
    <owl/file.h>
    Syntax
       inline TByteOrderType EndianType();
    Description
        Return Byte order for current machine.

Macros

#define TFILE_ERROR uint32(-1)
#define FileNull 0
#if defined(BI_PLAT_WIN32)
#define TFILE64_ERROR uint64(0xFFFFFFFF)
#endif

TBufferedFile class

Header File
    <owl/file.h>

Description
    The TBufferedFile class encapsulates the buffered input/output.

Base class:
    TFile

Enumerators
    enum { DefaultBufferSize = 1024};

Constructors
    TBufferedFile::TBufferedFile
        Form 1
            TBufferedFile();    
        Form 2
            TBufferedFile(TFHandle& handle, bool shouldClose);
        Form 3
            TBufferedFile(LPCTSTR name, const uint32 mode = ReadOnly|PermReadWrite|OpenExisting);
    Description
        Form 1: Creates a TFile object with a file handle of FileNull.
        Form 2: Creates a TFile object with a file handle of handle.
        Form 3: Creates a TFile object and opens file name with the given attributes. The file is created if it does not exist.
Destructor
    virtual ~TBufferedFile();

Member Functions
Close()
    Syntax
        bool Close();
    Description
        Closes file stream, flushes all buffers.
#if defined(BI_PLAT_WIN32)
Length
    Syntax
        virtual bool       Length(int64 newLen);
    Description
Resizes file to newLen
Position64
    Syntax
        virtual int64      Position64()   const;
    Description
        Returns the current position of the file pointer. Returns -1 to indicate an error.
Length64

    Syntax
        virtual uint64     Length64() const;
    Description
Returns the file length
#endif
Position
    Syntax
        virtual uint32      Position() const;
    Description
        Returns the current position of the file pointer. Returns -1 to indicate an error.
Length

    Form 1
        virtual uint32     Length() const;
    Form 2
        virtual bool         Length(long newLen);
    Description
        Form 1: Returns the file length.
        Form 2: Resizes file to newLen.

Seek
    Form 1
        uint32 Seek( long offset, seek_dir origin = beg );
    Form 2
        uint64  Seek(int64 offset, seek_dir origin = beg);
    Description
        Repositions the file pointer to offset bytes from the specified origin, second form valid only for Win32..
Read
    Syntax
        uint32     Read( void *buffer, uint32 numBytes );
    Description
        Reads numBytes from the file into buffer.
Write

    Syntax
        bool         Write(const void* buffer, uint32 numBytes);
    Description
        Writes numBytes to the buffer file buffer.
Flush

    Syntax
        bool         Flush();
    Description
        Flushes buffer.
SetBuffer

    Syntax
        void          SetBuffer(uint8* buffer, uint size, TAutoDelete = AutoDelete);
    Description
        Set new buffer, if buffer == 0, allocate memory

TTextFile class

Header File
    <owl/file.h>

Description
    The TTextFile class encapsulates standard text file.

Base class:
    TBufferedFile

Constructors
TTextFile::TTextFile
    Form 1
        TTextFile();
    Form 2
        TTextFile(TFHandle& handle, bool shouldClose);
    Form 3
        TTextFile(LPCTSTR name, const uint32 mode = ReadOnly|PermReadWrite|OpenExisting|Text);
        Description
            Form 1: Creates a TFile object with a file handle of FileNull.
            Form 2: Creates a TFile object with a file handle of handle.
            Form 3: Creates a TFile object and opens file name with the given attributes. The file is created if it does not exist.
Member Functions
GetString
    Syntax
        LPTSTR  GetString(LPSTR buffer, uint32 size);
    Description
Get line maximum length size, from text file.
WriteString
    Syntax
        bool  WriteString(LPSTR buffer);
    Description
Write string to the file;

TRegexp class

Header File
    <owl/regexp.h>

Description
    This class represents regular expressions. TRegexp is a support class used by the string class for string searches.
    Regular expressions use these special characters:
        .     [    ]    -    ^     *    ?    +    $

General Rules:
    Characters other than the special characters match themselves. For example "yardbird" matches "yardbird". A backslash (\) followed by a special character, matches the special character itself. For example "Pardon\?" matches "Pardon?". The following escape codes can be used to match control characters:

\b   backspace
\e   Esc
\f   formfeed
\n   newline
\r   carriage return
\t   tab
\xddd   the literal hex number 0xddd
\^x   where x matches some control-code (for example \^c, \^c)

One-Character Regular Expressions:
    The . special character matches any single character except a newline character. For example ".ive" would match "jive" or "five".
    The [ and ] special characters are used to denote one-character regular expressions that will match any of the characters within the brackets. For example,  "[aeiou]" would match either "a", "e", "i", "o", or "u".
    The - special character is used within the [ ] special characters to denote a range of characters to match. For example, "[ a-z ]" would match on any lowercase alphabetic character between a and z.

The ^ special character is used to specify search for any character but those specified. For example, "[ ^g-v ]" would match on any lowercase alphabetic character NOT between g and v.

Multiple-Character Regular Expressions:
    The * special character following a one-character regular expression matches zero or more occurrences of that regular expression. For example, "[ a-z ]*" matches zero or more occurrences of lowercase alphabetic characters.
    The + special character following a one-character regular expression matches one or more occurrences of that regular expression. For example, "[ 0-9 ]+" matches one or more occurrences of lowercase alphabetic characters.

The ? special character specifies that the following character is optional. For example "xy?z" matches on "xy" or "xyz".
Regular expressions can be concatentated. For example, "[ A-Z ][ a-z ]*" matches capitalized words.

Matching at the Beginning and End of a Line
    If the ^ special character is at the beginning of a regular expression, then a match occurs only if the string is at the beginning of a line. For example, "^[ A-Z ][ a-z ]*" matches capitalized words at the beginning of a line.
    If the $ special character is at the end of a regular expression, the then a match occurs only if the string is at the end of a line. For example, "[ A-Z ][ a-z ]*$" matches capitalized words at the end of a line.

Type Definitions:

StatVal
    Syntax:
        enum StatVal{OK=0, ILLEGAL, TOOLONG};
    Description
        StatVal enumerates the status conditions returned by TRegexp::status, where:

   Status   Description
OK   Means the given regular expression is legal
ILLEGAL   Means the pattern was illegal
TOOLONG   Means the pattern exceeded maximum length (128)


Public Constructors
    Form1:
        TRegexp(const char far* cp);
    Form2:
        TRegexp(const TRegexp far& r);

    Description:
        Form 1: Constructs a regular expression object using the pattern given pointed to by cp.
        Form 2: Constructs a copy of regular expression object r.

Public Member Functions

    find
        Syntax:
            size_t find(const string& s, size_t* len, size_t start=0)

        Description:
            Finds the first instance in string s that matches this regular expression. The search begins at index start, and len returns the length of the matching string if found.
            The return value contains the index of the the beginning of the matching string. If no match is found, len is 0, and -1 is returned.   

    status
        Syntax
            StatVal status()
        Description
            Returns the status of this regular expression. Status values are:

Status   Description
OK   means the given regular expression is legal
ILLEGAL   means the pattern was illegal
TOOLONG   means the pattern exceeded maximum length (128)

Operators

    =
        Form 1
            TRegexp& operator=(const TRegexp& r)
        Form 2
            TRegexp& operator=(const char* cp)

        Description
            Form 1: Sets this regular expression to a copy of r, using value semantics.
            Form 2: Sets this regular expression to the pattern given by cp.

TColor class   

Header File
    <owl/color.h>

Description:
    TColor is a support class used in conjunction with the classes TPalette, TPaletteEntry, TRgbQuad, and TRgbTriple to simplify all color operations. TColor has ten static data members representing the standard RGB COLORREF values, from Black to White. Constructors are provided to create TColor objects from COLORREF and RGB values, palette indexes, palette entries, and RGBQUAD and RGBTRIPLE values.
See the entries for NBits and NColors for a description of TColor-related functions.

Public Data Members

Black
    Syntax
        static const TColor Black;
    Description
        The static TColor object with fixed Value set by RGB(0, 0, 0).
Gray
    Syntax:
        static const TColor Gray;
    Description
        Contains the static TColor object with fixed Value set by RGB(128, 128, 128).
LtBlue
    Syntax
        static const TColor LtBlue;
    Description
        Contains the static TColor object with the fixed Value set by RGB(0, 0, 255).
LtCyan
    Syntax
        static const TColor LtCyan;
    Description
        Contains the static TColor object with the fixed Value set by RGB(0, 255, 255).
LtGray
    Syntax
        static const TColor LtGray;
    Description
        Contains the static TColor object with the fixed Value set by RGB(192, 192, 192).
LtGreen
    Syntax
        static const TColor LtGreen;
    Description
        Contains the static TColor object with the fixed Value set by RGB(0, 255, 0).
LtMagenta
    Syntax
        static const TColor LtMagenta;
    Description
        Contains the static TColor object with the fixed Value set by RGB(255, 0, 255).
LtRed
    Syntax
        static const TColor LtRed;
    Description
        Contains the static TColor object with the fixed Value set by RGB(255, 0, 0).
LtYellow
    Syntax
        static const TColor LtYellow;
    Description
        Contains the static TColor object with the fixed Value set by RGB(255, 255, 0).
None
    Syntax
        static const TColor None;
    Description
        These are special marker colors, using flag bit pattern. Value is never really used. Value must not change for streaming compatibility with OWL's TWindow.
Sys3dDkShadow
    Syntax
        static const TColor Sys3dDkShadow;
    Description
        For Windows 95 only. The symbolic system color value for dark shadow regions of 3-dimensional display elements. Performs GetSysColor() on conversion to COLORREF.
Sys3dFace
    Syntax
        static const TColor Sys3dFace;
    Description
        For Windows 95 only. The symbolic system color value for the face color of 3-dimensional display elements. Performs GetSysColor() on conversion to COLORREF.
Sys3dHilight
    Syntax
        static const TColor Sys3dHilight;
    Description
        For Windows 95 only. The symbolic system color value for highlighted 3-dimensional display elements (for edges facing the light source). Performs GetSysColor() on conversion to COLORREF.
Sys3dLight
    Syntax
        static const TColor Sys3dLight;
    Description
        For Windows 95 only. The symbolic system color value for the light color for 3-dimensional display elements (for edges facing the light source). Performs GetSysColor() on conversion to COLORREF.
Sys3dShadow
    Syntax
        static const TColor Sys3dShadow;
    Description
        For Windows 95 only. The symbolic system color value for the shadow regions of 3-dimensional display elements (for edges facing away from the light source). Performs GetSysColor() on conversion to COLORREF.
SysActiveBorder
    Syntax
        static const TColor SysActiveBorder;
    Description
        The symbolic system color value for the borders of the active window. Performs GetSysColor() on conversion to COLORREF.
SysActiveCaption
    Syntax
        static const TColor SysActiveCaption;
    Description
        The symbolic system color value for the caption of the active window. Performs GetSysColor() on conversion to COLORREF.
SysAppWorkspace
    Syntax
        static const TColor SysAppWorkspace;
    Description
        The symbolic system color value for the background of multiple document interface (MDI) applications. Performs GetSysColor() on conversion to COLORREF.
SysBtnText
    Syntax
        static const TColor SysBtnText;
    Description
        The symbolic system color value for the text on buttons. Performs GetSysColor() on conversion to COLORREF.
SysCaptionText
    Syntax
        static const TColor SysCaptionText;
    Description
        The symbolic system color value for text in captions and size boxes, and for the arrow boxes on scroll bars. Performs GetSysColor() on conversion to COLORREF.
SysDesktop
    Syntax
        static const TColor SysDesktop;
    Description
        The symbolic system color value for the desktop. Performs GetSysColor() on conversion to COLORREF.
SysGrayText
    Syntax
        static const TColor SysGrayText;
    Description
        The symbolic system color value for grayed (disabled) text. Performs GetSysColor() on conversion to COLORREF.
        This color is set to 0 if the current display driver does not support a solid gray color.
SysHighlight
    Syntax
        static const TColor SysHighlight;
    Description
        The symbolic system color value for items selected in a control. Performs GetSysColor() on conversion to COLORREF.
SysHighlightText
    Syntax
        static const TColor SysHighlightText;
    Description
        The symbolic system color value for text selected in a control. Performs GetSysColor() on conversion to COLORREF.
SysInactiveBorder
    Syntax
        static const TColor SysInactiveBorder;
    Description
        The symbolic system color value for the borders of every inactive window. Performs GetSysColor() on conversion to COLORREF.
SysInactiveCaption
    Syntax
        static const TColor SysInactiveCaption;
    Description
        The symbolic system color value for the caption background of every inactive window. Performs GetSysColor() on conversion to COLORREF.
SysInactiveCaptionText
    Syntax
        static const TColor SysInactiveCaptionText;
    Description
        The symbolic system color value for the caption text of every inactive window. Performs GetSysColor() on conversion to COLORREF.
SysInfoBk
    Syntax
        static const TColor SysInfoBk;
    Description
        For Windows 95 only. The symbolic system color value for the background of tooltip controls. Performs GetSysColor() on conversion to COLORREF.
SysInfoText
    Syntax
        static const TColor SysInfoText;
    Description
        For Windows 95 only. The symbolic system color value for text shown on tooltip controls. Performs GetSysColor() on conversion to COLORREF.
SysMenu
    Syntax
        static const TColor SysMenu;
    Description
        The symbolic system color value for the background of menus. Performs GetSysColor() on conversion to COLORREF.
SysMenuText
    Syntax
        static const TColor SysMenuText;
    Description
        The symbolic system color value for the text shown on menus. Performs GetSysColor() on conversion to COLORREF.
SysScrollbar
    Syntax
        static const TColor SysScrollbar;
    Description
        The symbolic system color value for what is usually the gray area of scrollbars. This is the region that the scrollbar slider slides upon. Performs GetSysColor() on conversion to COLORREF.
SysWindow
    Syntax
        static const TColor SysWindow;
    Description
        The symbolic system color value for the background of each window. Performs GetSysColor() on conversion to COLORREF.
SysWindowFrame
    Syntax
        static const TColor SysWindowFrame;
    Description
        The symbolic system color value for the frame around each window. The frame is not the same as the border. Performs GetSysColor() on conversion to COLORREF.
SysWindowText
    Syntax
        static const TColor SysWindowText;
    Description
        The symbolic system color value for text in every window. Performs GetSysColor() on conversion to COLORREF.
Transparent
    Syntax
        static const TColor Transparent;
    Description
        Non-painting marker color using the flag bit pattern. This value is never really used. This value must not change, for streaming compatibility with OWL's TWindow.
White
    Syntax
        static const TColor White;
    Description
        Contains the static TColor object with the fixed Value set by RGB(255, 255, 255).

Public Constructors

TColor::TColor
    Syntax 1
        TColor();
    Description
        The default constructor sets Value to 0.

    Syntax 2
        TColor(COLORREF value);
    Description
        Creates a TColor object with Value set to the given value.

    Syntax 3
        TColor(long value);
        TColor(long value) : Value((COLORREF)value) {}
    Description
        Creates a TColor object with Value set to (COLORREF)value.

    Syntax 4
        TColor(int r, int g, int b);
    Description
        Creates a TColor object with Value set to RGB(r,g,b).
   
    Syntax 5
        TColor(int r, int g, int b, int f);
    Description
        Creates a TColor object with Value set to RGB(r,g,b) with the flag byte formed from f.

    Syntax 6
        TColor(int index);
    Description
        Creates a TColor object with Value set to PALETTEINDEX(index).

    Syntax 7
        TColor(const PALETTEENTRY far& pe);
    Description
        Creates a TColor object with Value set to: RGB(pe.peRed, pe.peGreen, pe.peBlue)

    Syntax 8
        TColor(const RGBQUAD far& q);
    Description
        Creates a TColor object with Value set to: RGB(q.rgbRed, q.rgbGreen, q.rgbBlue)

    Syntax 9
        TColor(const RGBTRIPLE far& t);
    Description
        Creates a TColor object with Value set to: RGB(t.rgbtRed, t.rgbtGreen, t.rgbtBlue)

Public Member Functions


Blue
    Syntax
        uint8 Blue() const;
    Description
        Returns the blue component of this color's Value.
Flags
    Syntax
        uint8 Flags() const;
    Description
        Returns the peFlags value of this object's Value.
GetValue
    Syntax
        COLORREF GetValue() const;
    Description
        Gets a 32bit COLORREF type from this color object. Performs a GetSysColor() lookup if the object represents a symbolic sys-color index.
GetSysColor
    Syntax
        static TColor GetSysColor(int uiElement);
    Description
        (Presentation Manager only) Returns the color of the given uiElement.
Green
    Syntax
        uint8 Green() const;
    Description
        Returns the green component of this color's Value.
Index
    Syntax
        int Index() const;
    Description
        Returns the index value corresponding to this color's Value by masking out the two upper bytes. Used when color is a palette index value.
IsSysColor
    Syntax
        bool IsSysColor() const;
    Description
        Returns true if the color is a system color, false otherwise.
operator ==
    This function compares between two binary representation of colors; it does not compare colors logically. For example, if palette entry 4 is solid red (rgb components (255, 0, 0)), the following will return false:
    if (TColor(4) == TColor(255, 0, 0))

    Syntax 1
        bool operator ==(const TColor& other) const;
    Description
        Returns true if two colors are equal.
    Syntax 2
        bool operator ==(COLORREF cr) const;
    Description
        Returns true if this color matches a COLORREF.
operator COLORREF
    Syntax
        operator COLORREF() const;
    Description
        Type-conversion operator that returns Value.
operator =
    Syntax
        TColor& operator =(const TColor& src);
    Description
        Sets the value of color after it has been initialized.
operator !=
    This function compares between two binary representation of colors; it does not compare colors logically.
    Syntax 1
        bool operator !=(const TColor& other) const;
    Description
        Returns true if two colors are not equal.
    Syntax 2
        bool operator !=(COLORREF cr) const;
    Description
        Returns true if this color does not match a COLORREF.
PalIndex
    Syntax
        TColor PalIndex() const;
    Description
        Returns the palette index corresponding to this color's Value. The returned color has the high-order byte set to 1.
PalRelative
    Syntax
        TColor PalRelative() const;
    Description
        Returns the palette-relative RGB corresponding to this color's Value. The returned color has the high-order byte set to 2.
Red
    Syntax
        uint8 Red() const;
    Description
        Returns the red component of this color's Value.
Rgb
    Syntax
        TColor Rgb() const;
    Description
        Returns the explicit RGB color corresponding to this color's Value by masking out the high-order byte.
SetSysColors
    Syntax
        static bool SetSysColors(unsigned nelems, const int uiElementIndices[], const TColor colors[]);
    Description
        (Presentation Manager only) Sets groups of UI element colors. nelems indicates the number of element colors to change and the size of the array parameters, uiElementIndices indicates which elements to change, and colors indicates what color to change the corresponding element to. Returns true if successful.
SetValue
    Syntax
        void SetValue(const COLORREF& value);
    Description
        Changes the color after it has been initialized.

Private Data Members
   Value
    Syntax
        COLORREF Value;
    Description
        The color value of this TColor object. Value can have three different forms, depending on the application:
        Explicit values for RGB (red, green, blue)
            An index into a logical color palette
            A palette-relative RGB value.

TDropInfo class

Header File
    <owl/wsyscls.h>

Description
TDropInfo is a simple class that supports file-name drag and drop operations using the WM_DROPFILES message. Each TDropInfo object has a private handle to the HDROP structure returned by the WM_DOPFILES message.

Public Constructors

TDropInfo::TDropInfo
    Syntax
        TDropInfo(HDROP handle);
    Description
        Creates a TDropInfo object with Handle set to the given handle.

Public Member Functions

DragFinish
    Syntax
        void DragFinish();
    Description
        Releases any memory allocated for the transferring of this TDropInfo object's files during drag operations.
DragQueryFile
    Syntax
        uint DragQueryFile(uint index, char far* name, uint nameLen);
    Description
        Retrieves the name of the file and related information for this i object. If index is set to -1 (0xFFFF), DragQueryFile returns the number of dropped files. This is equivalent to calling DragQueryFileCount.
        If index lies between 0 and the total number of dropped files for this object, DragQueryFile copies to the name buffer  (of length nameLen bytes) the name of the dropped file that corresponds to index, and returns the number of bytes actually copied.
        If name is 0, DragQueryFile returns the required buffer size (in bytes) for the given index. This is equivalent to calling DragQueryFileNameLen.
DragQueryFileCount
    Syntax
        uint DragQueryFileCount();
    Description
        Returns the number of dropped files in this TDropInfo object. This call is equivalent to calling DragQueryFile(-1, 0, 0).
DragQueryFileNameLen
    Syntax
        uint DragQueryFileNameLen(uint index);
    Description
        Returns the length of the name of the file in this TDropInfo object corresponding to the given index. This call is equivalent to calling DragQueryFile(index, 0, 0).
DragQueryPoint
    Syntax
        bool DragQueryPoint(TPoint& point);
    Description
        Retrieves the mouse pointer position when this object's files are dropped and copies the coordinates to the given point object. point refers to the window that received the WM_DROPFILES message. DragQueryPoint returns true if the drop occurs inside the window's client area, otherwise false.
operator HDROP()
    Syntax
        operator HDROP();
    Description
        Typecasting operator that returns Handle.

TFileDroplet class

Header File
    <owl/wsyscls.h>

Description
    TFileDroplet encapsulates information about a single dropped file, its name, where it was dropped, and whether or not it was in the client area.

Public Constructors

TFileDroplet::TFileDroplet
    Syntax 1
        TFileDroplet(const char* fileName, TPoint& p, bool inClient);
    Description
        Supports drag and drop.
    Syntax 2
        TFileDroplet(TDropInfo& drop, int i);
    Description
        Constructs a TFileDroplet given a DropInfo and a file index. The location is relative to the client coordinates, and will have negative values if dropped in the non-client parts of the window. DragQueryPoint copies that point where the file was dropped and returns whether or not the point is in the client area. Regardless of whether or not the file is dropped in the client or non-client area of the window, you will still receive the file name.

Destructor
~TFileDroplet();
    Description
    The destructor for this class.

Public Member Functions

GetInClientArea
    Syntax
        bool GetInClientArea() const;
    Description
        Returns true if the drop occurred in the client area.
GetName
    Syntax
        const char* GetName() const;
    Description
        Returns the name of the file dropped.
GetPoint
    Syntax
        TPoint GetPoint() const;
    Description
        Returns the cursor position at which the file was dropped.
operator ==
    Syntax
        operator ==(const TFileDroplet& other) const;
    Description
        Returns true if the address of this object is equal to the address of the compared object.

TLangId typedef

Header File
    <owl/clstrng.h>

    Syntax
        typedef unsigned short TLangId;
    Description
        Holds a language ID, a predefined number that represents a base language and dialect. For example, the number 409 represents American English. TLocaleString uses the language ID to find the correct translation for strings.

TLocaleString Struct

Header File
    <owl/lclstrng.h>

Description
    Designed to provide support for localized registration parameters, the TLocaleString Struct defines a localizable substitute for char* strings. These strings, which describe both OLE and non-OLE enabled objects to the user, are available in whatever language the user needs. This Struct supports ObjectWindows' Doc/View as well as ObjectComponents' OLE-enabled applications. The public member functions, which supply information about the user's language, the native language, and a description of the string marked for localization, simplify the process of translating and comparing strings in a given language.

    To localize the string resource, TLocaleString uses several user-entered prefixes to determine what kind of string to translate. Each prefix must be followed by a valid resource identifier (a standard C identifier).The following table lists the prefixes TLocaleString uses to localize strings. Each prefix is followed by a sample entry.

Prefix   Description
@ TXY   The string is a series of characters interpreted as a resource ID and is accessed only from a resource file. It is never used directly.
# 1045   The string is a series of digits interpreted as a resource ID and is accessed from a resource file. It is never used directly.
! MyWindow   The string is translated if it is not in the native language; otherwise, this string is used directly.

See the section on localizing symbol names in the ObjectWindows Programmer's Guide for more information about localizing strings.

Public Member Functions

Compare
    Syntax
        int Compare(const char far* str, TLangId lang);
    Description
        Using the specified language (lang), Compare compares TLocaleString with another string. It uses the standard string compare and the language-specific collation scheme. It returns one of the following values.

   Return value Meaning
   0   There is no match between the two strings.
   1   This string is greater than the other string.
   -1   This string is less than the other string.

CompareLang
    Syntax
        static int CompareLang(const char far* s1, const char far* s2, TLangId);
    Description
        This function may be re-implemented with enhanced NLS support in another module. Note: That module must be linked in before the library, to override this default implementation.
GetSystemLangId
    Syntax
        static TLangId GetSystemLangId();
    Description
        Returns the system language ID, which can be the same as the UserLangId.
GetUserLangId
    Syntax
        static TLangId GetUserLangId();
    Description
        Returns the user language ID. For single user systems, this is the same as LangSysDefault. The language ID is a predefined number that represents a base language and dialect.
IsNativeLangId
    Syntax
        static int IsNativelangId(TLangId lang);
    Description
        Returns true if lang equals the native system language.
operator =
    Syntax
        void operator = (const char* str);
    Description
        Assigns the string (str) to this locale string.
operator const char*()
    Syntax
        operator const char* ();
    Description
        Returns the current character string in the translation.
Translate
    Syntax
        const char* Translate(TLangId lang);
    Description
        Translates the string to the given language. Translate follows this order of preference in order to choose a language for translation:
            1.     Base language and dialect.
            2.     Base language and no dialect.
            3.     Base language and another dialect.
            4.     The native language of the resource itself.
            5.     Returns 0 if unable to translate the string. (This can happen only if an @ or # prefix is used; otherwise, the ! prefix indicates that the string following is the native language itself.)

Public Data Members

Module
    Syntax
        static HINSTANCE Module;
    Description
        The handle of the file containing the resource.
NativeLangId
    Syntax
        static TLangId NativeLangId;
    Description
        The base language ID of non-localized strings.
Null
    Syntax
        static TLocaleString Null;
    Description
        A null string.
Private
    Syntax
        const char* Private;
    Description
        A string pointer used internally.
SystemDefaultLangId
    Syntax
        static TLangId SystemDefaultLangId;
    Description
        The default language identifier.
UserDefaultLangId
    Syntax
        static TLangId UserDefaultLangId;
    Description
        The user-defined default language identifier.

 


Copyright © 1998-2001 Yura Bidus. All rights reserved.