diff options
author | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-12-16 05:26:36 +0000 |
---|---|---|
committer | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-12-16 05:26:36 +0000 |
commit | b04fd3b3a3e4195f6bc671d44b91962972642eec (patch) | |
tree | 1fce6c0c049bf05ea83beea347c553b377095bb3 /TAO/tao/FILE_Parser.cpp | |
parent | 1cf12da21f93cd359e7fccf25b80692614f14cd5 (diff) | |
download | ATCD-b04fd3b3a3e4195f6bc671d44b91962972642eec.tar.gz |
Branched out ACE
Diffstat (limited to 'TAO/tao/FILE_Parser.cpp')
-rw-r--r-- | TAO/tao/FILE_Parser.cpp | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/TAO/tao/FILE_Parser.cpp b/TAO/tao/FILE_Parser.cpp deleted file mode 100644 index ac6bc32c4a3..00000000000 --- a/TAO/tao/FILE_Parser.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// $Id$ - -#include "tao/FILE_Parser.h" - -#if (TAO_HAS_FILE_PARSER == 1) - -#include "tao/ORB.h" -#include "tao/Object.h" - -#include "ace/Read_Buffer.h" -#include "ace/Malloc_Base.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" - -ACE_RCSID (tao, - FILE_Parser, - "$Id$") - -static const char file_prefix[] = "file:"; - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_FILE_Parser::~TAO_FILE_Parser (void) -{ -} - - -bool -TAO_FILE_Parser::match_prefix (const char *ior_string) const -{ - return (ACE_OS::strncmp (ior_string, - ::file_prefix, - sizeof (::file_prefix) - 1) == 0); -} - -CORBA::Object_ptr -TAO_FILE_Parser::parse_string (const char *ior, CORBA::ORB_ptr orb) -{ - // Skip the prefix, we know it is there because this method in only - // called if <match_prefix> returns 1. - const char *filename = - ior + sizeof (::file_prefix)+1; - - FILE* file = ACE_OS::fopen (ACE_TEXT_CHAR_TO_TCHAR (filename), - ACE_TEXT("r")); - - if (file == 0) - return CORBA::Object::_nil (); - - ACE_Read_Buffer reader (file, true); - - char* string = reader.read (); - - if (string == 0) - return CORBA::Object::_nil (); - - CORBA::Object_ptr object = CORBA::Object::_nil (); - try - { - object = orb->string_to_object (string); - - reader.alloc ()->free (string); - } - catch (const ::CORBA::Exception&) - { - reader.alloc ()->free (string); - throw; - } - - return object; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -ACE_STATIC_SVC_DEFINE (TAO_FILE_Parser, - ACE_TEXT ("FILE_Parser"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_FILE_Parser), - ACE_Service_Type::DELETE_THIS | - ACE_Service_Type::DELETE_OBJ, - 0) - -ACE_FACTORY_DEFINE (TAO, TAO_FILE_Parser) - -#endif /* TAO_HAS_FILE_PARSER == 1 */ - |