Go to the documentation of this file.00001
00002 #include "tao/debug.h"
00003 #include "ace/Dynamic_Service.h"
00004 #include "ace/Log_Msg.h"
00005 #include "tao/Codeset/UTF8_Latin1_Factory.h"
00006
00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00008
00009 ACE_STATIC_SVC_DEFINE (TAO_UTF8_Latin1_Factory,
00010 ACE_TEXT ("UTF8_Latin1_Factory"),
00011 ACE_SVC_OBJ_T,
00012 &ACE_SVC_NAME (TAO_UTF8_Latin1_Factory),
00013 ACE_Service_Type::DELETE_THIS
00014 | ACE_Service_Type::DELETE_OBJ,
00015 0)
00016 ACE_FACTORY_DEFINE (TAO_Codeset, TAO_UTF8_Latin1_Factory)
00017
00018
00019 TAO_UTF8_Latin1_Factory::TAO_UTF8_Latin1_Factory()
00020 : translator_ (0)
00021 {
00022 }
00023
00024 TAO_UTF8_Latin1_Factory::~TAO_UTF8_Latin1_Factory ()
00025 {
00026 delete this->translator_;
00027 }
00028 int
00029 TAO_UTF8_Latin1_Factory::init (int argc, ACE_TCHAR *argv[])
00030 {
00031 TAO_Codeset_Translator_Factory::init (argc, argv);
00032 return 0;
00033 }
00034
00035 CONV_FRAME::CodeSetId
00036 TAO_UTF8_Latin1_Factory::ncs () const
00037 {
00038 create_translator();
00039 return this->translator_->ncs();
00040 }
00041
00042 CONV_FRAME::CodeSetId
00043 TAO_UTF8_Latin1_Factory::tcs () const
00044 {
00045 create_translator();
00046 return this->translator_->tcs();
00047 }
00048
00049
00050
00051 void
00052 TAO_UTF8_Latin1_Factory::assign (TAO_InputCDR *cdr) const
00053 {
00054 if (cdr)
00055 {
00056 create_translator();
00057 this->assign_i(cdr,this->translator_);
00058 }
00059 }
00060
00061
00062
00063 void
00064 TAO_UTF8_Latin1_Factory::assign (TAO_OutputCDR *cdr) const
00065 {
00066 if (cdr)
00067 {
00068 create_translator();
00069 this->assign_i(cdr,this->translator_);
00070 }
00071 }
00072
00073 void
00074 TAO_UTF8_Latin1_Factory::create_translator () const
00075 {
00076 if (this->translator_ == 0)
00077 {
00078 TAO_UTF8_Latin1_Factory * pthis =
00079 const_cast <TAO_UTF8_Latin1_Factory *>(this);
00080 ACE_NEW (pthis->translator_, TAO_UTF8_Latin1_Translator);
00081 if (this->translator_ == 0)
00082 {
00083 if (TAO_debug_level)
00084 ACE_ERROR ((LM_ERROR,
00085 ACE_TEXT ("(%P|%t) TAO_UTF8_Latin1_Factory cannot ")
00086 ACE_TEXT("create TAO_UTF8_Latin1_Translator\n")
00087 ));
00088 }
00089 }
00090 }
00091
00092 TAO_END_VERSIONED_NAMESPACE_DECL