Annotation of DewFind/LogFile.h, revision 1.1

1.1     ! nick        1: //
        !             2: //   DewGames   Log File Class
        !             3: //
        !             4: //   Date:  10/15/2004
        !             5: //   Purpose: To keep a nice looking log file while a program
        !             6: //            is running. Will be able to see what procedures were accessed
        !             7: //                       when and where.
        !             8: //
        !             9: //   Brendan Lynch
        !            10: //
        !            11: //////////////////////////////////////////////////////////////////////
        !            12: 
        !            13: //#32
        !            14: //*************************************
        !            15: //Programmed by: Brendan Lynch
        !            16: //Email:        dewgames@gmail.com
        !            17: //Website:          www.dewgames.com
        !            18: //*************************************
        !            19: 
        !            20: 
        !            21: #if !defined(AFX_LOGFILE_H__4DCD1963_B624_4D33_AFAA_09210CDE7EE5__INCLUDED_)
        !            22: #define AFX_LOGFILE_H__4DCD1963_B624_4D33_AFAA_09210CDE7EE5__INCLUDED_
        !            23: 
        !            24: #if _MSC_VER > 1000
        !            25: #pragma once
        !            26: #endif // _MSC_VER > 1000
        !            27: 
        !            28: 
        !            29: #include <Windows.h>
        !            30: /*
        !            31: LOGFILE SYNTAX DESCRIPTION:
        !            32: 
        !            33: The log file outputs logging information to an RTF file. C-style file I/O is used because it is
        !            34: slightly faster than iostream. Text passed to the writer may use the following formatting tags:
        !            35: 
        !            36: [<color>]              -   Text after this tag will be colored the specified color.
        !            37: <color> can be: BLACK, WHITE, GREY, RED, GREEN, BLUE, CYAN, YELLOW,
        !            38: MAGENTA, DARK_RED, DARK_GREEN, DARK_BLUE, LIGHT_RED, LIGHT_GREEN,
        !            39: LIGHT_BLUE, ORANGE.
        !            40: 
        !            41: [PLAIN]                 -   Text after this tag will be unformatted
        !            42: 
        !            43: [B], [/B]               -   Text in between these two tags will be bolded
        !            44: 
        !            45: [I], [/I]               -   Text in between these two tags will be italicized
        !            46: 
        !            47: [U], [/U]               -   Text in between these two tags will be underlined
        !            48: 
        !            49: [S], [/S]               -   Text in between these two tags will have a line through it
        !            50: 
        !            51: [SUB], [/SUB]           -   Text in between these two tags will be a subscript
        !            52: 
        !            53: [SUPER], [/SUPER]       -   Text in between these two tags will be a superscript
        !            54: 
        !            55: [LEFT]                  -   Text will be left-justified (this is the default justification)
        !            56: 
        !            57: [RIGHT]                 -   Text will be right-justified
        !            58: 
        !            59: [CENTER]                -   Text will be center-justified
        !            60: 
        !            61: [FULL]                  -   Text will be full-justified
        !            62: 
        !            63: [TITLE], [/TITLE]       -   Text in between these two tags will be size 20
        !            64: 
        !            65: [H], [/H]               -   Text in between these two tags will be size 12
        !            66: 
        !            67: */
        !            68: 
        !            69: enum MESSAGETYPE
        !            70: {
        !            71:        MSG_SUCCESS = 1,
        !            72:        MSG_INFO = 2,
        !            73:        MSG_WARN = 3,
        !            74:        MSG_ERROR = 4,
        !            75: };
        !            76: 
        !            77: enum COLORTABLE
        !            78: {
        !            79:        BLACK = 0,
        !            80:        WHITE = 1,
        !            81:        GREY = 2,
        !            82:        Red = 3,
        !            83:        GREEN = 4,
        !            84:        BLUE = 5,
        !            85:        CYAN = 6,
        !            86:        YELLOW = 7,
        !            87:        MAGENTA = 8,
        !            88:        DARK_RED = 9,
        !            89:        DARK_GREEN = 10,
        !            90:        DARK_BLUE = 11,
        !            91:        LIGHT_RED = 12,
        !            92:        LIGHT_GREEN = 13,
        !            93:        LIGHT_BLUE = 14,
        !            94:        ORANGE = 15,
        !            95: };
        !            96: 
        !            97: 
        !            98: class LogFile  
        !            99: {
        !           100: public:
        !           101:        LogFile();
        !           102:        virtual ~LogFile();
        !           103:        void ToggleStatus(bool onoff); //turns the logger on/off
        !           104:        int Init(const CString sFile);
        !           105:        int Close();
        !           106:        bool GetState();
        !           107:        bool LogString(CString sText);
        !           108:        bool LogMessage(const CString sSource, const CString sMessage, MESSAGETYPE messageType);
        !           109:        bool LogMessage(const CString sSource, CString sMessage, int x,MESSAGETYPE messageType);
        !           110: private:
        !           111:        void WriteString(const CString sText);
        !           112:        CString DoFormatting (CString sText);
        !           113:        bool loaded_;
        !           114:        bool status_; //if true write log, if false dont write log
        !           115:        HANDLE hFile_;
        !           116:        CString fileName_;
        !           117: };
        !           118: 
        !           119: #endif // !defined(AFX_LOGFILE_H__4DCD1963_B624_4D33_AFAA_09210CDE7EE5__INCLUDED_)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>