本文整理汇总了C++中wxString::Left方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::Left方法的具体用法?C++ wxString::Left怎么用?C++ wxString::Left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::Left方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnFile
virtual wxDirTraverseResult OnFile(const wxString& filename)
{
if (path+"\\"+item == pathNew.Left(path.Len()))
return wxDIR_CONTINUE;
wxString newFile = filename;
newFile.Replace(path, pathNew);
if (newFile == filename.Left(newFile.Len()))
return wxDIR_CONTINUE;
bool blnCopy = false;
int intCopy = COPY_FILE_OK;
//wxString itemNew (path == pathNew ) "Copy of " + item : item);
if (m_onBeginCopyFile) intCopy = m_onBeginCopyFile(m_parent, filename, newFile);
if (intCopy == COPY_FILE_OK) blnCopy = wxCopyFile(filename, newFile, true);
if (m_onBeginCopyFile) m_onEndCopyFile(m_parent, blnCopy, filename, newFile);
return (intCopy != ABORT_COPY_PROCESS ? wxDIR_CONTINUE : wxDIR_STOP);
}
示例2: ExtractFile
bool CServerPath::ExtractFile(wxString& dir, wxString& file)
{
int pos = dir.find_last_of(traits[m_type].separators);
if (pos == (int)dir.Length() - 1)
return false;
if (pos == -1)
{
file = dir;
dir.clear();
return true;
}
file = dir.Mid(pos + 1);
dir = dir.Left(pos + 1);
return true;
}
示例3: inifile_trim
void inifile_trim( wxString& buffer )
{
buffer.Trim(false); // trims left side.
if( buffer.Length() <= 1 ) // this I'm not sure about... - air
{
buffer.Empty();
return;
}
if( buffer.Left( 2 ) == L"//" )
{
buffer.Empty();
return;
}
buffer.Trim(true); // trims right side.
}
示例4: LocalDirHasParent
bool CState::LocalDirHasParent(const wxString& dir)
{
#ifdef __WXMSW__
if (dir.Left(2) == _T("\\\\"))
{
int pos = dir.Mid(2).Find('\\');
if (pos == -1 || pos + 3 == (int)dir.Len())
return false;
}
if (dir == _T("\\") || dir == _T("//"))
return false;
#endif
if (dir == _T("/"))
return false;
return true;
}
示例5: ProcessMessage
bool CChatSelector::ProcessMessage(uint64 sender_id, const wxString& message)
{
CChatSession* session = GetPageByClientID(sender_id);
// Try to get the name (core sent it?)
int separator = message.Find(wxT("|"));
wxString client_name;
wxString client_message;
if (separator != -1) {
client_name = message.Left(separator);
client_message = message.Mid(separator+1);
} else {
// No need to define client_name. If needed, will be build on tab creation.
client_message = message;
}
bool newtab = !session;
if ( !session ) {
// This must be a mesage from a client that is not already chatting
if (client_name.IsEmpty()) {
// Core did not send us the name.
// This must NOT happen.
// Build a client name based on the ID
uint32 ip = IP_FROM_GUI_ID(sender_id);
client_name = CFormat(wxT("IP: %s Port: %u")) % Uint32toStringIP(ip) % PORT_FROM_GUI_ID(sender_id);
}
session = StartSession( sender_id, client_name, true );
}
// Other client connected after disconnection or a new session
if ( !session->m_active ) {
session->m_active = true;
session->AddText( _("*** Connected to Client ***"), COLOR_RED );
}
// Page text is client name
session->AddText( GetPageText(GetTabByClientID(sender_id)), COLOR_BLUE, false );
session->AddText( wxT(": ") + client_message, COLOR_BLACK );
return newtab;
}
示例6: writeAMBE
void CCCSHandler::writeAMBE(CAMBEData& data, const wxString& dtmf)
{
if (m_state != CS_CONNECTED && m_state != CS_ACTIVE)
return;
if (m_state == CS_CONNECTED) {
if (!dtmf.Left(1U).IsSameAs(wxT("*")))
return;
wxString callsign = findInCache(dtmf.Mid(1U));
if (!callsign.IsEmpty()) {
wxLogMessage(wxT("CCS: New outgoing link to %s/%s from %s"), dtmf.Mid(1U).c_str(), callsign.c_str(), m_myCall1.c_str());
m_handler->ccsLinkMade(callsign);
m_yourCall = callsign;
} else {
wxLogMessage(wxT("CCS: New outgoing link to %s from %s"), dtmf.Mid(1U).c_str(), m_myCall1.c_str());
m_yourCall = dtmf;
}
m_local = m_myCall1;
m_seqNo = 0U;
m_time = ::time(NULL);
m_stateChange = true;
m_state = CS_ACTIVE;
m_direction = DIR_OUTGOING;
m_inactivityTimer.start();
}
CAMBEData temp(data);
CHeaderData& header = temp.getHeader();
header.setMyCall1(m_myCall1);
header.setMyCall2(m_myCall2);
header.setYourCall(m_yourCall);
header.setRptCall1(m_callsign);
header.setRptCall2(m_reflector);
temp.setRptSeq(m_seqNo++);
temp.setDestination(m_ccsAddress, CCS_PORT);
m_protocol.writeData(temp);
}
示例7: SetServer
void COptions::SetServer(wxString path, const CServer& server)
{
if (!m_pXmlFile)
return;
if (path.empty())
return;
TiXmlElement *element = m_pXmlFile->GetElement();
while (!path.empty()) {
wxString sub;
int pos = path.Find('/');
if (pos != -1) {
sub = path.Left(pos);
path = path.Mid(pos + 1);
}
else {
sub = path;
path = _T("");
}
wxScopedCharBuffer utf8 = sub.utf8_str();
if (!utf8)
return;
TiXmlElement *newElement = element->FirstChildElement(utf8);
if (newElement)
element = newElement;
else {
TiXmlNode *node = element->LinkEndChild(new TiXmlElement(utf8));
if (!node || !node->ToElement())
return;
element = node->ToElement();
}
}
::SetServer(element, server);
if (GetOptionVal(OPTION_DEFAULT_KIOSKMODE) == 2)
return;
CInterProcessMutex mutex(MUTEX_OPTIONS);
m_pXmlFile->Save(true);
}
示例8: DidAction
/**
* Process text sent by the server, not users
* Check for vote events, promote events and something else
*/
void ChatPanel::DidAction(const wxString& who, const wxString& action)
{
//Handle vote events in chat by VotePanel
if (m_votePanel != NULL) {
m_votePanel->OnChatAction(who, action);
}
//Look for "promote" notifications from server
CheckForPromotion(who, action);
// change the image of the tab to show new events
SetIconHighlight(highlight_say);
OutputLine(_T( "* " ) + who + _T( " " ) + action, sett().GetChatColorAction());
if (m_type == CPT_User && (ui().GetActiveChatPanel() != this || !wxTheApp->IsActive())) {
const wxString msg = wxString::Format(_T("%s \n%s"), who.c_str(), action.Left(50).c_str());
UiEvents::GetNotificationEventSender().SendEvent(
UiEvents::NotficationData(UiEvents::PrivateMessage, msg));
}
}
示例9: DoDecodePath
wxString StandardPaths::DoDecodePath(wxString path) {
if (!path || path[0] != '?')
return path;
// Split ?part from rest
path.Replace("\\","/");
int pos = path.Find("/");
wxString path1,path2;
if (pos == wxNOT_FOUND) path1 = path;
else {
path1 = path.Left(pos);
path2 = path.Mid(pos+1);
}
// Replace ?part if valid
std::map<wxString,wxString>::iterator iter = paths.find(path1);
if (iter == paths.end()) return path;
wxString final = iter->second + "/" + path2;
final.Replace("//","/");
示例10: BuildCommand
void CommandBuilder::BuildCommand(wxString cmdString)
{
// Find the command name terminator... If there is more than one word and
// no terminator, the command is badly formed
cmdString.Trim(true); cmdString.Trim(false);
int splitAt = cmdString.Find(wxT(':'));
if (splitAt < 0 && cmdString.Find(wxT(' ')) >= 0) {
mError = wxT("Command is missing ':'");
ScriptCommandRelay::SendResponse(wxT("\n"));
mValid = false;
return;
}
wxString cmdName = cmdString.Left(splitAt);
wxString cmdParams = cmdString.Mid(splitAt+1);
cmdName.Trim(true);
cmdParams.Trim(false);
BuildCommand(cmdName, cmdParams);
}
示例11: processDPlus
wxString CDTMF::processDPlus(const wxString& command) const
{
unsigned int len = command.Len();
if (len < 2U || len > 4U)
return wxEmptyString;
unsigned long n;
command.Left(len - 1U).ToULong(&n);
if (n == 0UL)
return wxEmptyString;
wxChar c = command.GetChar(len - 1U);
if (c != wxT('A') && c != wxT('B') && c != wxT('C') && c != wxT('D'))
return wxEmptyString;
wxString out;
out.Printf(wxT("REF%03lu%cL"), n, c);
return out;
}
示例12: SetServer
void COptions::SetServer(wxString path, const CServer& server)
{
if (!m_pXmlFile)
return;
if (path.empty())
return;
auto element = m_pXmlFile->GetElement();
while (!path.empty()) {
wxString sub;
int pos = path.Find('/');
if (pos != -1) {
sub = path.Left(pos);
path = path.Mid(pos + 1);
}
else {
sub = path;
path = _T("");
}
wxScopedCharBuffer utf8 = sub.utf8_str();
if (!utf8)
return;
auto newElement = element.child(utf8);
if (newElement)
element = newElement;
else {
element = element.append_child(utf8);
}
}
::SetServer(element, server);
if (GetOptionVal(OPTION_DEFAULT_KIOSKMODE) == 2)
return;
CInterProcessMutex mutex(MUTEX_OPTIONS);
m_pXmlFile->Save(true);
}
示例13: SetNMEASentence
void nmeaSendObj::SetNMEASentence(wxString &sentence)
{
unsigned int i = 0;
while ( i < NeededSentences.GetCount() )
{
wxString s = sentence.Left( NeededSentences[i].Length() );
if ( s.Matches(NeededSentences[i]) ) //we have a wildcard match
{
ReceivedSentencesMap[NeededSentences[i]] = sentence; //save sentence
int j = NeededSentencesMinusReceived.Index(NeededSentences[i]);
if ( j != wxNOT_FOUND ){//!= wxNOT_FOUND )
NeededSentencesMinusReceived.RemoveAt(j);
}
}
i++;
}
if ( NeededSentencesMinusReceived.IsEmpty() & ( SendMode == ALLVAL) )
{
ComputeOutputSentence();
NeededSentencesMinusReceived = NeededSentences;
}
}
示例14: GetLine
// old function which only chops '\n' and not '\r\n'
wxProtocolError GetLine(wxSocketBase *sock, wxString& result)
{
#define PROTO_BSIZE 2048
size_t avail, size;
char tmp_buf[PROTO_BSIZE], tmp_str[PROTO_BSIZE];
char *ret;
bool found;
avail = sock->Read(tmp_buf, PROTO_BSIZE).LastCount();
if (sock->Error() || avail == 0)
return wxPROTO_NETERR;
memcpy(tmp_str, tmp_buf, avail);
// Not implemented on all systems
// ret = (char *)memccpy(tmp_str, tmp_buf, '\n', avail);
found = false;
for (ret=tmp_str;ret < (tmp_str+avail); ret++)
if (*ret == '\n')
{
found = true;
break;
}
if (!found)
return wxPROTO_PROTERR;
*ret = 0;
result = wxString::FromAscii( tmp_str );
result = result.Left(result.length()-1);
size = ret-tmp_str+1;
sock->Unread(&tmp_buf[size], avail-size);
return wxPROTO_NOERR;
#undef PROTO_BSIZE
}
示例15: OpenInFileManager
bool OpenInFileManager(const wxString& dir)
{
bool ret = false;
#ifdef __WXMSW__
// Unfortunately under Windows, UTF-8 encoded file:// URLs don't work, so use native paths.
// Unfortunatelier, we cannot use this for UNC paths, have to use file:// here
// Unfortunateliest, we again have a problem with UTF-8 characters which we cannot fix...
if (dir.Left(2) != _T("\\\\") && dir != _T("/"))
ret = wxLaunchDefaultBrowser(dir);
else
#endif
{
wxString url = GetAsURL(dir);
if (!url.IsEmpty())
ret = wxLaunchDefaultBrowser(url);
}
if (!ret)
wxBell();
return ret;
}