]> git.tdb.fi Git - libs/core.git/blob - source/latin1.cpp
Add copyright notices and Id tags
[libs/core.git] / source / latin1.cpp
1 /* $Id$
2
3 This file is part of libmspstrings
4 Copyright © 2006-2007 Mikko Rasa
5 Distributed under the LGPL
6 */
7
8 #include "latin1.h"
9
10 using namespace std;
11
12 namespace Msp {
13
14 void Latin1::Encoder::encode_char(wchar_t c_)
15 {
16         // Win32 has typedef unsigned short wchar_t
17         int c=c_;
18         if(c<0 || c>0xFF)
19                 error("Can't express character in Latin-1");
20         else
21                 append(c);
22 }
23
24 void Latin1::Decoder::decode_char(const string &str, string::const_iterator &i)
25 {
26         if(i==str.end())
27                 return;
28         append(static_cast<unsigned char>(*i++));
29 }
30
31 } // namespace Msp