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


C++ ACE_TString::length方法代码示例

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


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

示例1: GetProperty

    bool GetProperty(const mstrings_t& properties, 
        const ACE_TString& prop, std::vector<int>& vec)
    {
        ACE_TString value;
        mstrings_t::const_iterator ite = properties.find(prop);
        if( ite != properties.end() )
        {
            value = (*ite).second;
            ACE_TString token;
            size_t offset = 0;
            size_t i = value.find(',', offset);//Tokenize(ACE_TEXT(","),offset);
            while(i != ACE_TString::npos)
            {
                token = value.substr(offset, i-offset);
                offset = i+1;
                vec.push_back(int(string2i(token)));
                i = value.find(',', offset);

            }
            if( value.length() && (value.length() - 1) >= offset )
            {
                token = value.substr(offset, value.length()-offset);
                offset = i+1;
                vec.push_back(int(string2i(token)));
            }
            return true;
        }
        return false;
    }
开发者ID:BearWare,项目名称:TeamTalk5,代码行数:29,代码来源:Commands.cpp

示例2: stripEOL

 ACE_TString stripEOL(const ACE_TString& input)
 {
     size_t len = ACE_OS::strlen(EOL);
     if(input.length()<len)
         return input;
     if(input.substr(input.length()-len,len) == EOL)
         return input.substr(0,input.length()-len);
     else if(input.substr(input.length()-1,1) == ACE_TEXT("\n"))
         return input.substr(0,input.length()-1);
     return input;
 }
开发者ID:BearWare,项目名称:TeamTalk5,代码行数:11,代码来源:Commands.cpp

示例3: sub_id_str

int
SubDriver::parse_sub_arg(const ACE_TString& arg)
{
  DBG_ENTRY("SubDriver","parse_sub_arg");

  size_t pos;

  // Find the first ':' character, and make sure it is in a legal spot.
  if ((pos = std::find(arg.c_str(), arg.c_str() + arg.length(), ACE_TEXT(':')) - arg.c_str()) == arg.length()) {
    ACE_ERROR((LM_ERROR,
               "(%P|%t) Bad -p command-line value (%s). Missing ':' char.\n",
               arg.c_str()));
    return -1;
  }

  if (pos == 0) {
    ACE_ERROR((LM_ERROR,
               "(%P|%t) Bad -p command-line value (%s). "
               "':' char cannot be first char.\n",
               arg.c_str()));
    return -1;
  }

  if (pos == (arg.length() - 1)) {
    ACE_ERROR((LM_ERROR,
               "(%P|%t) Bad -p command-line value  (%s) - "
               "':' char cannot be last char.\n",
               arg.c_str()));
    return -1;
  }

  // Parse the sub_id from left of ':' char, and remainder to right of ':'.
  ACE_TString sub_id_str(arg.c_str(), pos);
  this->sub_addr_str_ = arg.c_str() + pos + 1;

  // RepoIds are conventionally created and managed by the DCPSInfoRepo. Those
  // generated here are for the sole purpose of verifying internal behavior.
  OpenDDS::DCPS::RepoIdBuilder builder(sub_id_);

  builder.participantId(1);
  builder.entityKey(ACE_OS::atoi(sub_id_str.c_str()));
  builder.entityKind(OpenDDS::DCPS::ENTITYKIND_USER_WRITER_WITH_KEY);

  // Use the remainder as the "stringified" ACE_INET_Addr.
  this->sub_addr_ = ACE_INET_Addr(this->sub_addr_str_.c_str());

  return 0;
}
开发者ID:AndroidDev77,项目名称:OpenDDS,代码行数:48,代码来源:SubDriver.cpp

示例4: OnInitDialog

BOOL CSelectNSDialog::OnInitDialog()
{
  CDialog::OnInitDialog();

  // TODO: Add extra initialization here
  HKEY hKey = ACE_Configuration_Win32Registry::resolve_key(HKEY_LOCAL_MACHINE, ACE_TEXT("Software\\TAO\\NamingViewer\\Servers"));
  m_pConfig = new ACE_Configuration_Win32Registry(hKey);
  ACE_Configuration_Section_Key Section = m_pConfig->root_section();;
  int index = 0;
  ACE_TString name;
  ACE_Configuration::VALUETYPE type;
  while(m_pConfig->enumerate_values(Section, index, name, type) == 0)
  {
    ACE_TString value;
    if(m_pConfig->get_string_value(Section, name.c_str(), value) == 0)
    {
      int pos = m_Servers.AddString(name.c_str());
      ACE_TCHAR* pIOR = new ACE_TCHAR[value.length() + 1];
      ACE_OS::strcpy(pIOR, value.c_str());
      m_Servers.SetItemData(pos, (DWORD)pIOR);
    }
    ++index;
  }

  return TRUE;  // return TRUE unless you set the focus to a control
  // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:asdlei00,项目名称:ACE,代码行数:27,代码来源:SelectNSDialog.cpp

示例5: deinitStream

void LameMP3::Close()
{
    if(!m_hMp3Stream)
        return;

    DWORD outLen = 0;
    int err = deinitStream(m_hMp3Stream, &m_out_mp3data[0], &outLen);
    assert(err == 0);
    if(outLen)
        m_outfile.send((const char*)&m_out_mp3data[0], outLen);

    ACE_TString filename = GetFileName();
    
    closeStream(m_hMp3Stream);
    
    m_outfile.close();
    
    if(filename.length())
    {
#if defined(UNICODE)
        //LAME doesn't support Unicode, so we just convert to locale
        //and hope for the best
        ACE_CString ascii = UnicodeToLocal(filename.c_str());
        err = writeInfoTag(m_hMp3Stream, ascii.c_str());
#else
        err = writeInfoTag(m_hMp3Stream, filename.c_str());
#endif
    }
    m_out_mp3data.resize(0);
    m_hMp3Stream = 0;
}
开发者ID:BearWare,项目名称:TeamTalk5,代码行数:31,代码来源:LameMP3.cpp

示例6: ResolveKey

void ConfigTreeCtrl::ResolveKey(wxTreeItemId Item, ACE_Configuration_Section_Key& Key)
{
  wxTreeItemId OriginalItem = Item;
  ACE_TString Path("");
  ACE_TString Temp;
  while(Item != GetRootItem())
  {
    wxString Text = GetItemText(Item);
    Temp = Path;
    Path = Text.c_str();
    if(Temp.length())
    {
      Path += "\\";
      Path += Temp;
    }
    Item = GetParent(Item);
  }
  if(Path.length())
  {
    m_pConfig->expand_path(m_pConfig->root_section(), Path, Key, 0);
  }
  else
  {
    Key = m_pConfig->root_section();
  }
}
开发者ID:CCJY,项目名称:ACE,代码行数:26,代码来源:ConfigTreeCtrl.cpp

示例7: pastBlanks

 size_t pastBlanks(size_t offset, const ACE_TString& input)
 {
     while(offset<input.length() && 
         (input[offset] == ' ' ||
         input[offset] == '\r' ||
         input[offset] == '\n')) offset ++;
     return offset;
 }
开发者ID:BearWare,项目名称:TeamTalk5,代码行数:8,代码来源:Commands.cpp

示例8: make_new_subdir

Directory::Ptr Directory::make_new_subdir(const ACE_TString& t_name)
{
  if (files_.find(t_name) != files_.end()) {
    throw std::runtime_error("Can't create a directory with the same "
                             "name as an existing file.");
  }

  ACE_TString logical(t_name.c_str(),
                      (std::min)(FSS_MAX_FILE_NAME, t_name.length()));
  ACE_TString phys_prefix = add_entry();
  ACE_TString phys_base = b32h_encode(logical.c_str());

  if (t_name.length() >= FSS_MAX_FILE_NAME) {
    unsigned int& counter = long_names_[phys_prefix + phys_base];

    if (counter == 99999) {
      throw std::runtime_error("Long directory name out of range");
    }

    phys_base += ACE_TEXT(".     X"); // snprintf will clobber the X with a 0
    ACE_TCHAR* buf = &phys_base[0] + phys_base.length() - 6;
    ACE_OS::snprintf(buf, 6, ACE_TEXT("%05u"), counter++);
    phys_base = phys_base.substr(0, phys_base.length() - 1); // trim the 0
  }

  ACE_TString phys = phys_prefix + phys_base;
  dirs_[t_name] = phys;
  {
    CwdGuard cg(physical_dirname_);

    if (dds_mkdir(phys.c_str()) == -1) {
      throw std::runtime_error("Can't create directory");
    }

    if ((phys_prefix.length() > 0 && dds_chdir(phys_prefix.c_str()) == -1)
        || dds_chdir(phys_base.c_str()) == -1) {
      dds_rmdir(phys.c_str());
      throw std::runtime_error("Can't change to newly created directory");
    }

    std::ofstream fn("_fullname");
    fn << t_name << '\n';
  }
  return new Directory(physical_dirname_ + phys, t_name, this);
}
开发者ID:binary42,项目名称:OCI,代码行数:45,代码来源:FileSystemStorage.cpp

示例9: tmp

int
BE_save_orb_args (int &argc, ACE_TCHAR *argv[])
{
  int i = 1;
  ACE_TString holder;

  while (i < argc)
    {
      if (ACE_OS::strncmp (argv[i], ACE_TEXT("-ORB"), 4) == 0)
        {
          holder += ACE_TString (argv[i]);
          holder += ACE_TEXT(" ");

          // Could be another -ORBxxx arg or an IDL compiler arg.
          if (*argv[i + 1] == '-')
            {
              ++i;
              continue;
            }

          // No-copy constructor.
          ACE_TString tmp (argv[i + 1],
                           0,
                           false);

          // If the arg ends with either .idl or .pidl, we're done.

          size_t len = tmp.length ();
          ssize_t pos = tmp.find (ACE_TEXT(".idl"));

          if (len - pos == 4)
            {
              return 0;
            }

          pos = tmp.find (ACE_TEXT(".pidl"));

          if (len - pos == 5)
            {
              return 0;
            }

          // If we're here, the next arg goes with the preceding -ORBxxx.
          holder += tmp;
          holder += ACE_TEXT(" ");
          i += 2;
        }
      else
        {
          ++i;
        }
    }

  be_global->orb_args (ACE_TEXT_ALWAYS_CHAR(holder.c_str()));

  return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:57,代码来源:be_init.cpp

示例10: pub_id_str

int
SubDriver::parse_pub_arg(const ACE_TString& arg)
{
  size_t pos;

  // Find the first ':' character, and make sure it is in a legal spot.
  if ((pos = std::find(arg.c_str(), arg.c_str() + arg.length(), ACE_TEXT(':')) - arg.c_str()) == arg.length()) {
    ACE_ERROR((LM_ERROR,
               "(%P|%t) Bad -p command-line value (%s). Missing ':' char.\n",
               arg.c_str()));
    return -1;
  }

  if (pos == 0) {
    ACE_ERROR((LM_ERROR,
               "(%P|%t) Bad -p command-line value (%s). "
               "':' char cannot be first char.\n",
               arg.c_str()));
    return -1;
  }

  if (pos == (arg.length() - 1)) {
    ACE_ERROR((LM_ERROR,
               "(%P|%t) Bad -p command-line value  (%s) - "
               "':' char cannot be last char.\n",
               arg.c_str()));
    return -1;
  }

  // Parse the pub_id from left of ':' char, and remainder to right of ':'.
  ACE_TString pub_id_str(arg.c_str(), pos);
  this->pub_addr_str_ = arg.c_str() + pos + 1;

  this->pub_id_fname_ = pub_id_str.c_str();
  this->pub_addr_ = ACE_INET_Addr(this->pub_addr_str_.c_str());

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

示例11: buildIORList

// Read in the stringified object references into an array
// Warning: The file may contain many separate IORs separated by linefeeds.
void TestClient::buildIORList()
{
  FILE* iorFile = ACE_OS::fopen (iorFile_, "r");
  if ( iorFile == 0 )
    ACE_ERROR ((LM_ERROR, "Fail to open %s\n", iorFile_));

  ACE_TString ior;
  while (getline(iorFile, ior) != EOF )
  {
    if (ior.length() > 0)
      iors_.push_back(ior);
    else
      break;
  }
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:17,代码来源:TestClient.cpp

示例12: PrepareString

    ACE_TString PrepareString(const ACE_TString& str)
    {
        ACE_TString newstr;
        if(str.length()>MAX_STRING_LENGTH)
            newstr = str.substr(0, MAX_STRING_LENGTH);
        else
            newstr = str;

        replace_all(newstr, ACE_TEXT("\\"), ACE_TEXT("\\\\"));
        replace_all(newstr, ACE_TEXT("\""), ACE_TEXT("\\\""));
        replace_all(newstr, ACE_TEXT("\r"), ACE_TEXT("\\r"));
        replace_all(newstr, ACE_TEXT("\n"), ACE_TEXT("\\n"));

        return newstr;
    }
开发者ID:BearWare,项目名称:TeamTalk5,代码行数:15,代码来源:Commands.cpp

示例13: while

int
ACE_Capabilities::getline (FILE *fp, ACE_TString &line)
{
  int ch;

  line.set (0, 0);

  while ((ch = ACE_OS::fgetc (fp)) != EOF && ch != ACE_TEXT ('\n'))
    line += (ACE_TCHAR) ch;

  if (ch == EOF && line.length () == 0)
    return -1;
  else
    return 0;
}
开发者ID:Sanzzes,项目名称:wopc-core,代码行数:15,代码来源:Capabilities.cpp

示例14: OnAdd

void CSelectNSDialog::OnAdd()
{
  // TODO: Add your control notification handler code here
  CAddNameServerDlg Dialog;
  if(Dialog.DoModal() != IDOK)
  {
    return;
  }
  ACE_Configuration_Section_Key Section = m_pConfig->root_section();
  ACE_TString Value = Dialog.m_IOR;
  m_pConfig->set_string_value(Section, Dialog.m_Name, Value);
  int pos = m_Servers.AddString(Dialog.m_Name);
  ACE_TCHAR* pIOR = new ACE_TCHAR[Value.length() + 1];
  ACE_OS::strcpy(pIOR, Value.c_str());
  m_Servers.SetItemData(pos, (DWORD)pIOR);

}
开发者ID:asdlei00,项目名称:ACE,代码行数:17,代码来源:SelectNSDialog.cpp

示例15: sub_section

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;
//.........这里部分代码省略.........
开发者ID:SakhWoW,项目名称:blizzlikecore,代码行数:101,代码来源:Configuration_Import_Export.cpp


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