From 056dc68dfc606a2c14126a70321045d6d9f12e0e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 1 Jun 2011 15:53:37 +0300 Subject: [PATCH] Rename namespace Codecs to StringCodec --- source/stringcodec/ascii.cpp | 4 ++-- source/stringcodec/ascii.h | 8 ++++---- source/stringcodec/codec.cpp | 4 ++-- source/stringcodec/codec.h | 8 ++++---- source/stringcodec/codecutils.cpp | 4 ++-- source/stringcodec/codecutils.h | 8 ++++---- source/stringcodec/iso2022jp.cpp | 4 ++-- source/stringcodec/iso2022jp.h | 8 ++++---- source/stringcodec/iso646fi.cpp | 4 ++-- source/stringcodec/iso646fi.h | 8 ++++---- source/stringcodec/iso88591.cpp | 4 ++-- source/stringcodec/iso88591.h | 8 ++++---- source/stringcodec/iso885915.cpp | 4 ++-- source/stringcodec/iso885915.h | 8 ++++---- source/stringcodec/jisx0201.cpp | 4 ++-- source/stringcodec/jisx0201.h | 8 ++++---- source/stringcodec/jisx0208.cpp | 4 ++-- source/stringcodec/jisx0208.h | 8 ++++---- source/stringcodec/utf8.cpp | 4 ++-- source/stringcodec/utf8.h | 8 ++++---- source/stringcodec/windows1252.cpp | 4 ++-- source/stringcodec/windows1252.h | 8 ++++---- transcode.cpp | 12 ++++++------ 23 files changed, 72 insertions(+), 72 deletions(-) diff --git a/source/stringcodec/ascii.cpp b/source/stringcodec/ascii.cpp index cb6281a..84e44fc 100644 --- a/source/stringcodec/ascii.cpp +++ b/source/stringcodec/ascii.cpp @@ -19,7 +19,7 @@ const char *translit_katakana[0x60]= }*/ namespace Msp { -namespace Codecs { +namespace StringCodec { void Ascii::Encoder::encode_char(UnicodeChar ch, string &buf) { @@ -102,5 +102,5 @@ UnicodeChar Ascii::Decoder::decode_char(const string &str, string::const_iterato return *i++; } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/ascii.h b/source/stringcodec/ascii.h index cec099b..91f9031 100644 --- a/source/stringcodec/ascii.h +++ b/source/stringcodec/ascii.h @@ -1,10 +1,10 @@ -#ifndef MSP_STRINGS_ASCII_H_ -#define MSP_STRINGS_ASCII_H_ +#ifndef MSP_STRINGCODEC_ASCII_H_ +#define MSP_STRINGCODEC_ASCII_H_ #include "codec.h" namespace Msp { -namespace Codecs { +namespace StringCodec { class Ascii: public Codec { @@ -33,7 +33,7 @@ public: virtual Decoder *create_decoder(ErrorMode em = THROW_ON_ERROR) const { return new Decoder(em); } }; -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/source/stringcodec/codec.cpp b/source/stringcodec/codec.cpp index a712720..ed54ac9 100644 --- a/source/stringcodec/codec.cpp +++ b/source/stringcodec/codec.cpp @@ -12,7 +12,7 @@ using namespace std; namespace Msp { -namespace Codecs { +namespace StringCodec { bool Codec::detect(const string &str) const { @@ -166,5 +166,5 @@ Codec *detect_codec(const string &str) return new Windows1252; } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/codec.h b/source/stringcodec/codec.h index 5377520..ab2a3ea 100644 --- a/source/stringcodec/codec.h +++ b/source/stringcodec/codec.h @@ -1,11 +1,11 @@ -#ifndef MSP_STRINGS_CODEC_H_ -#define MSP_STRINGS_CODEC_H_ +#ifndef MSP_STRINGCODEC_CODEC_H_ +#define MSP_STRINGCODEC_CODEC_H_ #include #include namespace Msp { -namespace Codecs { +namespace StringCodec { typedef int UnicodeChar; @@ -192,7 +192,7 @@ Codec *create_codec(const std::string &); The codec must be deleted when it's no longer needed. */ Codec *detect_codec(const std::string &); -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/source/stringcodec/codecutils.cpp b/source/stringcodec/codecutils.cpp index b58c399..37d81a7 100644 --- a/source/stringcodec/codecutils.cpp +++ b/source/stringcodec/codecutils.cpp @@ -1,7 +1,7 @@ #include "codecutils.h" namespace Msp { -namespace Codecs { +namespace StringCodec { int transform_mapping_or_direct(const int *mapping, unsigned map_size, int ch, bool reverse) { @@ -16,5 +16,5 @@ int transform_mapping_or_direct(const int *mapping, unsigned map_size, int ch, b return ch; } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/codecutils.h b/source/stringcodec/codecutils.h index c389056..395949e 100644 --- a/source/stringcodec/codecutils.h +++ b/source/stringcodec/codecutils.h @@ -1,12 +1,12 @@ -#ifndef MSP_STRINGS_CODECUTILS_H_ -#define MSP_STRINGS_CODECUTILS_H_ +#ifndef MSP_STRINGCODEC_CODECUTILS_H_ +#define MSP_STRINGCODEC_CODECUTILS_H_ namespace Msp { -namespace Codecs { +namespace StringCodec { int transform_mapping_or_direct(const int *mapping, unsigned map_size, int ch, bool reverse); -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/source/stringcodec/iso2022jp.cpp b/source/stringcodec/iso2022jp.cpp index f0b37fd..564892f 100644 --- a/source/stringcodec/iso2022jp.cpp +++ b/source/stringcodec/iso2022jp.cpp @@ -6,7 +6,7 @@ using namespace std; namespace Msp { -namespace Codecs { +namespace StringCodec { void Iso2022Jp::Encoder::encode_char(UnicodeChar ch, string &buf) { @@ -150,5 +150,5 @@ void Iso2022Jp::Decoder::switch_mode(Mode m) } } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/iso2022jp.h b/source/stringcodec/iso2022jp.h index cfce718..73ffec3 100644 --- a/source/stringcodec/iso2022jp.h +++ b/source/stringcodec/iso2022jp.h @@ -1,10 +1,10 @@ -#ifndef MSP_STRINGS_ISO2022JP_H_ -#define MSP_STRINGS_ISO2022JP_H_ +#ifndef MSP_STRINGCODEC_ISO2022JP_H_ +#define MSP_STRINGCODEC_ISO2022JP_H_ #include "codec.h" namespace Msp { -namespace Codecs { +namespace StringCodec { class Iso2022Jp: public Codec { @@ -53,7 +53,7 @@ public: virtual Decoder *create_decoder(ErrorMode em = THROW_ON_ERROR) const { return new Decoder(em); } }; -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/source/stringcodec/iso646fi.cpp b/source/stringcodec/iso646fi.cpp index 3ccfc9d..b6aa883 100644 --- a/source/stringcodec/iso646fi.cpp +++ b/source/stringcodec/iso646fi.cpp @@ -24,7 +24,7 @@ const int mapping[map_size*2]= namespace Msp { -namespace Codecs { +namespace StringCodec { void Iso646Fi::Encoder::encode_char(UnicodeChar ch, string &buf) { @@ -59,5 +59,5 @@ UnicodeChar Iso646Fi::Decoder::decode_char(const string &str, string::const_iter return result; } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/iso646fi.h b/source/stringcodec/iso646fi.h index 8fc5e83..1767ca8 100644 --- a/source/stringcodec/iso646fi.h +++ b/source/stringcodec/iso646fi.h @@ -1,10 +1,10 @@ -#ifndef MSP_STRINGS_ISO646FI_H_ -#define MSP_STRINGS_ISO646FI_H_ +#ifndef MSP_STRINGCODEC_ISO646FI_H_ +#define MSP_STRINGCODEC_ISO646FI_H_ #include "codec.h" namespace Msp { -namespace Codecs { +namespace StringCodec { class Iso646Fi: public Codec { @@ -33,7 +33,7 @@ public: virtual Decoder *create_decoder(ErrorMode em = THROW_ON_ERROR) const { return new Decoder(em); } }; -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/source/stringcodec/iso88591.cpp b/source/stringcodec/iso88591.cpp index a5f3c55..19c1b89 100644 --- a/source/stringcodec/iso88591.cpp +++ b/source/stringcodec/iso88591.cpp @@ -3,7 +3,7 @@ using namespace std; namespace Msp { -namespace Codecs { +namespace StringCodec { void Iso88591::Encoder::encode_char(UnicodeChar ch, string &buf) { @@ -27,5 +27,5 @@ UnicodeChar Iso88591::Decoder::decode_char(const string &str, string::const_iter return static_cast(*i++); } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/iso88591.h b/source/stringcodec/iso88591.h index d779ff0..060a6d4 100644 --- a/source/stringcodec/iso88591.h +++ b/source/stringcodec/iso88591.h @@ -1,10 +1,10 @@ -#ifndef MSP_STRINGS_ISO88591_H_ -#define MSP_STRINGS_ISO88591_H_ +#ifndef MSP_STRINGCODEC_ISO88591_H_ +#define MSP_STRINGCODEC_ISO88591_H_ #include "codec.h" namespace Msp { -namespace Codecs { +namespace StringCodec { class Iso88591: public Codec { @@ -33,7 +33,7 @@ public: virtual Decoder *create_decoder(ErrorMode em = THROW_ON_ERROR) const { return new Decoder(em); } }; -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/source/stringcodec/iso885915.cpp b/source/stringcodec/iso885915.cpp index 7aef9d3..8e121ad 100644 --- a/source/stringcodec/iso885915.cpp +++ b/source/stringcodec/iso885915.cpp @@ -23,7 +23,7 @@ const int mapping[map_size*2]= namespace Msp { -namespace Codecs { +namespace StringCodec { void Iso885915::Encoder::encode_char(UnicodeChar ch, string &buf) { @@ -59,5 +59,5 @@ UnicodeChar Iso885915::Decoder::decode_char(const string &str, string::const_ite return result; } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/iso885915.h b/source/stringcodec/iso885915.h index 06c5301..e92eb08 100644 --- a/source/stringcodec/iso885915.h +++ b/source/stringcodec/iso885915.h @@ -1,10 +1,10 @@ -#ifndef MSP_STRINGS_ISO885915_H_ -#define MSP_STRINGS_ISO885915_H_ +#ifndef MSP_STRINGCODEC_ISO885915_H_ +#define MSP_STRINGCODEC_ISO885915_H_ #include "codec.h" namespace Msp { -namespace Codecs { +namespace StringCodec { class Iso885915: public Codec { @@ -33,7 +33,7 @@ public: virtual Decoder *create_decoder(ErrorMode em = THROW_ON_ERROR) const { return new Decoder(em); } }; -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/source/stringcodec/jisx0201.cpp b/source/stringcodec/jisx0201.cpp index d5987e5..f6a69ad 100644 --- a/source/stringcodec/jisx0201.cpp +++ b/source/stringcodec/jisx0201.cpp @@ -3,7 +3,7 @@ using namespace std; namespace Msp { -namespace Codecs { +namespace StringCodec { void JisX0201::Encoder::encode_char(UnicodeChar ch, string &buf) { @@ -47,5 +47,5 @@ UnicodeChar JisX0201::Decoder::decode_char(const string &str, string::const_iter return result; } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/jisx0201.h b/source/stringcodec/jisx0201.h index 67a6e78..2ad0112 100644 --- a/source/stringcodec/jisx0201.h +++ b/source/stringcodec/jisx0201.h @@ -1,10 +1,10 @@ -#ifndef MSP_STRINGS_JISX201_H_ -#define MSP_STRINGS_JISX201_H_ +#ifndef MSP_STRINGCODEC_JISX201_H_ +#define MSP_STRINGCODEC_JISX201_H_ #include "codec.h" namespace Msp { -namespace Codecs { +namespace StringCodec { class JisX0201: public Codec { @@ -33,7 +33,7 @@ public: virtual Decoder *create_decoder(ErrorMode em = THROW_ON_ERROR) const { return new Decoder(em); } }; -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/source/stringcodec/jisx0208.cpp b/source/stringcodec/jisx0208.cpp index b8d8e05..7df6254 100644 --- a/source/stringcodec/jisx0208.cpp +++ b/source/stringcodec/jisx0208.cpp @@ -5,7 +5,7 @@ using namespace std; namespace Msp { -namespace Codecs { +namespace StringCodec { void JisX0208::Encoder::encode_char(UnicodeChar ucs, string &buf) { @@ -82,5 +82,5 @@ Kuten ucs_to_jisx0208(UnicodeChar c) return result; } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/jisx0208.h b/source/stringcodec/jisx0208.h index c5f52d5..4fb85a2 100644 --- a/source/stringcodec/jisx0208.h +++ b/source/stringcodec/jisx0208.h @@ -1,10 +1,10 @@ -#ifndef MSP_STRINGS_JISX0208_H_ -#define MSP_STRINGS_JISX0208_H_ +#ifndef MSP_STRINGCODEC_JISX0208_H_ +#define MSP_STRINGCODEC_JISX0208_H_ #include "codec.h" namespace Msp { -namespace Codecs { +namespace StringCodec { /** Codec for the JIS X 0208 encoding. This is not particularly useful as a @@ -52,7 +52,7 @@ struct Kuten extern UnicodeChar jisx0208_to_ucs(Kuten); extern Kuten ucs_to_jisx0208(UnicodeChar); -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/source/stringcodec/utf8.cpp b/source/stringcodec/utf8.cpp index d7b55ff..4d3cea5 100644 --- a/source/stringcodec/utf8.cpp +++ b/source/stringcodec/utf8.cpp @@ -3,7 +3,7 @@ using namespace std; namespace Msp { -namespace Codecs { +namespace StringCodec { void Utf8::Encoder::encode_char(UnicodeChar ch, string &buf) { @@ -81,5 +81,5 @@ UnicodeChar Utf8::Decoder::decode_char(const string &str, string::const_iterator return *i++; } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/utf8.h b/source/stringcodec/utf8.h index 89eced8..b976291 100644 --- a/source/stringcodec/utf8.h +++ b/source/stringcodec/utf8.h @@ -1,10 +1,10 @@ -#ifndef MSP_STRINGS_UTF8_H_ -#define MSP_STRINGS_UTF8_H_ +#ifndef MSP_STRINGCODEC_UTF8_H_ +#define MSP_STRINGCODEC_UTF8_H_ #include "codec.h" namespace Msp { -namespace Codecs { +namespace StringCodec { class Utf8: public Codec { @@ -33,7 +33,7 @@ public: virtual Decoder *create_decoder(ErrorMode em = THROW_ON_ERROR) const { return new Decoder(em); } }; -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/source/stringcodec/windows1252.cpp b/source/stringcodec/windows1252.cpp index 33527e4..dc03172 100644 --- a/source/stringcodec/windows1252.cpp +++ b/source/stringcodec/windows1252.cpp @@ -16,7 +16,7 @@ unsigned short table[32]= namespace Msp { -namespace Codecs { +namespace StringCodec { void Windows1252::Encoder::encode_char(UnicodeChar ch, string &buf) { @@ -61,5 +61,5 @@ UnicodeChar Windows1252::Decoder::decode_char(const string &str, string::const_i return result; } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp diff --git a/source/stringcodec/windows1252.h b/source/stringcodec/windows1252.h index f790f39..e764965 100644 --- a/source/stringcodec/windows1252.h +++ b/source/stringcodec/windows1252.h @@ -1,10 +1,10 @@ -#ifndef MSP_STRINGS_WINDOWS1252_H_ -#define MSP_STRINGS_WINDOWS1252_H_ +#ifndef MSP_STRINGCODEC_WINDOWS1252_H_ +#define MSP_STRINGCODEC_WINDOWS1252_H_ #include "codec.h" namespace Msp { -namespace Codecs { +namespace StringCodec { class Windows1252: public Codec { @@ -33,7 +33,7 @@ public: virtual Decoder *create_decoder(ErrorMode em = THROW_ON_ERROR) const { return new Decoder(em); } }; -} // namespace Codecs +} // namespace StringCodec } // namespace Msp #endif diff --git a/transcode.cpp b/transcode.cpp index cfa24a9..e8ba3eb 100644 --- a/transcode.cpp +++ b/transcode.cpp @@ -1,7 +1,7 @@ /* $Id$ */ #include #include -#include +#include using namespace std; using namespace Msp; @@ -14,17 +14,17 @@ int main(int argc, char **argv) return 1; } - Codecs::Codec *from = Codecs::create_codec(argv[1]); - Codecs::Codec *to = Codecs::create_codec(argv[2]); + StringCodec::Codec *from = StringCodec::create_codec(argv[1]); + StringCodec::Codec *to = StringCodec::create_codec(argv[2]); - Codecs::Decoder *from_dec = from->create_decoder(Codecs::TRANSLITERATE); - Codecs::Encoder *to_enc = to->create_encoder(Codecs::TRANSLITERATE); + StringCodec::Decoder *from_dec = from->create_decoder(StringCodec::TRANSLITERATE); + StringCodec::Encoder *to_enc = to->create_encoder(StringCodec::TRANSLITERATE); string line; while(getline(cin, line)) { line += '\n'; - Codecs::ustring ustr; + StringCodec::ustring ustr; from_dec->decode(line, ustr); string result; to_enc->encode(ustr, result); -- 2.43.0