FONTAINE 1.0
|
00001 // 00002 // The Fontaine Font Analysis Project 00003 // 00004 // Copyright (c) 2009 by Edward H. Trager 00005 // All Rights Reserved 00006 // 00007 // Released under the GNU GPL version 2.0 or later. 00008 // 00009 00011 // 00012 // A version of this file was originally written as part of 00013 // the MADELINE 2 program 00014 // written by Edward H. Trager and Ritu Khanna 00015 // Copyright (c) 2005 by the Regents of the University of Michigan. 00016 // and released under the GNU GPL v. 2.0 or later. 00017 // 00019 // 00020 // 2005.03.14.ET -- Originally written as Warning class 00021 // 2006.12.18.ET -- Reimplemented as Message base class 00022 00023 // 00024 // Message.h 00025 // 00026 00027 00028 #ifndef MESSAGE_INCLUDED 00029 #define MESSAGE_INCLUDED 00030 00031 #include <iostream> 00032 #include <libintl.h> 00033 #include <locale.h> 00034 #include <stdarg.h> 00035 #include "BufferSizes.h" 00036 #include <string> 00037 #include <stdio.h> 00038 00039 // Loader class: 00040 class MessageInitializer; 00041 00042 class Message{ 00043 00044 friend class MessageInitializer; 00045 00046 private: 00047 00048 static const char *_defaultSalutation; 00049 00050 // initialize: 00051 static void _initialize( void ); 00052 00053 protected: 00054 00055 const char *_salutation; 00056 const char *_methodName; 00057 char _message[GENERAL_STRING_BUFFER_SIZE]; 00058 bool _truncated; 00059 00060 public: 00061 00062 // Constructors: 00063 Message(){}; 00064 Message(const char *const methodName, const char *format,...); 00065 00066 // print: 00067 void print(void); 00068 00069 // get: 00070 std::string get(void) const; 00071 }; 00072 00073 // 00074 // MessageInitializer loader class: 00075 // 00076 class MessageInitializer{ 00077 00078 static MessageInitializer messageInitializer; 00079 MessageInitializer(){ 00080 Message::_initialize(); 00081 } 00082 00083 }; 00084 00085 // 00086 // Independent utility method for localization: 00087 // 00088 std::string L(const char *format,...); 00089 00090 #endif 00091