这篇教程C++ wxSscanf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wxSscanf函数的典型用法代码示例。如果您正苦于以下问题:C++ wxSscanf函数的具体用法?C++ wxSscanf怎么用?C++ wxSscanf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wxSscanf函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: wxTbool wxReportImageItem::RetrieveFromXmlNode(const wxXmlNode* node){ long type = -1, ppi = 72; double x = -1, y = -1; node->GetAttribute(wxT("Type"), wxT("")).ToLong(&type); if(type != wxRP_IMAGE) return false; if(!this->m_style.RetrieveFromXmlNode(node)); this->m_sName = node->GetAttribute(wxT("Name"), wxT("")); wxString path = node->GetAttribute(wxT("Path"), wxT("")); wxImage image; if(image.LoadFile(path)) { this->m_sValue = path; } else return false; wxSscanf(node->GetAttribute(wxT("X"), wxT("")), wxT("%lf"), &x); wxSscanf(node->GetAttribute(wxT("Y"), wxT("")), wxT("%lf"), &y); if(x >= 0 && y >= 0) this->m_position = wxRealPoint(x, y); else return false; wxSscanf(node->GetAttribute(wxT("PPI"), wxT("")), wxT("%d"), &ppi); this->m_iPPI = ppi; this->m_iWidth = image.GetWidth(); this->m_iHeight = image.GetHeight(); return true;}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:33,
示例2: wxLogError/********************************************************* Formatter --- getDateIntsFromString********************************************************/bool Formatter::getDateIntsFromString( const wxChar *value, int &day, int &month, int &year, int format ){ const int l = LanguageConfig::get()->getLocale()->GetLanguage(); if ( ! value ) { wxLogError( wxT( "Error: date value is NULL" )); return false; } wxChar *c = (wxChar*)value; int sepTokenCount = 0; const wxChar septoken = ( l == wxLANGUAGE_GERMAN ? '.' : '-' ); while ( *c ) { if ( *c == septoken ) sepTokenCount++; if ( ! ( isdigit( *c ) || *c == '.' || *c == '-' )) return false; c++; } if ( sepTokenCount > 2 ) return false; int ret; if ( l == wxLANGUAGE_GERMAN ) // German ret = wxSscanf( value, wxT( "%d.%d.%d" ), &day, &month, &year ); else ret = wxSscanf( value, wxT( "%d-%d-%d" ), &year, &month, &day ); if ( ret != 3 ) return false; if (( day < 1 ) || ( day > 31 )) return false; if (( month < 1 ) || ( month > 12 )) return false; if (( year < -3000 ) || ( year > 6000 )) return false; return true;}
开发者ID:akshaykinhikar,项目名称:maitreya7,代码行数:38,
示例3: wxGetOsVersionwxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro){ // get OS version int major = -1, minor = -1, micro = -1; wxString release = wxGetCommandOutput(wxT("uname -r")); if ( !release.empty() ) { if ( wxSscanf(release.c_str(), wxT("%d.%d.%d"), &major, &minor, µ ) != 3 ) { micro = 0; if ( wxSscanf(release.c_str(), wxT("%d.%d"), &major, &minor ) != 2 ) { // failed to get version string or unrecognized format major = minor = micro = -1; } } } if ( verMaj ) *verMaj = major; if ( verMin ) *verMin = minor; if ( verMicro ) *verMicro = micro; // try to understand which OS are we running wxString kernel = wxGetCommandOutput(wxT("uname -s")); if ( kernel.empty() ) kernel = wxGetCommandOutput(wxT("uname -o")); if ( kernel.empty() ) return wxOS_UNKNOWN; return wxPlatformInfo::GetOperatingSystemId(kernel);}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:35,
示例4: wxSscanflong wxTimeSpinCtrl::GetTextTime(){ int t1, t2, t3, t4; int scanned = wxSscanf(m_txt->GetValue(), wxT("%d:%d:%d:%d"), &t1, &t2, &t3, &t4); switch (scanned) { case 1: if (t1 >= 0) return t1; break; case 2: if (t1 >= 0 && t2 >= 0 && t2 < 60) return t1 * 60 + t2; break; case 3: if (t1 >= 0 && t2 >= 0 && t2 < 60 && t3 >= 0 && t3 < 60) return (t1 * 60 + t2) * 60 + t3; break; case 4: if (t1 >= 0 && t2 >= 0 && t2 < 24 && t3 >= 0 && t3 < 60 && t4 >= 0 && t4 < 60) return ((t1 * 24 + t2) * 60 + t3) * 60 + t4; break; default: break; } return -1;}
开发者ID:KrisShannon,项目名称:pgadmin3,代码行数:28,
示例5: vTokenizerbool wxNativeEncodingInfo::FromString( const wxString& rsStr ){ wxStringTokenizer vTokenizer(rsStr, wxT(";")); wxString sEncid = vTokenizer.GetNextToken(); long lEnc; if (!sEncid.ToLong(&lEnc)) return FALSE; encoding = (wxFontEncoding)lEnc; facename = vTokenizer.GetNextToken(); if (!facename) return FALSE; wxString sTmp = vTokenizer.GetNextToken(); if (!sTmp) { charset = 850; } else { if ( wxSscanf(sTmp, wxT("%u"), &charset) != 1 ) { // should be a number! return FALSE; } } return true;} // end of wxNativeEncodingInfo::FromString
开发者ID:chromylei,项目名称:third_party,代码行数:29,
示例6: tokenizerbool wxNativeEncodingInfo::FromString(const wxString& s){ wxStringTokenizer tokenizer(s, _T(";")); facename = tokenizer.GetNextToken(); if ( !facename ) return FALSE; wxString tmp = tokenizer.GetNextToken(); if ( !tmp ) { // default charset (don't use DEFAULT_CHARSET though because of subtle // Windows 9x/NT differences in handling it) charset = 0; } else { if ( wxSscanf(tmp, _T("%u"), &charset) != 1 ) { // should be a number! return FALSE; } } return TRUE;}
开发者ID:gitrider,项目名称:wxsj2,代码行数:26,
示例7: GetParamint wxHtmlTag::ScanParam(const wxString& par, const wchar_t *format, void *param) const{ wxString parval = GetParam(par); return wxSscanf(parval, format, param);}
开发者ID:beanhome,项目名称:dev,代码行数:7,
示例8: GetFloatValuefloat FloatConfigControl::GetFloatValue(){ float f_value; if( (wxSscanf(textctrl->GetValue(), wxT("%f"), &f_value) == 1) ) return f_value; else return 0.0;}
开发者ID:forthyen,项目名称:SDesk,代码行数:7,
示例9: inputvoid VarArgTestCase::Sscanf(){ int i = 0; char str[20]; wchar_t wstr[20]; wxString input("42 test"); wxSscanf(input, "%d %s", &i, &str); CPPUNIT_ASSERT( i == 42 ); CPPUNIT_ASSERT( wxStrcmp(str, "test") == 0 ); i = 0; wxSscanf(input, L"%d %s", &i, &wstr); CPPUNIT_ASSERT( i == 42 ); CPPUNIT_ASSERT( wxStrcmp(wstr, "test") == 0 );}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:17,
示例10: strutil_decryptStringstrutil_decrypt(const String &original){ if(original.Length() == 0) return wxEmptyString; if(! strutil_encrypt_initialised) strutil_encrypt_initialise(); if(original[0] == '-') return strutil_decrypt_tf(original); // the encrypted string always has a length divisible by 4 if ( original.length() % 4 ) { wxLogWarning(_("Decrypt function called with illegal string.")); return wxEmptyString; } String tmpstr, newstr; const wxChar *cptr = original.c_str(); unsigned char pair[2]; unsigned int i; while(*cptr) { tmpstr = wxEmptyString; tmpstr << *cptr << *(cptr+1); cptr += 2; wxSscanf(tmpstr.c_str(), _T("%02x"), &i); pair[0] = (unsigned char) i; tmpstr = wxEmptyString; tmpstr << *cptr << *(cptr+1); cptr += 2; wxSscanf(tmpstr.c_str(), _T("%02x"), &i); pair[1] = (unsigned char) i; strutil_encrypt_pair(pair); newstr << (char) pair[0] << (char) pair[1]; } return newstr;}
开发者ID:vadz,项目名称:mahogany,代码行数:45,
示例11: wxAtoibool wxRichTextFormattingDialog::ConvertFromString(const wxString& str, int& ret, int unit){ if (unit == wxTEXT_ATTR_UNITS_PIXELS) { ret = wxAtoi(str); return true; } else if (unit == wxTEXT_ATTR_UNITS_TENTHS_MM) { float value = 0.0; wxSscanf(str.c_str(), wxT("%f"), &value); // Convert from cm // Do this in two steps, since using one step causes strange rounding error for VS 2010 at least. float v = (value * 100.0); ret = (int) (v); return true; } else if (unit == wxTEXT_ATTR_UNITS_PERCENTAGE) { ret = wxAtoi(str); return true; } else if (unit == wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT) { float value = 0.0; wxSscanf(str.c_str(), wxT("%f"), &value); float v = (value * 100.0); ret = (int) (v); } else if (unit == wxTEXT_ATTR_UNITS_POINTS) { ret = wxAtoi(str); return true; } else { ret = 0; return false; } return true;}
开发者ID:HanruZhou,项目名称:wxWidgets,代码行数:42,
示例12: GetOptionint wxOptionValue::GetOption(const wxString& name, const wxChar *format, ...) const{ wxString n = GetOption(name); if (n.IsEmpty()) return 0; va_list argptr; va_start(argptr, format);// int i = wxVsscanf(n.c_str(), format, argptr); // VisualStudio doesn't have this int i = wxSscanf(n.c_str(), format, argptr); va_end(argptr); return i;}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:11,
示例13: wxSscanfvoid wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale){ if (tag.HasParam(wxT("WIDTH"))) { int wdi; wxString wd = tag.GetParam(wxT("WIDTH")); if (wd[wd.Length()-1] == wxT('%')) { wxSscanf(wd.c_str(), wxT("%i%%"), &wdi); SetWidthFloat(wdi, wxHTML_UNITS_PERCENT); } else { wxSscanf(wd.c_str(), wxT("%i"), &wdi); SetWidthFloat((int)(pixel_scale * (double)wdi), wxHTML_UNITS_PIXELS); } m_LastLayout = -1; }}
开发者ID:gitrider,项目名称:wxsj2,代码行数:20,
示例14: tokenizerbool wxNativeEncodingInfo::FromString(const wxString& s){ wxStringTokenizer tokenizer(s, wxT(";")); wxString encid = tokenizer.GetNextToken(); // we support 2 formats: the old one (and still used if !wxUSE_FONTMAP) // used the raw encoding values but the new one uses the encoding names long enc; if ( encid.ToLong(&enc) ) { // old format, intepret as encoding -- but after minimal checks if ( enc < 0 || enc >= wxFONTENCODING_MAX ) return false; encoding = (wxFontEncoding)enc; } else // not a number, interpret as an encoding name {#if wxUSE_FONTMAP encoding = wxFontMapper::GetEncodingFromName(encid); if ( encoding == wxFONTENCODING_MAX )#endif // wxUSE_FONTMAP { // failed to parse the name (or couldn't even try...) return false; } } facename = tokenizer.GetNextToken(); wxString tmp = tokenizer.GetNextToken(); if ( tmp.empty() ) { // default charset: but don't use DEFAULT_CHARSET here because it might // be different from the machine on which the file we had read this // encoding desc from was created charset = ANSI_CHARSET; } else { if ( wxSscanf(tmp, wxT("%u"), &charset) != 1 ) { // should be a number! return false; } } return true;}
开发者ID:Richard-Ni,项目名称:wxWidgets,代码行数:50,
示例15: wxGetWindowTextint wxSpinCtrl::GetValue() const{ wxString val = wxGetWindowText(m_hwndBuddy); long n; if ( (wxSscanf(val, wxT("%ld"), &n) != 1) ) n = INT_MIN; if ( n < m_min ) n = m_min; if ( n > m_max ) n = m_max; return n;}
开发者ID:georgemoralis,项目名称:jpcsp2c,代码行数:15,
示例16: wxCHECK_RETvoid wxSpinCtrlGTKBase::SetValue( const wxString& value ){ wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); double n; if ( wxSscanf(value, "%lg", &n) == 1 ) { // a number - set it, let DoSetValue round for int value DoSetValue(n); return; } // invalid number - set text as is (wxMSW compatible) wxSpinCtrlEventDisabler disable(this); gtk_entry_set_text( GTK_ENTRY(m_widget), wxGTK_CONV( value ) );}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:16,
示例17: FromHex void FromHex(const String &hexdata) { if(data) free(data); len = hexdata.Length() / 2; data = (BYTE *)malloc( len ); const wxChar *cptr = hexdata.c_str(); String tmp; int val, idx = 0; while(*cptr) { tmp = wxEmptyString; tmp << *cptr << *(cptr+1); cptr += 2; wxSscanf(tmp.c_str(), _T("%02x"), &val); data[idx++] = (BYTE)val; } }
开发者ID:vadz,项目名称:mahogany,代码行数:17,
示例18: wxCHECK_RETvoid wxSpinCtrl::SetValue( const wxString& value ){ wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); int n; if ( (wxSscanf(value, wxT("%d"), &n) == 1) ) { // a number - set it SetValue(n); } else { // invalid number - set text as is (wxMSW compatible) GtkDisableEvents(); gtk_entry_set_text( GTK_ENTRY(m_widget), wxGTK_CONV( value ) ); GtkEnableEvents(); }}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:18,
示例19: WXUNUSEDvoid wxNumberEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event)){#if !wxUSE_SPINCTRL wxString tmp = m_spinctrl->GetValue(); if ( wxSscanf(tmp, wxT("%ld"), &m_value) != 1 ) EndModal(wxID_CANCEL); else#else m_value = m_spinctrl->GetValue();#endif if ( m_value < m_min || m_value > m_max ) { // not a number or out of range m_value = -1; EndModal(wxID_CANCEL); } EndModal(wxID_OK);}
开发者ID:futurepr0n,项目名称:wxWidgets,代码行数:19,
示例20: GetRootvoid wxXmlRcEditDocument::Upgrade(){ int v1,v2,v3,v4; long version; wxXmlNode *node = GetRoot(); wxString verstr = wxT("0.0.0.0"); node->GetPropVal(wxT("version"),verstr); if (wxSscanf(verstr.c_str(), wxT("%i.%i.%i.%i"), &v1, &v2, &v3, &v4) == 4) version = v1*256*256*256+v2*256*256+v3*256+v4; else version = 0; if (!version) { UpgradeNode(node); } node->DeleteProperty(wxT("version")); node->AddProperty(wxT("version"), WX_XMLRES_CURRENT_VERSION_STRING);}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:19,
示例21: WXUNUSEDvoid MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event)){ const wxString& title = _("Testing _N() (ngettext)"); wxTextEntryDialog d(this, _("Please enter range for plural forms of /"n files deleted/" phrase"), title, "0-10"); if (d.ShowModal() == wxID_OK) { int first, last; wxSscanf(d.GetValue(), "%d-%d", &first, &last); wxString s(title); s << "/n"; for (int n = first; n <= last; ++n) { s << n << " " << wxPLURAL("file deleted", "files deleted", n) << "/n"; } wxMessageBox(s); }}
开发者ID:ExperimentationBox,项目名称:Edenite,代码行数:22,
示例22: wxLogErrorbool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser){#ifdef __WXUNIVERSAL__ wxString themeName; if ( parser.Found(OPTION_THEME, &themeName) ) { wxTheme *theme = wxTheme::Create(themeName); if ( !theme ) { wxLogError(_("Unsupported theme '%s'."), themeName.c_str()); return false; } // Delete the defaultly created theme and set the new theme. delete wxTheme::Get(); wxTheme::Set(theme); }#endif // __WXUNIVERSAL__#if defined(__WXMGL__) wxString modeDesc; if ( parser.Found(OPTION_MODE, &modeDesc) ) { unsigned w, h, bpp; if ( wxSscanf(modeDesc.c_str(), wxT("%ux%u-%u"), &w, &h, &bpp) != 3 ) { wxLogError(_("Invalid display mode specification '%s'."), modeDesc.c_str()); return false; } if ( !SetDisplayMode(wxVideoMode(w, h, bpp)) ) return false; }#endif // __WXMGL__ return wxAppConsole::OnCmdLineParsed(parser);}
开发者ID:NullNoname,项目名称:dolphin,代码行数:37,
示例23: wxTwxChar wx28HtmlEntitiesParser::GetEntityChar(const wxString& entity){ unsigned code = 0; if (entity[0] == wxT('#')) { const wxChar *ent_s = entity.c_str(); const wxChar *format; if (ent_s[1] == wxT('x') || ent_s[1] == wxT('X')) { format = wxT("%x"); ent_s++; } else format = wxT("%u"); ent_s++; if (wxSscanf(ent_s, format, &code) != 1) code = 0; } else { static wx28HtmlEntityInfo substitutions[] = { { wxT("AElig"),198 }, { wxT("Aacute"),193 }, { wxT("Acirc"),194 }, { wxT("Agrave"),192 }, { wxT("Alpha"),913 }, { wxT("Aring"),197 }, { wxT("Atilde"),195 }, { wxT("Auml"),196 }, { wxT("Beta"),914 }, { wxT("Ccedil"),199 }, { wxT("Chi"),935 }, { wxT("Dagger"),8225 }, { wxT("Delta"),916 }, { wxT("ETH"),208 }, { wxT("Eacute"),201 }, { wxT("Ecirc"),202 }, { wxT("Egrave"),200 }, { wxT("Epsilon"),917 }, { wxT("Eta"),919 }, { wxT("Euml"),203 }, { wxT("Gamma"),915 }, { wxT("Iacute"),205 }, { wxT("Icirc"),206 }, { wxT("Igrave"),204 }, { wxT("Iota"),921 }, { wxT("Iuml"),207 }, { wxT("Kappa"),922 }, { wxT("Lambda"),923 }, { wxT("Mu"),924 }, { wxT("Ntilde"),209 }, { wxT("Nu"),925 }, { wxT("OElig"),338 }, { wxT("Oacute"),211 }, { wxT("Ocirc"),212 }, { wxT("Ograve"),210 }, { wxT("Omega"),937 }, { wxT("Omicron"),927 }, { wxT("Oslash"),216 }, { wxT("Otilde"),213 }, { wxT("Ouml"),214 }, { wxT("Phi"),934 }, { wxT("Pi"),928 }, { wxT("Prime"),8243 }, { wxT("Psi"),936 }, { wxT("Rho"),929 }, { wxT("Scaron"),352 }, { wxT("Sigma"),931 }, { wxT("THORN"),222 }, { wxT("Tau"),932 }, { wxT("Theta"),920 }, { wxT("Uacute"),218 }, { wxT("Ucirc"),219 }, { wxT("Ugrave"),217 }, { wxT("Upsilon"),933 }, { wxT("Uuml"),220 }, { wxT("Xi"),926 }, { wxT("Yacute"),221 }, { wxT("Yuml"),376 }, { wxT("Zeta"),918 }, { wxT("aacute"),225 }, { wxT("acirc"),226 }, { wxT("acute"),180 }, { wxT("aelig"),230 }, { wxT("agrave"),224 }, { wxT("alefsym"),8501 }, { wxT("alpha"),945 }, { wxT("amp"),38 }, { wxT("and"),8743 }, { wxT("ang"),8736 }, { wxT("aring"),229 }, { wxT("asymp"),8776 }, { wxT("atilde"),227 }, { wxT("auml"),228 }, { wxT("bdquo"),8222 }, { wxT("beta"),946 }, { wxT("brvbar"),166 },//.........这里部分代码省略.........
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:101,
示例24: wxTvoid wxFontRefData::InitFromNative(){ // get the font parameters from the XLFD // ------------------------------------- m_faceName = m_nativeFontInfo.GetXFontComponent(wxXLFD_FAMILY); m_weight = wxFONTWEIGHT_NORMAL; wxString w = m_nativeFontInfo.GetXFontComponent(wxXLFD_WEIGHT).Upper(); if ( !w.empty() && w != wxT('*') ) { // the test below catches all of BOLD, EXTRABOLD, DEMIBOLD, ULTRABOLD // and BLACK if ( ((w[0u] == wxT('B') && (!wxStrcmp(w.c_str() + 1, wxT("OLD")) || !wxStrcmp(w.c_str() + 1, wxT("LACK"))))) || wxStrstr(w.c_str() + 1, wxT("BOLD")) ) { m_weight = wxFONTWEIGHT_BOLD; } else if ( w == wxT("LIGHT") || w == wxT("THIN") ) { m_weight = wxFONTWEIGHT_LIGHT; } } switch ( wxToupper(m_nativeFontInfo. GetXFontComponent(wxXLFD_SLANT)[0u]).GetValue() ) { case wxT('I'): // italique m_style = wxFONTSTYLE_ITALIC; break; case wxT('O'): // oblique m_style = wxFONTSTYLE_SLANT; break; default: m_style = wxFONTSTYLE_NORMAL; } long ptSize; if ( m_nativeFontInfo.GetXFontComponent(wxXLFD_POINTSIZE).ToLong(&ptSize) ) { // size in XLFD is in 10 point units m_pointSize = (int)(ptSize / 10); } else { m_pointSize = wxDEFAULT_FONT_SIZE; } // examine the spacing: if the font is monospaced, assume wxTELETYPE // family for compatibility with the old code which used it instead of // IsFixedWidth() if ( m_nativeFontInfo.GetXFontComponent(wxXLFD_SPACING).Upper() == wxT('M') ) { m_family = wxFONTFAMILY_TELETYPE; } else // not monospaceed { // don't even try guessing it, it doesn't work for too many fonts // anyhow m_family = wxFONTFAMILY_UNKNOWN; } // X fonts are never underlined... m_underlined = false; // deal with font encoding wxString registry = m_nativeFontInfo.GetXFontComponent(wxXLFD_REGISTRY).Upper(), encoding = m_nativeFontInfo.GetXFontComponent(wxXLFD_ENCODING).Upper(); if ( registry == wxT("ISO8859") ) { int cp; if ( wxSscanf(encoding, wxT("%d"), &cp) == 1 ) { m_encoding = (wxFontEncoding)(wxFONTENCODING_ISO8859_1 + cp - 1); } } else if ( registry == wxT("MICROSOFT") ) { int cp; if ( wxSscanf(encoding, wxT("cp125%d"), &cp) == 1 ) { m_encoding = (wxFontEncoding)(wxFONTENCODING_CP1250 + cp); } } else if ( registry == wxT("KOI8") ) { m_encoding = wxFONTENCODING_KOI8; } else // unknown encoding { // may be give a warning here? or use wxFontMapper? m_encoding = wxFONTENCODING_SYSTEM; }}
开发者ID:beanhome,项目名称:dev,代码行数:100,
示例25: GetSSAGDriverVersionstatic unsigned int GetSSAGDriverVersion(){ // check to see if the SSAG driver is v2 ("1.2.0.0") or v4 ("3.0.0.0") Debug.AddLine("Checking SSAG driver version"); bool found = false; unsigned int driverVersion = 2; // assume v2 HDEVINFO h = SetupDiGetClassDevs(NULL, L"USB", NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT); if (h != INVALID_HANDLE_VALUE) { DWORD idx = 0; SP_DEVINFO_DATA data; memset(&data, 0, sizeof(data)); data.cbSize = sizeof(data); while (SetupDiEnumDeviceInfo(h, idx, &data)) {#if DONE_SUPPORTING_XP WCHAR buf[4096]; if (GetDiPropStr(h, &data, DEVPKEY_Device_InstanceId, buf, sizeof(buf)) && (wcsncmp(buf, L"USB//VID_1856&PID_0012//", 22) == 0) || (wcsncmp(buf, L"USB//VID_1856&PID_0011//", 22) == 0)) { Debug.AddLine(wxString::Format("Found SSAG device %s", buf)); if (GetDiPropStr(h, &data, DEVPKEY_Device_DriverVersion, buf, sizeof(buf))) { Debug.AddLine(wxString::Format("SSAG driver version is %s", wxString(buf))); int v; if (swscanf(buf, L"%d", &v) == 1 && v >= 3) { driverVersion = 4; } } found = true; break; }#else WCHAR buf[4096]; DWORD size = sizeof(buf); DWORD proptype; if (SetupDiGetDeviceRegistryProperty(h, &data, SPDRP_HARDWAREID, &proptype, (PBYTE)&buf[0], size, &size) && (wcsncmp(buf, L"USB//VID_1856&PID_0012", 21) == 0 || wcsncmp(buf, L"USB//VID_1856&PID_0011", 21) == 0)) { Debug.AddLine(wxString::Format("Found SSAG device %s", buf)); wxString ver = GetDiPropStr(h, &data, "DriverVersion"); if (ver.Length()) { Debug.AddLine(wxString::Format("SSAG driver version is %s", ver)); int v; if (wxSscanf(ver, "%d", &v) == 1 && v >= 3) { driverVersion = 4; } } found = true; break; }#endif // XP ++idx; } SetupDiDestroyDeviceInfoList(h); } if (!found) Debug.AddLine("No SSAG device was found"); return driverVersion;}
开发者ID:Saharac,项目名称:open-phd-guiding,代码行数:75,
示例26: wxFontRefDatabool wxFont::Create(const wxString& fontname, wxFontEncoding enc){ if( !fontname ) { *this = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT); return true; } m_refData = new wxFontRefData(); M_FONTDATA->m_nativeFontInfo.SetXFontName(fontname); // X font name wxString tmp; wxStringTokenizer tn( fontname, wxT("-") ); tn.GetNextToken(); // skip initial empty token tn.GetNextToken(); // foundry M_FONTDATA->m_faceName = tn.GetNextToken(); // family tmp = tn.GetNextToken().MakeUpper(); // weight if (tmp == wxT("BOLD")) M_FONTDATA->m_weight = wxFONTWEIGHT_BOLD; if (tmp == wxT("BLACK")) M_FONTDATA->m_weight = wxFONTWEIGHT_BOLD; if (tmp == wxT("EXTRABOLD")) M_FONTDATA->m_weight = wxFONTWEIGHT_BOLD; if (tmp == wxT("DEMIBOLD")) M_FONTDATA->m_weight = wxFONTWEIGHT_BOLD; if (tmp == wxT("ULTRABOLD")) M_FONTDATA->m_weight = wxFONTWEIGHT_BOLD; if (tmp == wxT("LIGHT")) M_FONTDATA->m_weight = wxFONTWEIGHT_LIGHT; if (tmp == wxT("THIN")) M_FONTDATA->m_weight = wxFONTWEIGHT_LIGHT; tmp = tn.GetNextToken().MakeUpper(); // slant if (tmp == wxT("I")) M_FONTDATA->m_style = wxFONTSTYLE_ITALIC; if (tmp == wxT("O")) M_FONTDATA->m_style = wxFONTSTYLE_ITALIC; tn.GetNextToken(); // set width tn.GetNextToken(); // add. style tn.GetNextToken(); // pixel size tmp = tn.GetNextToken(); // pointsize if (tmp != wxT("*")) { long num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10); M_FONTDATA->m_pointSize = (int)(num / 10); } tn.GetNextToken(); // x-res tn.GetNextToken(); // y-res tmp = tn.GetNextToken().MakeUpper(); // spacing if (tmp == wxT("M")) M_FONTDATA->m_family = wxFONTFAMILY_MODERN; else if (M_FONTDATA->m_faceName == wxT("TIMES")) M_FONTDATA->m_family = wxFONTFAMILY_ROMAN; else if (M_FONTDATA->m_faceName == wxT("HELVETICA")) M_FONTDATA->m_family = wxFONTFAMILY_SWISS; else if (M_FONTDATA->m_faceName == wxT("LUCIDATYPEWRITER")) M_FONTDATA->m_family = wxFONTFAMILY_TELETYPE; else if (M_FONTDATA->m_faceName == wxT("LUCIDA")) M_FONTDATA->m_family = wxFONTFAMILY_DECORATIVE; else if (M_FONTDATA->m_faceName == wxT("UTOPIA")) M_FONTDATA->m_family = wxFONTFAMILY_SCRIPT; tn.GetNextToken(); // avg width // deal with font encoding M_FONTDATA->m_encoding = enc; if ( M_FONTDATA->m_encoding == wxFONTENCODING_SYSTEM ) { wxString registry = tn.GetNextToken().MakeUpper(), encoding = tn.GetNextToken().MakeUpper(); if ( registry == wxT("ISO8859") ) { int cp; if ( wxSscanf(encoding, wxT("%d"), &cp) == 1 ) { M_FONTDATA->m_encoding = (wxFontEncoding)(wxFONTENCODING_ISO8859_1 + cp - 1); } } else if ( registry == wxT("MICROSOFT") ) { int cp; if ( wxSscanf(encoding, wxT("cp125%d"), &cp) == 1 ) { M_FONTDATA->m_encoding = (wxFontEncoding)(wxFONTENCODING_CP1250 + cp); } } else if ( registry == wxT("KOI8") ) { M_FONTDATA->m_encoding = wxFONTENCODING_KOI8; } //else: unknown encoding - may be give a warning here? else return false; }//.........这里部分代码省略.........
开发者ID:beanhome,项目名称:dev,代码行数:101,
示例27: wxGTK_CONV_BACK//.........这里部分代码省略.........#else // X11 // get the font parameters from the XLFD // ------------------------------------- m_faceName = m_nativeFontInfo.GetXFontComponent(wxXLFD_FAMILY); m_weight = wxFONTWEIGHT_NORMAL; wxString w = m_nativeFontInfo.GetXFontComponent(wxXLFD_WEIGHT).Upper(); if ( !w.empty() && w != wxT('*') ) { // the test below catches all of BOLD, EXTRABOLD, DEMIBOLD, ULTRABOLD // and BLACK if ( ((w[0u] == wxT('B') && (!wxStrcmp(w.c_str() + 1, wxT("OLD")) || !wxStrcmp(w.c_str() + 1, wxT("LACK"))))) || wxStrstr(w.c_str() + 1, wxT("BOLD")) ) { m_weight = wxFONTWEIGHT_BOLD; } else if ( w == wxT("LIGHT") || w == wxT("THIN") ) { m_weight = wxFONTWEIGHT_LIGHT; } } switch ( wxToupper( m_nativeFontInfo. GetXFontComponent(wxXLFD_SLANT)[0u]).GetValue() ) { case wxT('I'): // italique m_style = wxFONTSTYLE_ITALIC; break; case wxT('O'): // oblique m_style = wxFONTSTYLE_SLANT; break; default: m_style = wxFONTSTYLE_NORMAL; } long ptSize; if ( m_nativeFontInfo.GetXFontComponent(wxXLFD_POINTSIZE).ToLong(&ptSize) ) { // size in XLFD is in 10 point units m_pointSize = (int)(ptSize / 10); } else { m_pointSize = wxDEFAULT_FONT_SIZE; } // examine the spacing: if the font is monospaced, assume wxTELETYPE // family for compatibility with the old code which used it instead of // IsFixedWidth() if ( m_nativeFontInfo.GetXFontComponent(wxXLFD_SPACING).Upper() == wxT('M') ) { m_family = wxFONTFAMILY_TELETYPE; } else // not monospaceed { // don't even try guessing it, it doesn't work for too many fonts // anyhow m_family = wxFONTFAMILY_UNKNOWN; } // X fonts are never underlined... m_underlined = false; // deal with font encoding wxString registry = m_nativeFontInfo.GetXFontComponent(wxXLFD_REGISTRY).Upper(), encoding = m_nativeFontInfo.GetXFontComponent(wxXLFD_ENCODING).Upper(); if ( registry == wxT("ISO8859") ) { int cp; if ( wxSscanf(encoding, wxT("%d"), &cp) == 1 ) { m_encoding = (wxFontEncoding)(wxFONTENCODING_ISO8859_1 + cp - 1); } } else if ( registry == wxT("MICROSOFT") ) { int cp; if ( wxSscanf(encoding, wxT("cp125%d"), &cp) == 1 ) { m_encoding = (wxFontEncoding)(wxFONTENCODING_CP1250 + cp); } } else if ( registry == wxT("KOI8") ) { m_encoding = wxFONTENCODING_KOI8; } else // unknown encoding { // may be give a warning here? or use wxFontMapper? m_encoding = wxFONTENCODING_SYSTEM; }#endif // Pango/X11}
开发者ID:beanhome,项目名称:dev,代码行数:101,
示例28: XSetErrorHandlerbool wxApp::Initialize(int& argC, wxChar **argV){#if !wxUSE_NANOX // install the X error handler gs_pfnXErrorHandler = XSetErrorHandler( wxXErrorHandler );#endif wxString displayName; bool syncDisplay = false; int argCOrig = argC; for ( int i = 0; i < argCOrig; i++ ) { if (wxStrcmp( argV[i], wxT("-display") ) == 0) { if (i < (argCOrig - 1)) { argV[i++] = NULL; displayName = argV[i]; argV[i] = NULL; argC -= 2; } } else if (wxStrcmp( argV[i], wxT("-geometry") ) == 0) { if (i < (argCOrig - 1)) { argV[i++] = NULL; int w, h; if (wxSscanf(argV[i], wxT("%dx%d"), &w, &h) != 2) { wxLogError( _("Invalid geometry specification '%s'"), wxString(argV[i]).c_str() ); } else { g_initialSize = wxSize(w, h); } argV[i] = NULL; argC -= 2; } } else if (wxStrcmp( argV[i], wxT("-sync") ) == 0) { syncDisplay = true; argV[i] = NULL; argC--; } else if (wxStrcmp( argV[i], wxT("-iconic") ) == 0) { g_showIconic = true; argV[i] = NULL; argC--; } } if ( argC != argCOrig ) { // remove the arguments we consumed for ( int i = 0; i < argC; i++ ) { while ( !argV[i] ) { memmove(argV + i, argV + i + 1, (argCOrig - i)*sizeof(wxChar *)); } } } // open and set up the X11 display if ( !wxSetDisplay(displayName) ) { wxLogError(_("wxWidgets could not open display. Exiting.")); return false; } Display *dpy = wxGlobalDisplay(); if (syncDisplay) XSynchronize(dpy, True); XSelectInput(dpy, XDefaultRootWindow(dpy), PropertyChangeMask); wxSetDetectableAutoRepeat( true ); if ( !wxAppBase::Initialize(argC, argV) ) return false;#if wxUSE_UNICODE // Glib's type system required by Pango g_type_init();#endif#if wxUSE_INTL wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());//.........这里部分代码省略.........
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:101,
注:本文中的wxSscanf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wxStrcmp函数代码示例 C++ wxSplit函数代码示例 |