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


C++ wxString::ToULong方法代码示例

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


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

示例1: CalcThreadMomentum

/**
 * スレッドの勢い値を計算する
 * 勢い=書き込み数÷(スレが立ってからの秒数÷86400)
 * @param itemResponse レス数
 * @param itemOid      スレがたった時間を表すUNIX Time
 * @return momentum    勢い
 */
wxString XrossBoardUtil::CalcThreadMomentum(wxString& itemResponse, wxString& itemOid) {

     unsigned long response;
     unsigned long oid;
     unsigned long now;
     itemResponse.ToULong(&response);
     itemOid.ToULong(&oid);
     now = ::wxGetUTCTime();

     // レス数が1の場合勢い値は1
     if (response == 1) return wxT("1.0");

     // 勢い値の計算
     try {
	  double elapsed = now - oid;
	  double momentum = response / elapsed * 86400;
	  return wxString::Format(wxT("%.1f"), momentum);

     } catch (std::range_error& e) {
	  return wxT("std::range_error");
     } catch (std::overflow_error& e) {
	  return wxT("std::overflow_error");
     } catch (std::underflow_error& e) {
	  return wxT("std::underflow_error");
     }
}
开发者ID:gitter-badger,项目名称:XrossBoard,代码行数:33,代码来源:xrossboardutil.cpp

示例2: SetPortName

bool wxSockAddressImpl::SetPortName(const wxString& name, const char *protocol)
{
    // test whether it's a number first
    unsigned long port;
    if ( name.ToULong(&port) )
    {
        if ( port > 65535 )
            return false;
    }
    else // it's a service name
    {
        wxGetservBuf buffer;
        servent se;
        if ( !wxGetservbyname_r(name.utf8_str(), protocol, &se,
                                buffer, sizeof(buffer)) )
            return false;

        // s_port is in network byte order and SetPort() uses the host byte
        // order and we prefer to reuse it from here instead of assigning to
        // sin_port directly
        port = ntohs(se.s_port);
    }

    return SetPort(port);
}
开发者ID:FuTingyan,项目名称:wxWidgets,代码行数:25,代码来源:sckaddr.cpp

示例3: EditRegister

void RegRichTextCtrl::EditRegister( const char *RegNames, const wxString &value )
{
	unsigned long tmp;
	value.ToULong(&tmp, 16);

	wxString newStr = wxGetTextFromUser(RegNames, wxT("Edit register value"),
				wxString::Format(wxT("%X"), tmp), this);

	// if user press cancel then newStr will be empty
	if (!newStr.empty())
	{
		Context ctx;
		trc_get_thread_ctx(m_sesId, m_tid, &ctx);

		newStr.ToULong(&tmp, 16);

		WhatBasicRegister(RegNames, tmp, ctx);

		// TODO: to complete output for all warnings and errors to wxLog
		if (0 == trc_set_thread_ctx(m_sesId, m_tid, &ctx) )
			wxLogError(wxString(wxT("Can't set ")) + RegNames + wxString(wxT(" value")));
		Context ctx_new;
		if (0 == trc_get_thread_ctx(m_sesId, m_tid, &ctx_new) )
			wxLogError(wxString(wxT("Can't get ")) + RegNames + wxString(wxT(" value")));

		OutputBasic(ctx_new);
	}
}
开发者ID:bizdon,项目名称:opendbg,代码行数:28,代码来源:regframe.cpp

示例4: Connect

bool Camera_DSIClass::Connect(const wxString& camId)
{
    bool retval = false;

    if (!MeadeCam)
        MeadeCam = new DsiDevice();

    unsigned int NDevices = MeadeCam->EnumDsiDevices();
    if (!NDevices) {
        wxMessageBox(_T("No DSIs found"), _("Error"));
        return true;
    }

    unsigned long DevNum = 0;
    if (camId == DEFAULT_CAMERA_ID)
        DevNum = 1;
    else
        camId.ToULong(&DevNum);

    if (DevNum < 1 || DevNum > NDevices)
    {
        Debug.AddLine(wxString::Format("DSI: invalid camera id: '%s', ncams = %u", camId, NDevices));
        return true;
    }

    retval = !(MeadeCam->Open(DevNum));
//  wxMessageBox(wxString::Format("Color: %d\n%u x %u",
//      MeadeCam->IsColor,MeadeCam->GetWidth(),MeadeCam->GetHeight()));
    if (!retval) {
        FullSize = wxSize(MeadeCam->GetWidth(),MeadeCam->GetHeight());
//      wxMessageBox(wxString::Format("%s\n%s (%d)\nColor: %d\n-II: %d\n%u x %u",MeadeCam->CcdName,MeadeCam->ModelName, MeadeCam->ModelNumber,
//          MeadeCam->IsColor,MeadeCam->IsDsiII, FullSize.GetWidth(), FullSize.GetHeight()) + "\n" + MeadeCam->ErrorMessage);
//      wxMessageBox(wxString::Format("%s\n%s (%d)\nColor: %d\n-USB2: %d\n%u x %u",MeadeCam->CcdName,MeadeCam->ModelName, MeadeCam->ModelNumber,
//                                    MeadeCam->IsColor,MeadeCam->IsUSB2, FullSize.GetWidth(), FullSize.GetHeight()) + "\n" + MeadeCam->ErrorMessage);
        MeadeCam->Initialize();
        MeadeCam->SetHighGain(true);
        if (!MeadeCam->IsDsiIII) MeadeCam->SetDualExposureThreshold(501);
        else MeadeCam->SetBinMode(1);

        MeadeCam->SetOffset(255);
        MeadeCam->SetFastReadoutSpeed(true);
        Connected = true;
        // Set the PixelSize property for cients.  If the pixels aren't square, use the smaller dimension because the image
        // is "squared up" by scaling to the smaller dimension
        if (MeadeCam->IsDsiIII)
            PixelSize = 6.6;
        else
        if (MeadeCam->IsDsiII)
            PixelSize = 8.3;
        else
            PixelSize = 7.5;

    }

    return retval;
}
开发者ID:knro,项目名称:phd2,代码行数:56,代码来源:cam_MeadeDSI.cpp

示例5: GetNumFilesFromText

    // Return the number of files handling special value "many". Notice that
    // the returned value is signed to allow using it in subtraction above.
    int GetNumFilesFromText(const wxString& text) const
    {
        unsigned long n;
        if ( !text.ToULong(&n) )
        {
            if ( text == "many" )
                n = 9999;
            else
                n = 0;
        }

        return n;
    }
开发者ID:ruifig,项目名称:nutcracker,代码行数:15,代码来源:treelist.cpp

示例6:

void wxSMTP::HeloState::onResponse(wxCmdlineProtocol& context, const wxString& line) const
{
   /* Extract smpt code */
   unsigned long smtpCode = 0;
   line.ToULong(&smtpCode);

   /* Check if command was successful */
   if (smtpCode == 250)
   {
      /* Check if this is the last answer */
      if (line.StartsWith(wxT("250-")))
      {
		  if (line.StartsWith(wxT("250-AUTH"))) {
				((wxSMTP&)context).authentication_line = line;
		  }
         /* We shall wait next acceptance answer... */

      }
      else
      {
         if (((wxSMTP&)context).shall_enter_ssl)
         {
            context.ChangeState(g_startTlsState);
         }
         else
         {
            if (((wxSMTP&)context).authentication_scheme == wxSMTP::NoAuthentication)
            {
               context.ChangeState(g_sendMailFromState);
            }
            else
            {
               context.ChangeState(g_authenticateState);
            }
         }
      }
   }
   else
   {
      if ((smtpCode >= 400) && (smtpCode < 500))
      {
         ((wxSMTP&)context).disconnection_status = Listener::StatusRetry;
      }
      else
      {
         ((wxSMTP&)context).disconnection_status = Listener::StatusError;
      }
      context.ChangeState(g_quitState);
   }
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:50,代码来源:wxsmtpstates.cpp

示例7: ParseUrl

bool CServer::ParseUrl(wxString host, const wxString& port, wxString user, wxString pass, wxString &error, CServerPath &path)
{
	unsigned long nPort = 0;
	if (!port.empty())
	{
		if (port.size() > 5 || !port.ToULong(&nPort) || !nPort || nPort > 65535)
		{
			error = _("Invalid port given. The port has to be a value from 1 to 65535.");
			error += _T("\n");
			error += _("You can leave the port field empty to use the default port.");
			return false;
		}
	}
	return ParseUrl(host, nPort, user, pass, error, path);
}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:15,代码来源:server.cpp

示例8: processCCS

wxString CDTMF::processCCS(const wxString& command) const
{
	unsigned int len = command.Len();

	if (len != 4U)
		return wxEmptyString;

	unsigned long n;
	command.ToULong(&n);
	if (n == 0UL)
		return wxEmptyString;

	wxString out;
	out.Printf(wxT("CCS*%04lu"), n);

	return out;
}
开发者ID:OZ1BV,项目名称:DMRRepeater,代码行数:17,代码来源:DTMF.cpp

示例9: if

void wxSMTP::AuthenticateState::onResponse(wxCmdlineProtocol& context, const wxString& line) const
{
   /* Extract smpt code */
   unsigned long smtpCode = 0;
   line.ToULong(&smtpCode);

   /* Check if we alreadysent authentication scheme */
   if (((wxSMTP&)context).authentication_digest_sent)
   {
      /* Check if server acknowledged connection */
      if (smtpCode == 235)
      {
         context.ChangeState(g_sendMailFromState);
      }
      else if (smtpCode == 535)
      {
         ((wxSMTP&)context).disconnection_status = Listener::StatusInvalidUserNamePassword;
         context.ChangeState(g_quitState);
      }
      else
      {
         ((wxSMTP&)context).disconnection_status = Listener::StatusError;
         context.ChangeState(g_quitState);
      }
   }
   else
   {
      /* check is server accepted command */
      if (smtpCode == 334)
      {
         /* Extract digest and send answer */
         context.SendLine(((wxSMTP&)context).ComputeAuthenticationDigest(line.AfterFirst(' ')));
      }
      else
      {
         ((wxSMTP&)context).disconnection_status = Listener::StatusError;
         context.ChangeState(g_quitState);
      }
   }
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:40,代码来源:wxsmtpstates.cpp

示例10: cbDebuggerStringToAddress

uint64_t cbDebuggerStringToAddress(const wxString &address)
{
    if (address.empty())
        return 0;
#if defined(__WXMSW__)
    // Workaround for the 'ToULongLong' bug in wxWidgets 2.8.12
#if wxCHECK_VERSION(2, 8, 12)
    return strtoull(address.mb_str(), nullptr, 16);
#else
    uint64_t result;
    if (address.ToULongLong(&result))
        return result;
    else
        return 0;
#endif // wxCHECK_VERSION
#else
    uint64_t result;
    if (address.ToULong(&result, 16))
        return result;
    else
        return 0;
#endif
}
开发者ID:plee3,项目名称:codeblocks_sf,代码行数:23,代码来源:debuggermanager.cpp

示例11: processCCS

wxString CDTMF::processCCS(const wxString& command) const
{
	unsigned int len = command.Len();

	unsigned long n;
	command.ToULong(&n);
	if (n == 0UL)
		return wxEmptyString;

	wxString out = wxEmptyString;

	switch (len) {
		case 4U:
			out.Printf(wxT("CCS*%04lu"), n);
			break;
		case 5U:
			out.Printf(wxT("CCS*%05lu"), n);
			break;
		default:
			break;
	}

	return out;
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:24,代码来源:DTMF.cpp

示例12: Set_baud

int Serial::Set_baud(const wxString& baud_str)
{
	unsigned long b;
	if (!baud_str.ToULong(&b)) return -1;
	return Set_baud((int)b);
}
开发者ID:RDju,项目名称:knobot_soft,代码行数:6,代码来源:serial.cpp

示例13: while

void wxSMTP::SendMailFromState::onResponse(wxCmdlineProtocol& context, const wxString& line) const
{
   /* Extract smpt code */
   unsigned long smtpCode = 0;
   line.ToULong(&smtpCode);

   /* Check if command was successful */
   if (smtpCode == 250)
   {
      context.ChangeState(g_rcptListState);
   }
   else
   {
      if ((smtpCode >= 400) && (smtpCode < 500))
      {
         ((wxSMTP&)context).disconnection_status = Listener::StatusRetry;
         context.ChangeState(g_quitState);
      }
      else
      {
         /* Message has been rejected -> trigger callback */
         bool shall_retry;
         bool shall_stop;
         unsigned long retry_delay;
         ((wxSMTP&)context).m_pListener->OnMessageStatus(((wxSMTP&)context).messages_to_send.front().GetMessageId(),
                                                         Listener::SendingMessageRejected,
                                                         ((wxSMTP&)context).messages_to_send.size()-1,
                                                         ((wxSMTP&)context).GetNbRetryMessages(),
                                                         std::list<wxEmailMessage::Address>(),
                                                         std::list<wxEmailMessage::Address>(),
                                                         true,
                                                         shall_retry,
                                                         retry_delay,
                                                         shall_stop);

         /* Check if we shall retry sending process */
         if (shall_retry)
         {
            /* Format retry element */
            RetryInfo_t retry_info;
            retry_info.message = ((wxSMTP&)context).messages_to_send.front();
            retry_info.is_reconnection = false;
            retry_info.retry_time = wxDateTime::Now() + wxTimeSpan::Seconds(retry_delay);

            /* Search place where it will be inserted */
            std::list<RetryInfo_t>::iterator it = ((wxSMTP&)context).retry_messages_list.begin();
            while ((it != ((wxSMTP&)context).retry_messages_list.end()) &&
                   (it->retry_time < retry_info.retry_time))
            {
               it++;
            }
            ((wxSMTP&)context).retry_messages_list.insert(it, retry_info);
         }

         /* Remove it from messages list */
         ((wxSMTP&)context).messages_to_send.pop_front();

         /* Check if we shall stop */
         if (shall_stop)
         {
            ((wxSMTP&)context).disconnection_status = Listener::StatusUserAbort;
            context.ChangeState(g_quitState);
         }
         else
         {
            context.ChangeState(g_sendMailFromState);
         }
      }
   }
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:70,代码来源:wxsmtpstates.cpp

示例14:

static u32 StrToU32(const wxString& str, int base = 10)
{
    unsigned long l;
    str.ToULong(&l, base);
    return l;
}
开发者ID:BradleyKarkanen,项目名称:pcsx2,代码行数:6,代码来源:Patch.cpp

示例15: WxStrToUL

unsigned long WxStrToUL(const wxString& str)
{
  unsigned long value = 0;
  str.ToULong(&value);
  return value;
}
开发者ID:DINKIN,项目名称:dolphin,代码行数:6,代码来源:WxUtils.cpp


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