这篇教程C++ wxStringBuffer函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wxStringBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ wxStringBuffer函数的具体用法?C++ wxStringBuffer怎么用?C++ wxStringBuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wxStringBuffer函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _pop LogPacket _pop() { LogPacket ret; u32 c_get = m_get; const u32& sprefix = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); if(sprefix) memcpy(wxStringBuffer(ret.m_prefix, sprefix), &m_buffer[c_get], sprefix); c_get += sprefix; const u32& stext = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); if(stext) memcpy(wxStringBuffer(ret.m_text, stext), &m_buffer[c_get], stext); c_get += stext; const u32& scolour = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); if(scolour) memcpy(wxStringBuffer(ret.m_colour, scolour), &m_buffer[c_get], scolour); c_get += scolour; m_get = c_get; if(!HasNewPacket()) Flush(); return ret; }
开发者ID:252525fb,项目名称:rpcs3,代码行数:26,
示例2: WXUNUSEDbool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *WXUNUSED_IN_WINCE(pData)){#ifndef __WXWINCE__ m_filenames.Empty(); // the documentation states that the first member of DROPFILES structure is // a "DWORD offset of double NUL terminated file list". What they mean by // this (I wonder if you see it immediately) is that the list starts at // ((char *)&(pDropFiles.pFiles)) + pDropFiles.pFiles. We're also advised // to use DragQueryFile to work with this structure, but not told where and // how to get HDROP. HDROP hdrop = (HDROP)pData; // NB: it works, but I'm not sure about it // get number of files (magic value -1) UINT nFiles = ::DragQueryFile(hdrop, (unsigned)-1, NULL, 0u); wxCHECK_MSG ( nFiles != (UINT)-1, FALSE, wxT("wrong HDROP handle") ); // for each file get the length, allocate memory and then get the name wxString str; UINT len, n; for ( n = 0; n < nFiles; n++ ) { // +1 for terminating NUL len = ::DragQueryFile(hdrop, n, NULL, 0) + 1; UINT len2 = ::DragQueryFile(hdrop, n, wxStringBuffer(str, len), len); m_filenames.Add(str); if ( len2 != len - 1 ) { wxLogDebug(wxT("In wxFileDropTarget::OnDrop DragQueryFile returned/ %d characters, %d expected."), len2, len - 1); } }
开发者ID:hazeeq090576,项目名称:wxWidgets,代码行数:34,
示例3: wxGetWindowClasswxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd){ wxString str; if ( hWnd ) { int len = 256; // some starting value for ( ;; ) { int count = ::GetClassName((HWND)hWnd, wxStringBuffer(str, len), len); if ( count == len ) { // the class name might have been truncated, retry with larger // buffer len *= 2; } else { break; } } } return str;}
开发者ID:JessicaWhite17,项目名称:wxWidgets,代码行数:27,
示例4: wxGetEnvbool wxGetEnv(const wxString& WXUNUSED_IN_WINCE(var), wxString *WXUNUSED_IN_WINCE(value)){#ifdef __WXWINCE__ // no environment variables under CE return false;#else // Win32 // first get the size of the buffer DWORD dwRet = ::GetEnvironmentVariable(var.t_str(), NULL, 0); if ( !dwRet ) { // this means that there is no such variable return false; } if ( value ) { (void)::GetEnvironmentVariable(var.t_str(), wxStringBuffer(*value, dwRet), dwRet); } return true;#endif // WinCE/32}
开发者ID:jonfoster,项目名称:wxWidgets,代码行数:25,
示例5: wxTvoid ReportDialog::OnButtonSave(wxCommandEvent& event){ wxFileDialog dialog ( this, wxT("Spara rapport"), wxEmptyString, wxT("TPTest5 rapport.txt"), wxT("Text files (*.txt)|*.txt"), wxSAVE | wxOVERWRITE_PROMPT | wxCHANGE_DIR ); wxString dir;#ifdef WIN32 HRESULT result = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, wxStringBuffer(dir, MAX_PATH)); if(SUCCEEDED(result)) // or FAILED(result) { // Do something } #endif dialog.SetDirectory(dir); if (dialog.ShowModal() == wxID_OK) { wxFileOutputStream output( dialog.GetPath() ); wxTextOutputStream text( output ); text.WriteString( m_Output->GetValue() ); }}
开发者ID:stein1,项目名称:bbk,代码行数:31,
示例6: wxStrcpyvoid StringTestCase::StringBuf(){ // check that buffer can be used to write into the string wxString s; wxStrcpy(wxStringBuffer(s, 10), wxT("foo")); CPPUNIT_ASSERT_EQUAL(3, s.length()); CPPUNIT_ASSERT(wxT('f') == s[0u]); CPPUNIT_ASSERT(wxT('o') == s[1]); CPPUNIT_ASSERT(wxT('o') == s[2]); { // also check that the buffer initially contains the original string // contents wxStringBuffer buf(s, 10); CPPUNIT_ASSERT_EQUAL( wxT('f'), buf[0] ); CPPUNIT_ASSERT_EQUAL( wxT('o'), buf[1] ); CPPUNIT_ASSERT_EQUAL( wxT('o'), buf[2] ); CPPUNIT_ASSERT_EQUAL( wxT('/0'), buf[3] ); } { wxStringBufferLength buf(s, 10); CPPUNIT_ASSERT_EQUAL( wxT('f'), buf[0] ); CPPUNIT_ASSERT_EQUAL( wxT('o'), buf[1] ); CPPUNIT_ASSERT_EQUAL( wxT('o'), buf[2] ); CPPUNIT_ASSERT_EQUAL( wxT('/0'), buf[3] ); // and check that it can be used to write only the specified number of // characters to the string wxStrcpy(buf, wxT("barrbaz")); buf.SetLength(4); } CPPUNIT_ASSERT_EQUAL(4, s.length()); CPPUNIT_ASSERT(wxT('b') == s[0u]); CPPUNIT_ASSERT(wxT('a') == s[1]); CPPUNIT_ASSERT(wxT('r') == s[2]); CPPUNIT_ASSERT(wxT('r') == s[3]); // check that creating buffer of length smaller than string works, i.e. at // least doesn't crash (it would if we naively copied the entire original // string contents in the buffer) *wxStringBuffer(s, 1) = '!';}
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:45,
示例7: CrashHandlerSaveEditorFilesinline void CrashHandlerSaveEditorFiles(wxString& buf){ wxString path; //get the "My Files" folder HRESULT result = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, wxStringBuffer(path, MAX_PATH)); if (FAILED(result)) { //get at least the profiles folder path = ConfigManager::GetHomeFolder(); } path << _T("//cb-crash-recover"); if (!wxDirExists(path)) wxMkdir(path); //make a sub-directory of the current date & time wxDateTime now = wxDateTime::Now(); path << now.Format(_T("//%Y%m%d-%H%M%S")); EditorManager* em = Manager::Get()->GetEditorManager(); if (em) { bool AnyFileSaved = false; if (wxMkdir(path) && wxDirExists(path)) { for (int i = 0; i < em->GetEditorsCount(); ++i) { cbEditor* ed = em->GetBuiltinEditor(em->GetEditor(i)); if (ed) { wxFileName fn(ed->GetFilename()); wxString fnpath = path + _T("/") + fn.GetFullName(); wxString newfnpath = fnpath; // add number if filename already exists e.g. main.cpp.001, main.cpp.002, ... int j = 1; while (wxFileExists(newfnpath)) newfnpath = fnpath + wxString::Format(wxT(".%03d"),j); if (cbSaveToFile(newfnpath, ed->GetControl()->GetText(), ed->GetEncoding(), ed->GetUseBom() ) ) { AnyFileSaved = true; } } } if (AnyFileSaved) { buf << _("The currently opened files have been saved to the directory/n"); buf << path; buf << _("/nHopefully, this will prevent you from losing recent modifications./n/n"); } else wxRmdir(path); } }}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:56,
示例8: Lengthoff_t wxUtfFile::Read(wxString &str, off_t nCount){ if (nCount == (off_t) - 1) nCount = Length() - Tell(); if (!nCount) return 0; char *buffer = new char[nCount + 4]; // on some systems, len returned from wxFile::read might not reflect the number of bytes written // to the buffer, but the bytes read from file. In case of CR/LF translation, this is not the same. memset(buffer, 0, nCount + 4); off_t len = wxFile::Read(buffer, nCount); if (len >= 0) { memset(buffer + len, 0, 4); if (m_conversion) { int decr; size_t nLen = 0; // We are trying 4 times to convert, in case the last utf char // was truncated. for (decr = 0 ; len > 0 && decr < 4 ; decr++) { nLen = m_conversion->MB2WC(NULL, buffer, 0); if ( nLen != (size_t) - 1 ) break; len--; buffer[len] = 0; } if (nLen == (size_t) - 1) { if (!m_strFileName.IsEmpty()) { wxLogWarning(_("The file /"%s/" could not be opened because it contains characters that could not be interpreted."), m_strFileName.c_str()); } Seek(decr - nLen, wxFromCurrent); return (size_t) - 1; } if (decr) Seek(-decr, wxFromCurrent); m_conversion->MB2WC((wchar_t *)(wxChar *)wxStringBuffer(str, nLen + 1), (const char *)buffer, (size_t)(nLen + 1)); } else str = (wxChar *)buffer; } delete[] buffer; return len;}
开发者ID:Joe-xXx,项目名称:pgadmin3,代码行数:55,
示例9: dcwxSize wxDatePickerCtrl::DoGetBestSize() const{ wxClientDC dc(const_cast<wxDatePickerCtrl *>(this)); // we can't use FormatDate() here as the CRT doesn't always use the same // format as the date picker control wxString s; for ( int len = 100; ; len *= 2 ) { if ( ::GetDateFormat ( LOCALE_USER_DEFAULT, // the control should use the same DATE_SHORTDATE, // the format used by the control NULL, // use current date (we don't care) NULL, // no custom format wxStringBuffer(s, len), // output buffer len // and its length ) ) { // success break; } const DWORD rc = ::GetLastError(); if ( rc != ERROR_INSUFFICIENT_BUFFER ) { wxLogApiError(wxT("GetDateFormat"), rc); // fall back on wxDateTime, what else to do? s = wxDateTime::Today().FormatDate(); break; } } // the best size for the control is bigger than just the string // representation of todays date because the control must accommodate any // date and while the widths of all digits are usually about the same, the // width of the month string varies a lot, so try to account for it s += wxT("WW"); int x, y; dc.GetTextExtent(s, &x, &y); // account for the drop-down arrow or spin arrows x += wxSystemSettings::GetMetric(wxSYS_HSCROLL_ARROW_X); // and for the checkbox if we have it if ( HasFlag(wxDP_ALLOWNONE) ) x += 3*GetCharWidth(); wxSize best(x, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y)); CacheBestSize(best); return best;}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:54,
示例10: CASE_EXCEPTIONwxString wxCrashContext::GetExceptionString() const{ wxString s; #define CASE_EXCEPTION( x ) case EXCEPTION_##x: s = wxT(#x); break switch ( code ) { CASE_EXCEPTION(ACCESS_VIOLATION); CASE_EXCEPTION(DATATYPE_MISALIGNMENT); CASE_EXCEPTION(BREAKPOINT); CASE_EXCEPTION(SINGLE_STEP); CASE_EXCEPTION(ARRAY_BOUNDS_EXCEEDED); CASE_EXCEPTION(FLT_DENORMAL_OPERAND); CASE_EXCEPTION(FLT_DIVIDE_BY_ZERO); CASE_EXCEPTION(FLT_INEXACT_RESULT); CASE_EXCEPTION(FLT_INVALID_OPERATION); CASE_EXCEPTION(FLT_OVERFLOW); CASE_EXCEPTION(FLT_STACK_CHECK); CASE_EXCEPTION(FLT_UNDERFLOW); CASE_EXCEPTION(INT_DIVIDE_BY_ZERO); CASE_EXCEPTION(INT_OVERFLOW); CASE_EXCEPTION(PRIV_INSTRUCTION); CASE_EXCEPTION(IN_PAGE_ERROR); CASE_EXCEPTION(ILLEGAL_INSTRUCTION); CASE_EXCEPTION(NONCONTINUABLE_EXCEPTION); CASE_EXCEPTION(STACK_OVERFLOW); CASE_EXCEPTION(INVALID_DISPOSITION); CASE_EXCEPTION(GUARD_PAGE); CASE_EXCEPTION(INVALID_HANDLE); default: // unknown exception, ask NTDLL for the name if ( !::FormatMessage ( FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE, ::GetModuleHandle(wxT("NTDLL.DLL")), code, 0, wxStringBuffer(s, 1024), 1024, 0 ) ) { s.Printf(wxT("UNKNOWN_EXCEPTION(%d)"), code); } } #undef CASE_EXCEPTION return s;}
开发者ID:BloodRedd,项目名称:gamekit,代码行数:53,
示例11: wxGetFullHostNamewxString wxGetFullHostName(){ static const size_t hostnameSize = 257; wxString buf; bool ok = wxGetFullHostName(wxStringBuffer(buf, hostnameSize), hostnameSize); if ( !ok ) buf.Empty(); return buf;}
开发者ID:252525fb,项目名称:rpcs3,代码行数:12,
示例12: wxGetUserNamewxString wxGetUserName(){ static const int maxUserNameLen = 1024; // FIXME arbitrary number wxString buf; bool ok = wxGetUserName(wxStringBuffer(buf, maxUserNameLen), maxUserNameLen); if ( !ok ) buf.Empty(); return buf;}
开发者ID:252525fb,项目名称:rpcs3,代码行数:12,
示例13: wxGetWindowTextwxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd){ wxString str; if ( hWnd ) { int len = GetWindowTextLength((HWND)hWnd) + 1; ::GetWindowText((HWND)hWnd, wxStringBuffer(str, len), len); } return str;}
开发者ID:JessicaWhite17,项目名称:wxWidgets,代码行数:12,
示例14: SHGetSpecialFolderLocation/// Set File to hash in wxTextCtrlvoidAlcFrame::SetFileToHash(){#ifdef __WXMSW__ wxString browseroot; LPITEMIDLIST pidl; HRESULT hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl); if (SUCCEEDED(hr)) { if (!SHGetPathFromIDList(pidl, wxStringBuffer(browseroot, MAX_PATH))) { browseroot = wxFileName::GetHomeDir(); } } else { browseroot = wxFileName::GetHomeDir(); } if (pidl) { LPMALLOC pMalloc; SHGetMalloc(&pMalloc); if (pMalloc) { pMalloc->Free(pidl); pMalloc->Release(); } }#elif defined(__WXMAC__) FSRef fsRef; wxString browseroot; if (FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &fsRef) == noErr) { CFURLRef urlRef = CFURLCreateFromFSRef(NULL, &fsRef); CFStringRef cfString = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); CFRelease(urlRef) ; #if wxCHECK_VERSION(2, 9, 0) browseroot = wxCFStringRef(cfString).AsString(wxLocale::GetSystemEncoding()); #else browseroot = wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding()); #endif } else { browseroot = wxFileName::GetHomeDir(); }#else wxString browseroot = wxFileName::GetHomeDir();#endif const wxString & filename = wxFileSelector (_("Select the file you want to compute the eD2k link"), browseroot, wxEmptyString, wxEmptyString, wxT("*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST, this); if (!filename.empty ()) { m_inputFileTextCtrl->SetValue(filename); }}
开发者ID:dreamerc,项目名称:amule,代码行数:54,
示例15: wxGetUserIdwxString wxGetUserId(){ static const int maxLoginLen = 256; // FIXME arbitrary number wxString buf; bool ok = wxGetUserId(wxStringBuffer(buf, maxLoginLen), maxLoginLen); if ( !ok ) buf.Empty(); return buf;}
开发者ID:252525fb,项目名称:rpcs3,代码行数:12,
示例16: wxCHECK_MSG// Find string for positionwxString wxListBox::GetString(int N) const{ wxCHECK_MSG( N >= 0 && N < m_noItems, wxEmptyString, wxT("invalid index in wxListBox::GetString") ); int len = ListBox_GetTextLen(GetHwnd(), N); // +1 for terminating NUL wxString result; ListBox_GetText(GetHwnd(), N, (wxChar*)wxStringBuffer(result, len + 1)); return result;}
开发者ID:gitrider,项目名称:wxsj2,代码行数:14,
示例17: wxCHECK_MSG// Find string for positionwxString wxListBox::GetString(unsigned int n) const{ wxCHECK_MSG( IsValid(n), wxEmptyString, wxT("invalid index in wxListBox::GetString") ); int len = ListBox_GetTextLen(GetHwnd(), n); // +1 for terminating NUL wxString result; ListBox_GetText(GetHwnd(), n, (wxChar*)wxStringBuffer(result, len + 1)); return result;}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:14,
示例18: BrowseCallbackProcstatic int CALLBACKBrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData){ switch(uMsg) {#ifdef BFFM_SETSELECTION case BFFM_INITIALIZED: // sent immediately after initialisation and so we may set the // initial selection here // // wParam = TRUE => lParam is a string and not a PIDL ::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData); break;#endif // BFFM_SETSELECTION case BFFM_SELCHANGED: // note that this doesn't work with the new style UI (MSDN doesn't // say anything about it, but the comments in shlobj.h do!) but we // still execute this code in case it starts working again with the // "new new UI" (or would it be "NewUIEx" according to tradition?) { // Set the status window to the currently selected path. wxString strDir; if ( SHGetPathFromIDList((LPITEMIDLIST)lp, wxStringBuffer(strDir, MAX_PATH)) ) { // NB: this shouldn't be necessary with the new style box // (which is resizable), but as for now it doesn't work // anyhow (see the comment above) no harm in doing it // need to truncate or it displays incorrectly static const size_t maxChars = 37; if ( strDir.length() > maxChars ) { strDir = strDir.Right(maxChars); strDir = wxString(wxT("...")) + strDir; } SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, wxMSW_CONV_LPARAM(strDir)); } } break; //case BFFM_VALIDATEFAILED: -- might be used to provide custom message // if the user types in invalid dir name } return 0;}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:51,
示例19: wxCHECK_MSGwxString wxStatusBar95::GetStatusText(int nField) const{ wxCHECK_MSG( (nField >= 0) && (nField < m_nFields), wxEmptyString, _T("invalid statusbar field index") ); wxString str; int len = StatusBar_GetTextLen(GetHwnd(), nField); if ( len > 0 ) { StatusBar_GetText(GetHwnd(), nField, wxStringBuffer(str, len)); } return str;}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:14,
示例20: BrowseCallbackProc// ----------------------------------------------------------------------------// private functions// ----------------------------------------------------------------------------static int CALLBACKBrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData){ SelectDirDialog* pDlg = (SelectDirDialog*)pData; switch(uMsg) { case BFFM_INITIALIZED: { // sent immediately after initialisation and so we may set the // initial selection here // // wParam = TRUE => lParam is a string and not a PIDL ::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)pDlg->GetPath().c_str()); SetWindowText(hwnd, pDlg->GetName().wx_str() ); if( (pDlg->GetSearchFile().IsEmpty() == FALSE) && wxFindFirstFile(pDlg->GetPath() + pDlg->GetSearchFile() ).IsEmpty() ) SendMessage(hwnd, BFFM_ENABLEOK, 0, 0); wxIcon icon; icon.CopyFromBitmap( pDlg->GetBitmap() ); if(icon.IsOk()) ::SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)icon.GetHICON()); } break; case BFFM_SELCHANGED: { // Set the status window to the currently selected path. wxString strDir; if ( SHGetPathFromIDList((LPITEMIDLIST)lp, wxStringBuffer(strDir, MAX_PATH)) ) { if( (pDlg->GetSearchFile().IsEmpty() == FALSE) && wxFindFirstFile(strDir+ pDlg->GetSearchFile()).IsEmpty() ) SendMessage(hwnd, BFFM_ENABLEOK, 0, 0); } } break; //case BFFM_VALIDATEFAILED: -- might be used to provide custom message // if the user types in invalid dir name } return 0;}
开发者ID:stahta01,项目名称:EmBlocks_old,代码行数:53,
示例21: get_cfg//read config options if heartbeat config file is present:static void get_cfg(void){//default no logging: cfg.logpath.empty();//get config file path: wxString fullpath;// wxStringBuffer pathbuf(fullpath, MAX_PATH + 1);#ifdef __WXMSW__ GetModuleFileName(GetModuleHandle(NULL), wxStringBuffer(fullpath, MAX_PATH + 1), MAX_PATH);#else //TODO; maybe use argv[0] although it's not 100% reliable fullpath.empty();#endif fullpath = fullpath.BeforeLast(wxFileName::GetPathSeparator()); fullpath += wxFileName::GetPathSeparator(); fullpath += "heartbeat.cfg";// debug(1, "get cfg path '%s'", (const char*)fullpath);//try to read config file, extract info: std::ifstream stream; std::string linebuf; stream.open(fullpath); if (!stream.is_open()) return; while (std::getline(stream, linebuf)) { std::string::size_type ofs; if ((ofs = linebuf.find("#")) != std::string::npos) linebuf.erase(ofs); //remove comments while (linebuf.size() && (linebuf.back() == ' ')) linebuf.pop_back(); //trim if (linebuf.empty()) continue; if ((ofs = linebuf.find("/"")) == std::string::npos) ofs = linebuf.size();// remove_if(str.begin(), /*str.end()*/ str.begin() + 9, isspace); //make parsing simpler, but leave spaces in file name// if (ofs)// std::string::iterator quoted = linebuf.begin();// quoted += ofs;// linebuf.erase(/*std::string::iterator end_pos =*/ std::remove(&linebuf[0] /*.begin()*/, /*str.end()*/ &linebuf[ofs] /*.begin() + ofs*/, ' '), linebuf.end()); //make parsing simpler, but leave spaces in file name linebuf.erase(std::remove(linebuf.begin(), linebuf.begin() + ofs, ' '), linebuf.end());// if (ofs)// {// std::string::iterator end_pos = std::remove(linebuf.begin(), /*str.end()*/ linebuf.begin() + ofs, ' ');// linebuf.erase(end_pos, linebuf.begin() + ofs); //make parsing simpler, but leave spaces in file name// }// debug(1, "got cfg line '%s'", linebuf.c_str()); if (!strncasecmp(linebuf.c_str(), "Path=", 5)) cfg.logpath = linebuf.substr(5); else if (!strncasecmp(linebuf.c_str(), "Maxents=", 8)) cfg.maxents = atoi(linebuf.substr(8).c_str()); else if (!strncasecmp(linebuf.c_str(), "Interval=", 9)) cfg.interval = atoi(linebuf.substr(9).c_str()); } stream.close(); load_fifo();}
开发者ID:JonB256,项目名称:xLights,代码行数:51,
示例22: TiXmlDocumentvoid CfgMgrBldr::SwitchToR(const wxString& absFileName){ if (doc) delete doc; doc = new TiXmlDocument(); doc->ClearError(); cfg = absFileName; wxURL url(absFileName); url.SetProxy(ConfigManager::GetProxy()); if (url.GetError() == wxURL_NOERR) { wxInputStream *is = url.GetInputStream(); if (is && is->IsOk()) { size_t size = is->GetSize(); wxString str; #if wxCHECK_VERSION(2, 9, 0) wxChar* c = wxStringBuffer(str, size); #else wxChar* c = str.GetWriteBuf(size); #endif is->Read(c, size); #if !wxCHECK_VERSION(2, 9, 0) str.UngetWriteBuf(size); #endif doc = new TiXmlDocument(); if (doc->Parse(cbU2C(str))) { doc->ClearError(); delete is; return; } if (Manager::Get()->GetLogManager()) { Manager::Get()->GetLogManager()->DebugLog(_T("##### Error loading or parsing remote config file")); Manager::Get()->GetLogManager()->DebugLog(cbC2U(doc->ErrorDesc())); doc->ClearError(); } } delete is; } cfg.Empty(); SwitchTo(wxEmptyString); // fall back}
开发者ID:alpha0010,项目名称:codeblocks_sf,代码行数:48,
示例23: definedwxString TimerRecordDialog::GetDisplayDate( wxDateTime & dt ){#if defined(__WXMSW__) // On Windows, wxWidgets uses the system date control and it displays the // date based on the Windows locale selected by the user. But, wxDateTime // using the strftime function to return the formatted date. Since the // default locale for the Windows CRT environment is "C", the dates come // back in a different format. // // So, we make direct Windows calls to format the date like it the date // control. // // (Most of this taken from src/msw/datectrl.cpp) const wxDateTime::Tm tm(dt.GetTm()); SYSTEMTIME st; wxString s; int len; st.wYear = (WXWORD)tm.year; st.wMonth = (WXWORD)(tm.mon - wxDateTime::Jan + 1); st.wDay = tm.mday; st.wDayOfWeek = st.wMinute = st.wSecond = st.wMilliseconds = 0; len = ::GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, NULL, 0); if (len > 0) { len = ::GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, wxStringBuffer(s, len), len); if (len > 0) { s += wxT(" ") + dt.FormatTime(); return s; } }#endif // Use default formattingwxPrintf(wxT("%s/n"), dt.Format().c_str()); return dt.FormatDate() + wxT(" ") + dt.FormatTime(); }
开发者ID:Cactuslegs,项目名称:audacity-of-nope,代码行数:48,
示例24: wxLogLastErrorwxString wxStandardPathsWin16::GetConfigDir() const{ // this is for compatibility with earlier wxFileConfig versions // which used the Windows directory for the global files wxString dir;#ifndef __WXWINCE__ if ( !::GetWindowsDirectory(wxStringBuffer(dir, MAX_PATH), MAX_PATH) ) { wxLogLastError(_T("GetWindowsDirectory")); }#else // TODO: use CSIDL_WINDOWS (eVC4, possibly not eVC3) dir = wxT("//Windows");#endif return dir;}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:17,
示例25: lockwxString RaceAnalyzerComm::SendCommand(CComm *comPort, const wxString &buffer, size_t timeout){ wxMutexLocker lock(_commMutex); wxString response; try{ VERBOSE(FMT("Send Cmd (%d): '%s'",buffer.Len(), buffer.ToAscii())); size_t bufferSize = 8192; comPort->sendCommand(buffer.ToAscii(),wxStringBuffer(response,bufferSize),bufferSize,timeout,true); VERBOSE(FMT("Cmd Response: %s", response.ToAscii())); } catch(SerialException &e){ throw CommException(e.GetErrorStatus(), e.GetErrorDetail()); } catch(...){ throw CommException(-1, "Unknown exception while sending command"); } return response.Trim(true).Trim(false);}
开发者ID:autosportlabs,项目名称:RaceAnalyzer,代码行数:19,
示例26: wxCHECK_MSGwxString wxDataFormat::GetId() const{ static const int max = 256; wxString s; wxCHECK_MSG( !IsStandard(), s, wxT("name of predefined format cannot be retrieved") ); int len = ::GetClipboardFormatName(m_format, wxStringBuffer(s, max), max); if ( !len ) { wxLogError(_("The clipboard format '%d' doesn't exist."), m_format); return wxEmptyString; } return s;}
开发者ID:hazeeq090576,项目名称:wxWidgets,代码行数:19,
示例27: wxGetEnvbool wxGetEnv(const wxString& var, wxString *value){ // first get the size of the buffer DWORD dwRet = ::GetEnvironmentVariable(var.t_str(), NULL, 0); if ( !dwRet ) { // this means that there is no such variable return false; } if ( value ) { (void)::GetEnvironmentVariable(var.t_str(), wxStringBuffer(*value, dwRet), dwRet); } return true;}
开发者ID:Anti-Ultimate,项目名称:dolphin,代码行数:20,
示例28: GetHwndwxString wxChoice::GetString(unsigned int n) const{ int len = (int)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0); wxString str; if ( len != CB_ERR && len > 0 ) { if ( ::SendMessage ( GetHwnd(), CB_GETLBTEXT, n, (LPARAM)(wxChar *)wxStringBuffer(str, len) ) == CB_ERR ) { wxLogLastError(wxT("SendMessage(CB_GETLBTEXT)")); } } return str;}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:21,
示例29: Read32wxString wxDataInputStream::ReadString(){ size_t len; len = Read32(); if (len > 0) {#if wxUSE_UNICODE wxCharBuffer tmp(len + 1); m_input->Read(tmp.data(), len); tmp.data()[len] = '/0'; wxString ret(m_conv->cMB2WX(tmp.data()));#else wxString ret; m_input->Read( wxStringBuffer(ret, len), len);#endif return ret; } else return wxEmptyString;}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:22,
注:本文中的wxStringBuffer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wxStringFromBBString函数代码示例 C++ wxString函数代码示例 |