Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

message.h

Go to the documentation of this file.
00001 #ifndef __msn_message_h__
00002 #define __msn_message_h__
00003 
00004 /*
00005  * message.h
00006  * libmsn
00007  *
00008  * Created by Mark Rowe on Wed Mar 17 2004.
00009  * Copyright (c) 2004 Mark Rowe. All rights reserved.
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  */
00025 
00026 #include <string>
00027 #include <msn/sstream_fix.h>
00028 #include <map>
00029 #include <vector>
00030 #include <stdexcept>
00031 
00032 namespace MSN 
00033 {
00034     
00041     class Message
00042     {
00043 public:
00044         enum FontEffects
00045         {
00046             BOLD_FONT = 1,
00047             ITALIC_FONT = 2,
00048             UNDERLINE_FONT = 4,
00049             STRIKETHROUGH_FONT = 8
00050         };
00051         
00052         enum CharacterSet
00053         {
00054             ANSI_CHARSET = 0x00,
00055             DEFAULT_CHARSET = 0x01,
00056             SYMBOL_CHARSET = 0x02,
00057             MAC_CHARSET = 0x4d,
00058             SHIFTJIS_CHARSET = 0x80,
00059             HANGEUL_CHARSET = 0x81,
00060             JOHAB_CHARSET = 0x82,
00061             GB2312_CHARSET = 0x86,
00062             CHINESEBIG5_CHARSET = 0x88,
00063             GREEK_CHARSET = 0xa1,
00064             TURKISH_CHARSET = 0xa2,
00065             VIETNAMESE_CHARSET = 0xa3,
00066             HEBREW_CHARSET = 0xb1,
00067             ARABIC_CHARSET = 0xb2,
00068             BALTIC_CHARSET = 0xba,
00069             RUSSIAN_CHARSET_DEFAULT = 0xcc,
00070             THAI_CHARSET = 0xde,
00071             EASTEUROPE_CHARSET = 0xee,
00072             OEM_DEFAULT = 0xff
00073         };
00074         
00075         enum FontFamily
00076         {
00077             FF_DONTCARE = 0,
00078             FF_ROMAN = 1,
00079             FF_SWISS = 2,
00080             FF_MODERN = 3,
00081             FF_SCRIPT = 4,
00082             FF_DECORATIVE = 5
00083         };
00084         
00085         enum FontPitch
00086         {
00087             DEFAULT_PITCH = 0,
00088             FIXED_PITCH = 1,
00089             VARIABLE_PITCH = 2
00090         };
00091         
00092         class Headers
00093         {
00094 public:
00095             Headers(const std::string & rawContents_) : rawContents(rawContents_) {};
00096             Headers() : rawContents("") {};
00097             std::string asString() const;
00098             std::string operator[](const std::string header) const;
00099             void setHeader(const std::string header, const std::string value);
00100 
00101 private:
00102             std::string rawContents;
00103         };
00104 
00105 private:
00106         std::string body;
00107         Message::Headers header;
00108 
00109 public:
00110             ;
00113         Message(std::string body, std::string mimeHeader="MIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\n\r\n");
00114         
00120         std::string asString() const;
00121         
00126         std::string operator[](const std::string header) const;
00127         void setHeader(const std::string name, const std::string value) { header.setHeader(name, value); };
00128         
00131         const std::string & getBody() const { return body; };
00132         
00137         const std::string getFontName() const;
00138         
00141         void setFontName(const std::string & fontName);
00142         
00145         const std::vector<int> getColor() const;
00146         const std::string getColorAsHTMLString() const;
00147         
00150         void setColor(std::vector<int> color);
00151         void setColor(std::string color);
00152         void setColor(int red, int green, int blue);
00153         
00158         const int getFontEffects() const;
00159         
00164         void setFontEffects(int fontEffects);
00165         
00168         const CharacterSet getFontCharacterSet() const;
00169         
00172         void setFontCharacterSet(CharacterSet cs);
00173         
00176         const FontFamily getFontFamily() const;
00177         
00180         const FontPitch getFontPitch() const;
00181         
00184         void setFontFamilyAndPitch(Message::FontFamily fontFamily, Message::FontPitch fontPitch);
00185         
00188         const bool isRightAligned() const;
00189 
00190 private:
00191             ;
00192         std::map<std::string, std::string> getFormatInfo() const throw (std::runtime_error);
00193         void setFormatInfo(std::map<std::string, std::string> & info);
00194     };
00195     
00196 }
00197 #endif

Generated on Sun Feb 6 19:59:40 2005 for libmsn by  doxygen 1.4.1