当前位置: 首页>>代码示例>>C++>>正文


C++ ACE_TString类代码示例

本文整理汇总了C++中ACE_TString的典型用法代码示例。如果您正苦于以下问题:C++ ACE_TString类的具体用法?C++ ACE_TString怎么用?C++ ACE_TString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ACE_TString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetStringDefault

std::string GetStringDefault(const char* name, const std::string &def)
{
    ACE_TString val;
    return GetValueHelper(name, val) ? val.c_str() : def;
};
开发者ID:S-proyect,项目名称:Emu-S,代码行数:5,代码来源:Config.cpp

示例2: if

  bool
  XML_Saver::open(const ACE_TString & base_name, size_t backup_count)
  {
    this->base_name_ = base_name;
    this->backup_count_ = backup_count;
    if (base_name ==  ACE_TEXT("cout"))
    {
      this->output_ = stdout;
      this->close_out_ = false;
    }
    else if (base_name ==  ACE_TEXT("cerr"))
    {
      this->output_ = stderr;
      this->close_out_ = false;
    }
    else
    {
      ACE_TString file_name = base_name;
      file_name += ACE_TEXT(".new");

      this->output_ = ACE_OS::fopen (file_name.c_str(), ACE_TEXT("wb"));
      if (this->output_) {
        this->close_out_ = true;
      } else {
        ORBSVCS_ERROR ((LM_ERROR,
          ACE_TEXT ("(%P|%t) XML_Saver unable to open %s\n"),
            base_name.c_str()));
      }
    }
    if (this->output_ != 0)
    {
      FILE * const out = this->output_;

      ACE_OS::fprintf (out, "<?xml version=\"1.0\"?>\n");

      try
      {
        bool changed = true;
        NVPList attrs;

        ACE_Time_Value const now = ACE_High_Res_Timer::gettimeofday();

        ACE_UINT64 nowus = now.usec();
        static const ACE_UINT64 USECSPERSEC = 1000 * 1000;
        ACE_UINT64 const tmpus = now.sec();
        nowus += tmpus * USECSPERSEC;

        ACE_TCHAR nowusstr[128];
        ACE_OS::sprintf(nowusstr, ACE_UINT64_FORMAT_SPECIFIER, nowus);

        attrs.push_back(NVP("version", "1.0"));
        if (this->timestamp_)
        {
          attrs.push_back(NVP("timestamp", ACE_TEXT_ALWAYS_CHAR(nowusstr)));
        }
        this->begin_object(0, "notification_service", attrs, changed);
      }
      catch (const CORBA::Exception& ex)
      {
        ex._tao_print_exception (
          ACE_TEXT (
            "(%P|%t) XML_Saver Unknown exception\n"));
        if (this->close_out_ && this->output_ != 0)
          {
            (void) ACE_OS::fclose (this->output_);
          }

        this->output_ = 0;
      }
    }
    return this->output_ != 0;
  }
开发者ID:asdlei00,项目名称:ACE,代码行数:72,代码来源:XML_Saver.cpp

示例3: GetFloatDefault

float GetFloatDefault(const char* name, float def)
{
    ACE_TString val;
    return GetValueHelper(name, val) ? (float)atof(val.c_str()) : def;
};
开发者ID:S-proyect,项目名称:Emu-S,代码行数:5,代码来源:Config.cpp

示例4: ACE_TRACE

int
ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
                      int open_mode,
                      ACE_SHLIB_HANDLE handle,
                      ERROR_STACK *errors)
{
  ACE_TRACE ("ACE_DLL_Handle::open");
  ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));

  if (this->dll_name_)
    {
      // Once dll_name_ has been set, it can't be changed..
      if (ACE_OS::strcmp (this->dll_name_, dll_name) != 0)
        {
          if (ACE::debug ())
            ACELIB_ERROR ((LM_ERROR,
                        ACE_TEXT ("ACE (%P|%t) DLL_Handle::open: error, ")
                        ACE_TEXT ("tried to reopen %s with name %s\n"),
                        this->dll_name_,
                        dll_name));

          return -1;
        }
    }
  else
    this->dll_name_ = ACE::strnew (dll_name);

  if (!this->open_called_)
    this->open_called_ = 1;

  // If it hasn't been loaded yet, go ahead and do that now.
  if (this->handle_ == ACE_SHLIB_INVALID_HANDLE)
    {
      if (handle)
        this->handle_ = handle;
      else
        {
          /*
          ** Get the set of names to try loading. We need to do this to
          ** properly support the ability for a user to specify a simple,
          ** unadorned name (for example, "ACE") that will work across
          ** platforms. We apply platform specifics to get a name that will
          ** work (e.g. libACE, ACEd.dll, ACE.dll, etc.) We rely on the
          ** underlying dlopen() implementation to "Do The Right Thing" in
          ** terms of using relative paths, LD_LIBRARY_PATH, system security
          ** rules, etc. except when ACE_MUST_HELP_DLOPEN_SEARCH_PATH is set.
          ** If it is set, then ACE::ldfind() scans the configured path
          ** looking for a match on the name and prefix/suffix applications.
          ** NOTE: having ACE scan for a file and then pass a fully-qualified
          ** pathname to dlopen() is a potential security hole; therefore,
          ** do not use ACE_MUST_HELP_DLOPEN_SEARCH_PATH unless necessary
          ** and only after considering the risks.
          */
          ACE_Array<ACE_TString> dll_names;
          dll_names.max_size (10);    // Decent guess to avoid realloc later

#if defined (ACE_MUST_HELP_DLOPEN_SEARCH_PATH)
          // Find out where the library is
          ACE_TCHAR dll_pathname[MAXPATHLEN + 1];

          // Transform the pathname into the appropriate dynamic link library
          // by searching the ACE_LD_SEARCH_PATH.
          ACE::ldfind (dll_name,
                       dll_pathname,
                       (sizeof dll_pathname / sizeof (ACE_TCHAR)));
          ACE_TString dll_str (dll_pathname);
          dll_names.size (1);
          dll_names.set (dll_str, 0);
#else
          this->get_dll_names (dll_name, dll_names);
#endif

          ACE_Array_Iterator<ACE_TString> name_iter (dll_names);
          ACE_TString *name = 0;
          while (name_iter.next (name))
            {
              // The ACE_SHLIB_HANDLE object is obtained.
              this->handle_ = ACE_OS::dlopen (name->c_str (),
                                              open_mode);

              if (ACE::debug ())
                {
                  ACE_TString err;
                  ACELIB_DEBUG ((LM_DEBUG,
                              ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ")
                              ACE_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"),
                              name->c_str (),
                              open_mode,
                              ((this->handle_ != ACE_SHLIB_INVALID_HANDLE)
                               ? ACE_TEXT ("succeeded")
                               : ACE_TEXT ("failed")),
                              this->error (err).c_str()));
                }

              if (this->handle_ != ACE_SHLIB_INVALID_HANDLE)   // Good one?
                break;

              // If errno is ENOENT we just skip over this one,
              // anything else - like an undefined symbol, for
              // instance must be flagged here or the next error will
//.........这里部分代码省略.........
开发者ID:INMarkus,项目名称:ATCD,代码行数:101,代码来源:DLL_Manager.cpp

示例5: ACE_TEXT

int
ACE_Ini_ImpExp::export_section (const ACE_Configuration_Section_Key& section,
                                const ACE_TString& path,
                                FILE* out)
{
    // don't export the root
    if (path.length ())
    {
        // Write out the section header
        ACE_TString header = ACE_TEXT ("[");
        header += path;
        header += ACE_TEXT ("]\n");
        if (ACE_OS::fputs (header.fast_rep (), out) < 0)
            return -1;
        // Write out each value
        int index = 0;
        ACE_TString name;
        ACE_Configuration::VALUETYPE type;
        ACE_TString line;
        ACE_TCHAR int_value[32];
        ACE_TCHAR bin_value[3];
        void* binary_data;
        size_t binary_length;
        ACE_TString string_value;
        while (!config_.enumerate_values (section, index, name, type))
        {
            line = name + ACE_TEXT ("=");
            switch (type)
            {
            case ACE_Configuration::INTEGER:
            {
                u_int value;
                if (config_.get_integer_value (section, name.fast_rep (), value))
                    return -2;
                ACE_OS::sprintf (int_value, ACE_TEXT ("%08x"), value);
                line += int_value;
                break;
            }
            case ACE_Configuration::STRING:
            {
                if (config_.get_string_value (section,
                                              name.fast_rep (),
                                              string_value))
                    return -2;
                line += string_value;
                break;
            }
#ifdef _WIN32
            case ACE_Configuration::INVALID:
                break;  // JDO added break.  Otherwise INVALID is processed
                // like BINARY. If that's correct, please remove the
                // break and these comments
#endif
            case ACE_Configuration::BINARY:
            {
                // not supported yet - maybe use BASE64 codeing?
                if (config_.get_binary_value (section,
                                              name.fast_rep (),
                                              binary_data,
                                              binary_length))
                    return -2;
                line += ACE_TEXT ("\"");
                unsigned char* ptr = (unsigned char*)binary_data;
                while (binary_length)
                {
                    if (ptr != binary_data)
                    {
                        line += ACE_TEXT (",");
                    }
                    ACE_OS::sprintf (bin_value, ACE_TEXT ("%02x"), *ptr);
                    line += bin_value;
                    --binary_length;
                    ++ptr;
                }
                line += ACE_TEXT ("\"");
                delete [] (char *) binary_data;
                break;
            }
            default:
                return -3;
            }// end switch on type

            line += ACE_TEXT ("\n");
            if (ACE_OS::fputs (line.fast_rep (), out) < 0)
                return -4;
            ++index;
        }// end while enumerating values
    }
    // Export all sub sections
    int index = 0;
    ACE_TString name;
    ACE_Configuration_Section_Key sub_key;
    ACE_TString sub_section;
    while (!config_.enumerate_sections (section, index, name))
    {
        ACE_TString sub_section (path);
        if (path.length ())
            sub_section += ACE_TEXT ("\\");
        sub_section += name;
        if (config_.open_section (section, name.fast_rep (), 0, sub_key))
//.........这里部分代码省略.........
开发者ID:wow4all,项目名称:SkyfireBG,代码行数:101,代码来源:Configuration_Import_Export.cpp

示例6: print_context

// Print an context with <name> and <parent>
static void
print_context (ACE_Registry::Naming_Context &parent,
               const ACE_TString &name,
               u_long indentation)
{
  // Set indentation
  indent (indentation);
  cout << name << endl;

  ACE_Registry::Naming_Context child_context;
  // Find child context
  int result = parent.resolve_context (name,
                                       child_context,
                                       KEY_READ);
  if (result != 0)
    ACE_ERROR ((LM_ERROR, "%s %s\n", "ACE_Registry::Naming_Context::resolve_context failed for:", name.c_str ()));
  else
    {
      // Print contents of the child
      result = ::print_naming_context (child_context,
                                       indentation + INDENTATION_LEVEL);
      if (result != 0)
        ACE_ERROR ((LM_ERROR, "%p\n", "print_naming_context failed"));
    }
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:26,代码来源:test_registry_iterator.cpp

示例7: DBG_ENTRY

int
SimpleDataWriter::run(SimplePublisher* publisher)
{
  DBG_ENTRY("SimpleDataWriter","run");

  VDBG((LM_DEBUG, "(%P|%t) DBG:   "
             "Build the DataSampleElementList to contain one element - "
             "our 'Hello World' string.\n"));

  // We just send one message.

  // This is what goes in the "Data Block".
  ACE_TString data = "Hello World!";

  // Now we can create the DataSampleHeader struct and set its fields.
  TAO::DCPS::DataSampleHeader header;

  // The +1 makes the null terminator ('/0') get placed into the block.
  header.message_length_ = data.length() + 1;
  header.message_id_ = 1;
  header.sequence_ = 0;
  // TMB - Compiler no longer likes the next line...  source_timestamp_ is gone.
  //header.source_timestamp_ = ACE_OS::gettimeofday().msec();
  header.publication_id_ = this->pub_id_;

  // The DataSampleHeader is what goes in the "Header Block".
  ACE_Message_Block* header_block = new ACE_Message_Block
                                                (header.max_marshaled_size());
  header_block << header;

  // The +1 makes the null terminator ('/0') get placed into the block.
  ACE_Message_Block* data_block = new ACE_Message_Block(data.length() + 1);
  data_block->copy(data.c_str());

  // Chain the "Data Block" to the "Header Block"
  header_block->cont(data_block);

  // Create the DataSampleListElement now.
  TAO::DCPS::DataSampleListElementAllocator allocator(3);
  TAO::DCPS::TransportSendElementAllocator trans_allocator(3, sizeof (TAO::DCPS::TransportSendElement));
  TAO::DCPS::DataSampleListElement* element;

  ACE_NEW_MALLOC_RETURN(element,
           static_cast<TAO::DCPS::DataSampleListElement*> (allocator.malloc(sizeof (TAO::DCPS::DataSampleListElement))),
           TAO::DCPS::DataSampleListElement(this->pub_id_, this, 0, &trans_allocator),
           1);

  // The Sample Element will hold on to the chain of blocks (header + data).
  element->sample_ = header_block;

  // Set up the DataSampleList
  TAO::DCPS::DataSampleList samples;

  samples.head_ = element;
  samples.tail_ = element;
  samples.size_ = 1;

  VDBG((LM_DEBUG, "(%P|%t) DBG:   "
             "Ask the publisher to send the DataSampleList (samples).\n"));

  publisher->send_samples(samples);

  VDBG((LM_DEBUG, "(%P|%t) DBG:   "
             "The Publisher has finished sending the samples.\n"));

  return 0;
}
开发者ID:svn2github,项目名称:OpenDDS,代码行数:67,代码来源:SimpleDataWriter.cpp

示例8: ACE_NEW_RETURN

CORBA::ExtValueDef::ExtFullValueDescription *
TAO_ExtValueDef_i::describe_ext_value_i (
  )
{
  CORBA::ExtValueDef::ExtFullValueDescription *fv_desc = 0;
  ACE_NEW_RETURN (fv_desc,
                  CORBA::ExtValueDef::ExtFullValueDescription,
                  0);
  CORBA::ExtValueDef::ExtFullValueDescription_var retval = fv_desc;

  ACE_TString holder;
  this->repo_->config ()->get_string_value (this->section_key_,
                                            "name",
                                            holder);
  fv_desc->name = holder.fast_rep ();
  this->repo_->config ()->get_string_value  (this->section_key_,
                                             "id",
                                             holder);
  fv_desc->id = holder.fast_rep ();

  CORBA::ULong val = 0;

  this->repo_->config ()->get_integer_value (this->section_key_,
                                             "is_abstract",
                                             val);
  fv_desc->is_abstract = static_cast<CORBA::Boolean> (val);
  this->repo_->config ()->get_integer_value (this->section_key_,
                                             "is_custom",
                                             val);
  fv_desc->is_custom = static_cast<CORBA::Boolean> (val);
  this->repo_->config ()->get_string_value (this->section_key_,
                                            "container_id",
                                            holder);
  fv_desc->defined_in = holder.fast_rep ();
  this->repo_->config ()->get_string_value (this->section_key_,
                                            "version",
                                            holder);
  fv_desc->version = holder.fast_rep ();

  // Operations.

  fv_desc->operations.length (0);

  ACE_Configuration_Section_Key ops_key;
  int status =
    this->repo_->config ()->open_section (this->section_key_,
                                          "ops",
                                          0,
                                          ops_key);
  CORBA::ULong count = 0;
  CORBA::ULong param_count = 0;
  char *stringified = 0;
  CORBA::ULong i = 0;
  CORBA::ULong j = 0;
  TAO_IDLType_i *idl_type = 0;
  CORBA::Object_var obj;
  ACE_Configuration_Section_Key params_key, excepts_key, except_def_key;

  if (status == 0)
    {
      this->repo_->config ()->get_integer_value (ops_key,
                                                 "count",
                                                 count);
      fv_desc->operations.length (count);
      ACE_Configuration_Section_Key op_key, result_key, contexts_key;

      for (i = 0; i < count; ++i)
        {
          stringified = TAO_IFR_Service_Utils::int_to_string (i);
          this->repo_->config ()->open_section (ops_key,
                                                stringified,
                                                0,
                                                op_key);
          this->repo_->config ()->get_string_value (op_key,
                                                    "name",
                                                    holder);
          fv_desc->operations[i].name = holder.fast_rep ();
          this->repo_->config ()->get_string_value (op_key,
                                                    "id",
                                                    holder);
          fv_desc->operations[i].id = holder.fast_rep ();
          this->repo_->config ()->get_string_value (this->section_key_,
                                                    "id",
                                                    holder);
          fv_desc->operations[i].defined_in = holder.fast_rep ();
          this->repo_->config ()->get_string_value (op_key,
                                                    "result",
                                                    holder);
          idl_type =
            TAO_IFR_Service_Utils::path_to_idltype (holder,
                                                    this->repo_);
          fv_desc->operations[i].result =
            idl_type->type_i ();

          this->repo_->config ()->get_integer_value (op_key,
                                                     "mode",
                                                     val);
          fv_desc->operations[i].mode = static_cast<CORBA::OperationMode> (val);
          CORBA::TCKind kind =
            fv_desc->operations[i].result->kind ();
//.........这里部分代码省略.........
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,代码来源:ExtValueDef_i.cpp

示例9: ACE_NEW_RETURN

CORBA::InterfaceAttrExtension::ExtFullInterfaceDescription *
TAO_InterfaceAttrExtension_i::describe_ext_interface_i (
)
{
    CORBA::InterfaceAttrExtension::ExtFullInterfaceDescription *fifd = 0;
    ACE_NEW_RETURN (fifd,
                    CORBA::InterfaceAttrExtension::ExtFullInterfaceDescription,
                    0);

    CORBA::InterfaceAttrExtension::ExtFullInterfaceDescription_var retval =
        fifd;

    ACE_TString holder;

    this->repo_->config ()->get_string_value (this->section_key_,
            "name",
            holder);
    fifd->name = holder.fast_rep ();
    this->repo_->config ()->get_string_value (this->section_key_,
            "id",
            holder);
    fifd->id = holder.fast_rep ();

    this->repo_->config ()->get_string_value (this->section_key_,
            "container_id",
            holder);

    fifd->defined_in = holder.fast_rep ();
    this->repo_->config ()->get_string_value (this->section_key_,
            "version",
            holder);
    fifd->version = holder.fast_rep ();

    CORBA::ULong i = 0;
    CORBA::ULong j = 0;
    ACE_Unbounded_Queue<ACE_Configuration_Section_Key> key_queue;

    // Store our section key for later restoration after we have
    // traversed entries for inherited interfaces.
    ACE_Configuration_Section_Key key_holder = this->section_key_;

    // Operations
    TAO_InterfaceDef_i iface (this->repo_);
    iface.section_key (this->section_key_);
    iface.inherited_operations (key_queue);

    // Restore our original section key.
    //   I am not sure this is needed but it will not hurt.
    this->section_key (key_holder);

    ACE_Configuration_Section_Key ops_key, op_key;
    int status =
        this->repo_->config ()->open_section (this->section_key_,
                "ops",
                0,
                ops_key);

    CORBA::ULong count = 0;

    if (status == 0)
    {
        this->repo_->config ()->get_integer_value (ops_key,
                "count",
                count);

        for (j = 0; j < count; ++j)
        {
            char *stringified = TAO_IFR_Service_Utils::int_to_string (j);
            status =
                this->repo_->config ()->open_section (ops_key,
                        stringified,
                        0,
                        op_key);

            if (status == 0)
            {
                key_queue.enqueue_tail (op_key);
            }
        }
    }

    CORBA::ULong size = static_cast<CORBA::ULong> (key_queue.size ());
    fifd->operations.length (size);

    for (i = 0; i < size; ++i)
    {
        ACE_Configuration_Section_Key key;
        key_queue.dequeue_head (key);

        TAO_OperationDef_i op (this->repo_);
        op.section_key (key);

        op.make_description (fifd->operations[i]);
    }

    // Restore our original section key.
    //   It may have been overwritten by a superclass key as part of the
    //   make_description() call.
    this->section_key (key_holder);

//.........这里部分代码省略.........
开发者ID:svn2github,项目名称:ACE-Middleware,代码行数:101,代码来源:InterfaceAttrExtension_i.cpp

示例10: ACE_TRACE

int
ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
                      int open_mode,
                      ACE_SHLIB_HANDLE handle)
{
  ACE_TRACE ("ACE_DLL_Handle::open");
  ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));

  //ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("dll_name: %s; open_mode: %d \n"),
  //            dll_name,
  //            open_mode));

  if (this->dll_name_)
    {
      // Once dll_name_ has been set, it can't be changed..
      if (ACE_OS::strcmp (this->dll_name_, dll_name) != 0)
        {
          if (ACE::debug ())
            ACE_ERROR ((LM_ERROR,
                        ACE_LIB_TEXT ("ACE_DLL_Handle::open: error, ")
                        ACE_LIB_TEXT ("tried to reopen %s with name %s\n"),
                        this->dll_name_,
                        dll_name));

          return -1;
        }
    }
  else
    this->dll_name_ = ACE::strnew (dll_name);

  if (!this->open_called_)
    this->open_called_ = 1;

  // If it hasn't been loaded yet, go ahead and do that now.
  if (this->handle_ == ACE_SHLIB_INVALID_HANDLE)
    {
      if (handle)
        this->handle_ = handle;
      else
        {
          if (ACE::debug ())
            ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_DLL_Handle::open: calling dlopen on ")
                        ACE_LIB_TEXT ("\"%s\"\n"), dll_name));

          /*
          ** Get the set of names to try loading. We need to do this to
          ** properly support the ability for a user to specify a simple,
          ** unadorned name (for example, "ACE") that will work across
          ** platforms. We apply platform specifics to get a name that will
          ** work (e.g. libACE, ACEd.dll, ACE.dll, etc.) We rely on the
          ** underlying dlopen() implementation to "Do The Right Thing" in
          ** terms of using relative paths, LD_LIBRARY_PATH, system security
          ** rules, etc. except when ACE_MUST_HELP_DLOPEN_SEARCH_PATH is set.
          ** If it is set, then ACE::ldfind() scans the configured path
          ** looking for a match on the name and prefix/suffix applications.
          ** NOTE: having ACE scan for a file and then pass a fully-qualified
          ** pathname to dlopen() is a potential security hole; therefore,
          ** do not use ACE_MUST_HELP_DLOPEN_SEARCH_PATH unless necessary
          ** and only after considering the risks.
          */
          ACE_Array<ACE_TString> dll_names;
          dll_names.max_size (10);    // Decent guess to avoid realloc later

#if defined (ACE_MUST_HELP_DLOPEN_SEARCH_PATH)
          // Find out where the library is
          ACE_TCHAR dll_pathname[MAXPATHLEN + 1];

          // Transform the pathname into the appropriate dynamic link library
          // by searching the ACE_LD_SEARCH_PATH.
          ACE::ldfind (dll_name,
                       dll_pathname,
                       (sizeof dll_pathname / sizeof (ACE_TCHAR)));
          ACE_TString dll_str (dll_pathname);
          dll_names.size (1);
          dll_names.set (dll_str, 0);
#else
          this->get_dll_names (dll_name, dll_names);
#endif

          ACE_Array_Iterator<ACE_TString> name_iter (dll_names);
          ACE_TString *name = 0;
          while (name_iter.next (name))
            {
              if (ACE::debug ())
                ACE_DEBUG ((LM_DEBUG,
                            ACE_LIB_TEXT ("ACE_DLL_Handle::open: Trying to open DLL %s with %s name\n"),
                            this->dll_name_,
                            name->c_str ()));

              // The ACE_SHLIB_HANDLE object is obtained.
              this->handle_ = ACE_OS::dlopen (name->c_str (),
                                              open_mode);
              if (this->handle_ != ACE_SHLIB_INVALID_HANDLE)   // Good one
                break;

#if defined (AIX)
              // AIX often puts the shared library file (most often named
              // shr.o) inside an archive library. If this is an archive
              // library name, then try appending [shr.o] and retry.
              if (ACE_TString::npos != name->strstr (ACE_LIB_TEXT (".a")))
//.........这里部分代码省略.........
开发者ID:mbert,项目名称:mulberry-lib-jx,代码行数:101,代码来源:DLL_Manager.cpp

示例11: base

void
ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
                               ACE_Array<ACE_TString> &try_names)
{
  // Build the array of DLL names to try on this platform by applying the
  // proper prefixes and/or suffixes to the specified dll_name.
  ACE_TString base (dll_name);
  ACE_TString base_dir, base_file, base_suffix;

  // 1. Separate the dll_name into the dir part and the file part. We
  // only decorate the file part to determine the names to try loading.
  int pos = base.rfind (ACE_DIRECTORY_SEPARATOR_CHAR);
  if (pos != ACE_TString::npos)
    {
      base_dir = base.substr (0, static_cast<ssize_t>(pos) + 1);
      base_file = base.substr (static_cast<size_t>(pos) + 1);
    }
  else
    base_file = base;

  // 2. Locate the file suffix, if there is one. Move the '.' and the
  // suffix to base_suffix.
  if ((pos = base_file.rfind (ACE_LIB_TEXT ('.'))) != ACE_TString::npos)
    {
      base_suffix = base_file.substr (static_cast<size_t>(pos));
      base_file = base_file.substr (0, static_cast<ssize_t>(pos));
    }

  // 3. Build the combinations to try for this platform.
  // Try these combinations:
  //   - name as originally given
  //   - name with decorator and platform's suffix appended (if not supplied)
  //   - name with platform's suffix appended (if not supplied)
  //   - name with platform's dll prefix (if it has one) and suffix
  //   - name with platform's dll prefix, decorator, and suffix.
  // So we need room for 5 entries in try_names.
  try_names.size (0);
  if ((try_names.max_size () - try_names.size ()) < 5)
    try_names.max_size (try_names.max_size () + 5);
#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)
  ACE_TString decorator (ACE_LD_DECORATOR_STR);
#endif
  ACE_TString suffix (ACE_DLL_SUFFIX);
  ACE_TString prefix (ACE_DLL_PREFIX);

  for (size_t i = 0; i < 5 && try_names.size () < try_names.max_size (); ++i)
    {
      ACE_TString try_this;
      size_t j = try_names.size ();
      switch (i)
        {
        case 0:
          try_this = dll_name;
          break;

        case 1:        // Name + decorator + suffix
        case 2:        // Name + suffix
        case 3:        // Prefix + name + decorator + suffix
        case 4:        // Prefix + name + suffix
          if (
              base_suffix.length () > 0
#if !(defined(ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK))
              || (i == 2 || i == 4)    // No decorator desired; skip
#endif
              )
            break;
          try_this = base_dir;
          if (i > 2)
            try_this += prefix;
          try_this += base_file;
          if (base_suffix.length () > 0)
            try_this += base_suffix;
          else
            {
#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)
              try_this += decorator;
#endif
              try_this += suffix;
            }
          break;
        }

      if (try_this.length ())
        {
          try_names.size (j + 1);
          try_names.set (try_this, j);
        }
    }
  return;
}
开发者ID:mbert,项目名称:mulberry-lib-jx,代码行数:90,代码来源:DLL_Manager.cpp

示例12: add_slash

void Directory::scan_dir(const ACE_TString& relative, DDS_Dirent& dir,
                         unsigned int overflow_index)
{
  ACE_TString path = physical_dirname_ + relative;
  add_slash(path);

  while (DDS_DIRENT* ent = dir.read()) {
    if (ent->d_name[0] == ACE_TEXT('.') && (!ent->d_name[1] ||
        (ent->d_name[1] == ACE_TEXT('.') && !ent->d_name[2]))) {
      continue; // skip '.' and '..'
    }

    ACE_TString file = path + ent->d_name;

    if (is_dir(file.c_str())) {
      ACE_TString phys(relative);
      add_slash(phys);
      phys += ent->d_name;

      if (ACE_OS::strncmp(ent->d_name, ACE_TEXT("_overflow."), 10) == 0) {
        unsigned int n = ACE_OS::atoi(ent->d_name + 10);
        DDS_Dirent overflow(file.c_str());
        scan_dir(ent->d_name, overflow, n);

      } else if (ACE_OS::strlen(ent->d_name) <= FSS_MAX_FILE_NAME_ENCODED) {
        dirs_[b32h_decode(ent->d_name)] = phys;
        ++overflow_[overflow_index];

      } else {
        CwdGuard cg(file);
        std::ifstream fn("_fullname");
        std::string fullname;

        if (!std::getline(fn, fullname)) {
          throw std::runtime_error("Can't read .../_fullname");
        }

        ACE_TString full_t(ACE_TEXT_CHAR_TO_TCHAR(fullname.c_str()));
        dirs_[full_t] = phys;
        ++overflow_[overflow_index];

        String_Index_t idx = phys.rfind(ACE_TEXT('.'));

        if (idx == ACE_TString::npos) {
          throw std::runtime_error("Badly formatted long dir name");
        }

        ACE_TString prefix(phys.c_str(), idx);
        unsigned int serial = ACE_OS::atoi(&phys[idx + 1]);
        unsigned int& counter = long_names_[prefix];

        if (serial >= counter) counter = serial + 1;
      }

    } else { // regular file
      if (ent->d_name[0] != ACE_TEXT('_')) {
        files_[b32h_decode(ent->d_name)] = ent->d_name;
        ++overflow_[overflow_index];
      }
    }
  }
}
开发者ID:yanbodiaoweng,项目名称:DDS,代码行数:62,代码来源:FileSystemStorage.cpp

示例13: GetIntDefault

int GetIntDefault(const char* name, int def)
{
    ACE_TString val;
    return GetValueHelper(name, val) ? atoi(val.c_str()) : def;
};
开发者ID:S-proyect,项目名称:Emu-S,代码行数:5,代码来源:Config.cpp

示例14:

void
TAO_Port_Desc_Seq_Utils<T_desc_seq>::port_descriptions (
    T_desc_seq &desc_seq,
    ACE_Configuration *config,
    ACE_Configuration_Section_Key &key,
    const char *sub_section
  )
{
  ACE_Configuration_Section_Key sub_key;
  int status = config->open_section (key,
                                     sub_section,
                                     0,
                                     sub_key);

  if (status != 0)
    {
      desc_seq.length (0);
      return;
    }

  CORBA::ULong count = 0;
  config->get_integer_value (sub_key,
                             "count",
                             count);
  desc_seq.length (count);
  ACE_Configuration_Section_Key desc_key;
  char *stringified = 0;
  ACE_TString holder;

  for (CORBA::ULong i = 0; i < count; ++i)
    {
      stringified = TAO_IFR_Service_Utils::int_to_string (i);
      config->open_section (sub_key,
                            stringified,
                            0,
                            desc_key);

      config->get_string_value (desc_key,
                                "name",
                                holder);
      desc_seq[i].name = holder.c_str ();

      config->get_string_value (desc_key,
                                "id",
                                holder);
      desc_seq[i].id = holder.c_str ();

      /// Seems to me that this field should refer to the component
      /// where the port is defined - NOT where the base type is defined.
      config->get_string_value (key,
                                "id",
                                holder);
      desc_seq[i].defined_in = holder.c_str ();

      config->get_string_value (desc_key,
                                "version",
                                holder);
      desc_seq[i].version = holder.c_str ();

      config->get_string_value (desc_key,
                                "base_type",
                                holder);
      TAO_Port_Desc_Seq_Utils<T_desc_seq>::port_base_type (desc_seq,
                                                           holder,
                                                           i);

      TAO_Port_Desc_Seq_Utils<T_desc_seq>::get_is_multiple (desc_seq,
                                                            config,
                                                            desc_key,
                                                            i);
    }
}
开发者ID:binary42,项目名称:OCI,代码行数:72,代码来源:IFR_Service_Utils_T.cpp

示例15: GetIntDefault

int32 Config::GetIntDefault(const char* name, int32 def)
{
    ACE_TString val;
    return GetValueHelper(mConf, name, val) ? atoi(val.c_str()) : def;
}
开发者ID:Ariathies,项目名称:server,代码行数:5,代码来源:Config.cpp


注:本文中的ACE_TString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。