bool DescribeServiceRequest::Create(rude::CGI& cgi) { SetVersion(cgi["version"]); SetName(cgi["name"]); SetEncoding(cgi["encoding"]); return true; }
// ctor() wxSqliteDatabase::wxSqliteDatabase() : wxDatabase() { m_pDatabase = NULL; //&m_Database; //new sqlite3; wxCSConv conv(_("UTF-8")); SetEncoding(&conv); }
bool GetFeatureRequest::Create(rude::CGI& cgi, Map* pMap) { WebContext* pWebContext = augeGetWebContextInstance(); char parameter[AUGE_NAME_MAX]; SetVersion(cgi["version"]); //auge_web_parameter_encoding(, parameter, AUGE_NAME_MAX, pWebContext->IsIE()); SetTypeName(cgi["typeName"],true); auge_web_parameter_encoding(cgi["sourceName"], parameter, AUGE_NAME_MAX, pWebContext->IsIE()); SetSourceName(parameter); //auge_web_parameter_encoding(cgi["mapName"], parameter, AUGE_NAME_MAX, pWebContext->IsIE()); SetMapName(cgi["mapName"], true); SetOutputFormat(cgi["outputFormat"]); SetMaxFeatures(cgi["maxFeatures"]); SetOffset(cgi["offset"]); SetBBox(cgi["bbox"]); SetEncoding(cgi["encoding"]); m_filter = cgi["filter"]; m_fields = cgi["fields"]; //if(!m_extent.IsValid()) //{ // SetQuery(cgi["filter"],cgi["fields"], GetTypeName(), pMap); //} return true; }
// ctor() SqliteDatabaseLayer::SqliteDatabaseLayer() : DatabaseLayer() { m_pDatabase = NULL; //&m_Database; //new sqlite3; wxCSConv conv(_("UTF-8")); SetEncoding(&conv); }
CharMapEntry::CharMapEntry(wxString family, wxString style, float size, wxUint32 encoding, wxUint32 code) { SetFamily(family); SetStyle(style); SetSize(size); SetEncoding(encoding); SetCode(code); }
SqliteDatabaseLayer::SqliteDatabaseLayer(const wxString& strDatabase, bool mustExist /*= false*/) : DatabaseLayer() { m_pDatabase = NULL; //new sqlite3; wxCSConv conv(_("UTF-8")); SetEncoding(&conv); Open(strDatabase, mustExist); }
CIncomingConnection::CIncomingConnection(const CString& sHostname, unsigned short uPort, CListener::EAcceptType eAcceptType, const CString& sURIPrefix) : CZNCSock(sHostname, uPort), m_eAcceptType(eAcceptType), m_sURIPrefix(sURIPrefix) { // The socket will time out in 120 secs, no matter what. // This has to be fixed up later, if desired. SetTimeout(120, 0); SetEncoding("UTF-8"); EnableReadLine(); }
// open database bool wxPostgresDatabase::Open() { ResetErrorCodes(); wxCharBuffer serverCharBuffer; const char* pHost = NULL; wxCharBuffer pDatabaseBuffer = ConvertToUnicodeStream(m_strDatabase); const char* pDatabase = pDatabaseBuffer; wxCharBuffer userCharBuffer; const char* pUser = NULL; wxCharBuffer passwordCharBuffer; const char* pPassword = NULL; const char* pTty = NULL; const char* pOptions = NULL; wxCharBuffer portCharBuffer; const char* pPort = NULL; if (m_strServer != _("localhost") && m_strServer != wxT("")) { serverCharBuffer = ConvertToUnicodeStream(m_strServer); pHost = serverCharBuffer; } if (m_strUser != wxT("")) { userCharBuffer = ConvertToUnicodeStream(m_strUser); pUser = userCharBuffer; } if (m_strPassword != wxT("")) { passwordCharBuffer = ConvertToUnicodeStream(m_strPassword); pPassword = passwordCharBuffer; } if (m_strPort != wxT("")) { portCharBuffer = ConvertToUnicodeStream(m_strPort); pPort = portCharBuffer; } m_pDatabase = m_pInterface->GetPQsetdbLogin()(pHost, pPort, pOptions, pTty, pDatabase, pUser, pPassword); if (m_pInterface->GetPQstatus()((PGconn*)m_pDatabase) == CONNECTION_BAD) { SetErrorCode(wxPostgresDatabase::TranslateErrorCode(m_pInterface->GetPQstatus()((PGconn*)m_pDatabase))); SetErrorMessage(ConvertFromUnicodeStream(m_pInterface->GetPQerrorMessage()((PGconn*)m_pDatabase))); ThrowDatabaseException(); return false; } m_pInterface->GetPQsetClientEncoding()((PGconn*)m_pDatabase, "UTF-8"); wxCSConv conv((const wxChar*)(m_pInterface->GetPQencodingToChar()(m_pInterface->GetPQclientEncoding()((PGconn*)m_pDatabase)))); SetEncoding(&conv); return true; }
// ctor() TdsDatabaseLayer::TdsDatabaseLayer() : DatabaseLayer() { m_pDatabase = NULL; m_pLogin = NULL; m_pContext = NULL; m_nTdsVersion = TDS_80; wxCSConv conv(_("UTF-8")); SetEncoding(&conv); }
Instr& Instr::Copy ( Instr const& pInstr ) { SetMnemonic(pInstr.mMnemonic); SetEncoding(pInstr.mEncoding); return *this; }
BOOL vncBuffer::CheckBuffer() { // Get the screen format, in case it has changed m_desktop->FillDisplayInfo(&m_scrinfo); // If the client has not specified a pixel format then set one for it if (!m_clientfmtset) { m_clientfmtset = TRUE; m_clientformat = m_scrinfo.format; } // If the client has not selected an encoding then set one for it if (m_encoder == NULL) { if (!SetEncoding(rfbEncodingRaw)) return FALSE; } m_bytesPerRow = m_scrinfo.framebufferWidth * m_scrinfo.format.bitsPerPixel/8; // Check the client buffer is sufficient const UINT clientbuffsize = m_encoder->RequiredBuffSize(m_scrinfo.framebufferWidth, m_scrinfo.framebufferHeight); if (m_clientbuffsize != clientbuffsize) { if (m_clientbuff != NULL) { delete [] m_clientbuff; m_clientbuff = NULL; } m_clientbuffsize = 0; m_clientbuff = new BYTE [clientbuffsize]; if (m_clientbuff == NULL) { vnclog.Print(LL_INTERR, VNCLOG("unable to allocate client buffer[%d]\n"), clientbuffsize); return FALSE; } m_clientbuffsize = clientbuffsize; ZeroMemory(m_clientbuff, m_clientbuffsize); } // Take the main buffer pointer and size from vncDesktop m_mainbuff = m_desktop->MainBuffer(); m_mainrect = m_desktop->MainBufferRect(); m_mainsize = m_desktop->ScreenBuffSize(); vnclog.Print(LL_INTINFO, VNCLOG("local buffer=%d, remote buffer=%d\n"), m_mainsize, m_clientbuffsize); return TRUE; }
void wxFontBase::DoSetNativeFontInfo(const wxNativeFontInfo& info) { #ifdef wxNO_NATIVE_FONTINFO SetPointSize(info.pointSize); SetFamily(info.family); SetStyle(info.style); SetWeight(info.weight); SetUnderlined(info.underlined); SetFaceName(info.faceName); SetEncoding(info.encoding); #else (void)info; #endif }
bool TGztParser::ParseEncoding(Stroka* encoding_name) { DO(Consume("encoding")); DO(ConsumeString(encoding_name, "Expected a string naming the encoding to use.")); ECharset enc = CharsetByName(encoding_name->c_str()); if (enc == CODES_UNKNOWN) { AddError(Substitute("Unrecognized encoding \"$0\".", *encoding_name)); return false; } DO(Consume(";")); SetEncoding(enc); return true; }
TdsDatabaseLayer::TdsDatabaseLayer(const wxString& strServer, const wxString& strDatabase, const wxString& strUser, const wxString& strPassword, int nTdsVersion) : DatabaseLayer() { m_pDatabase = NULL; m_pLogin = NULL; m_pContext = NULL; wxCSConv conv(_("UTF-8")); SetEncoding(&conv); m_strServer = strServer; m_strLogin = strUser; m_strPassword = strPassword; m_nTdsVersion = nTdsVersion; Open(strDatabase); }
status_t FFont::Unflatten(type_code c, const void *buf, ssize_t size) { if( c != FONT_TYPE ) return B_BAD_TYPE; // Make sure buffer contains all data. If we later want // to add new attributes, we can make a more sophisticated // check to allow partial structures. if( size < sizeof(flat_font_data) ) return B_BAD_VALUE; // Easy reference to the buffer. flat_font_data* fdat = (flat_font_data*)buf; // Initialize from default font, just in case. *this = FFont(); // Set up family and style for font. SetFamilyAndStyle(fdat->family,fdat->style); // This is used as a temporary when byte-swapping floats. // Note that this assumes a float is 4 bytes. union { uint32 aslong; float asfloat; } swap; // Byte-swap size, shear, and rotation out of the flattened // structure. This is written for clarity more than speed, // since the additional overhead will be entirely subsumed // by everything else going on. swap.asfloat = fdat->size; swap.aslong = ntohl(swap.aslong); SetSize(swap.asfloat); swap.asfloat = fdat->shear; swap.aslong = ntohl(swap.aslong); SetShear(swap.asfloat); swap.asfloat = fdat->rotation; swap.aslong = ntohl(swap.aslong); SetRotation(swap.asfloat); // Byte-swap the remaining data from the flattened structure. SetFlags(ntohl(fdat->flags)); SetFace(ntohs(fdat->face)); SetSpacing(fdat->spacing); SetEncoding(fdat->encoding); SetMask(ntohl(fdat->mask)); return B_NO_ERROR; }
SingleLineWXMEdit::SingleLineWXMEdit(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : SimpleTextWXMEdit(parent, id, pos, size, style), m_LeftClickX(INT_MIN), m_LeftClickY(INT_MIN) { SetMarkActiveLine(false); HideScrollBars(); SetEncoding(wxT("UTF-32LE")); SetRecordCaretMovements(false); SetInsertSpacesInsteadOfTab(false); SetWantTab(false); LoadDefaultSyntaxScheme(); wxSizeEvent evt; OnSize(evt); }
FirebirdParameter::FirebirdParameter(FirebirdInterface* pInterface, XSQLVAR* pVar, const wxString& strValue, const wxCSConv* conv) { m_pInterface = pInterface; m_pParameter = pVar; m_strValue = strValue; SetEncoding(conv); // Set to SQL_TEXT manually m_pParameter->sqltype = SQL_TEXT; wxCharBuffer valueBuffer = ConvertToUnicodeStream(m_strValue); size_t length = GetEncodedStreamLength(m_strValue); wxStrncpy((wxChar*)m_pParameter->sqldata, (wxChar*)(const char*)valueBuffer, length); //(char*)(m_pParameter->sqldata) = valueBuffer; m_pParameter->sqllen = length; m_nNullFlag = 0; m_pParameter->sqlind = &m_nNullFlag; // NULL indicator }
EXC_TYPE CAttachInfo::SetInfo (LPCTSTR lpszName, const UINT32 ulSize, // may be zero LPCTSTR lpszPath, // may be NULL/empty LPCTSTR lpszType, LPCTSTR lpszSubType, LPCTSTR lpszCharSet, // may be NULL/empty const RFC822ENCCASE attEnc, LPCTSTR lpszDesc, LPCTSTR lpszID) { Cleanup(); EXC_TYPE exc=EOK; if (EOK == exc) exc = SetName(lpszName, FALSE); if (EOK == exc) exc = SetPath(lpszPath); if (EOK == exc) exc = SetContentType(lpszType, lpszSubType); if (EOK == exc) exc = SetCharSet(lpszCharSet); if (EOK == exc) exc = SetEncoding(attEnc); if (EOK == exc) exc = SetDescription(lpszDesc); if (EOK == exc) exc = SetID(lpszID); if (exc != EOK) Cleanup(); else m_ulSize = ulSize; return exc; }
bool CInetMessageT::Init( long Encoding ) { if ( m_From ) { delete m_From; m_From = NULL; } if ( m_To ) { delete m_To; m_To = NULL; } if ( m_Cc ) { delete m_Cc; m_Cc = NULL; } memset( &m_Info, 0, sizeof( m_Info ) ); m_Part = create CInetMsgPart( this, (LPSTR)m_Data.data, m_Data.size ); return SetEncoding( Encoding ); }
bool FirebirdDatabaseLayer::Open() { ResetErrorCodes(); // Set up the connection parameter string //int nParameterStringLength; //char szParameterString[512]; //char* pParameterString = szParameterString; // Firebird accepts all the other ISO_8859 encoding names but ISO-8859-1 needs a little tweaking to be recognized //wxString encodingName = wxLocale::GetSystemEncodingName(); //wxCharBuffer systemEncoding; //if (encodingName == wxT("ISO-8859-1")) // systemEncoding = "ISO8859_1"; //else // systemEncoding = encodingName.mb_str(*wxConvCurrent); wxCharBuffer systemEncoding = "UTF-8"; wxCSConv conv(_("UTF-8")); SetEncoding(&conv); //char* pDpb = new char(512); char* pDpb; short nDpbLength = 0; wxCharBuffer userCharBuffer = ConvertToUnicodeStream(m_strUser); wxCharBuffer passwordCharBuffer = ConvertToUnicodeStream(m_strPassword); wxCharBuffer roleCharBuffer = ConvertToUnicodeStream(m_strRole); pDpb = (char*)0; if (m_strRole == wxEmptyString) { #ifdef wxUSE_UNICODE m_pInterface->GetIscExpandDpb()(&pDpb, &nDpbLength, isc_dpb_user_name, (const char*)userCharBuffer, isc_dpb_password, (const char*)passwordCharBuffer, isc_dpb_lc_ctype, (const char*)systemEncoding, NULL); #else m_pInterface->GetIscExpandDpb()(&pDpb, &nDpbLength, isc_dpb_user_name, (const char*)userCharBuffer, isc_dpb_password, (const char*)m_strPassword.c_str(), isc_dpb_lc_ctype, (const char*)systemEncoding, NULL); #endif } else { #ifdef wxUSE_UNICODE m_pInterface->GetIscExpandDpb()(&pDpb, &nDpbLength, isc_dpb_user_name, (const char*)userCharBuffer, isc_dpb_password, (const char*)passwordCharBuffer, isc_dpb_lc_ctype, (const char*)systemEncoding, isc_dpb_sql_role_name, (const char*)roleCharBuffer, NULL); #else m_pInterface->GetIscExpandDpb()(&pDpb, &nDpbLength, isc_dpb_user_name, (const char*)userCharBuffer, isc_dpb_password, (const char*)m_strPassword.c_str(), isc_dpb_lc_ctype, (const char*)systemEncoding, isc_dpb_sql_role_name, (const char*)roleCharBuffer, NULL); #endif } // Combine the server and databsae path strings to pass into the isc_attach_databse function wxString strDatabaseUrl; if (m_strServer.IsEmpty()) strDatabaseUrl = m_strDatabase; // Embedded database, just supply the file name else strDatabaseUrl = m_strServer + _(":") + m_strDatabase; m_pDatabase = NULL; m_pTransaction = NULL; wxCharBuffer urlBuffer = ConvertToUnicodeStream(strDatabaseUrl); isc_db_handle pDatabase = (isc_db_handle)m_pDatabase; //int nReturn = m_pInterface->GetIscAttachDatabase()(*(ISC_STATUS_ARRAY*)m_pStatus, 0, urlBuffer, &((isc_db_handle)m_pDatabase), nParameterStringLength, szParameterString); int nReturn = m_pInterface->GetIscAttachDatabase()(*(ISC_STATUS_ARRAY*)m_pStatus, 0, (char*)(const char*)urlBuffer, &pDatabase, nDpbLength, pDpb); m_pDatabase = pDatabase; if (nReturn != 0) { InterpretErrorCodes(); ThrowDatabaseException(); return false; } return true; }
CslCharEncoding::CslCharEncoding(const wxString& name) : m_conv(NULL) { SetEncoding(name); }
bool GetFeatureRequest::Create(XDocument* pxDoc) { XElement *pxRoot = NULL; XAttribute *pxAttr = NULL; m_pxDoc = pxDoc; pxRoot = pxDoc->GetRootNode(); pxAttr = pxRoot->GetAttribute("version"); if(pxAttr!=NULL) { SetVersion(pxAttr->GetValue()); } pxAttr = pxRoot->GetAttribute("mapName"); if(pxAttr!=NULL) { SetMapName(pxAttr->GetValue(),false); } pxAttr = pxRoot->GetAttribute("sourceName"); if(pxAttr!=NULL) { SetSourceName(pxAttr->GetValue()); } pxAttr = pxRoot->GetAttribute("outputFormat"); if(pxAttr!=NULL) { GLogger* pLogger = augeGetLoggerInstance(); pLogger->Trace(pxAttr->GetValue(),__FILE__,__LINE__); SetOutputFormat(pxAttr->GetValue()); } pxAttr = pxRoot->GetAttribute("maxFeatures"); if(pxAttr!=NULL) { SetMaxFeatures(pxAttr->GetValue()); } pxAttr = pxRoot->GetAttribute("offset"); if(pxAttr!=NULL) { SetOffset(pxAttr->GetValue()); } pxAttr = pxRoot->GetAttribute("encoding"); if(pxAttr!=NULL) { SetEncoding(pxAttr->GetValue()); } XElement* pxQuery = (XElement*)pxRoot->GetFirstChild("Query"); if(pxQuery==NULL) { return NULL; } pxAttr = pxQuery->GetAttribute("typeName"); if(pxAttr==NULL) { return false; } SetTypeName(pxAttr->GetValue(), false); if(m_type_name.empty()) { return false; } //Layer* pLayer = NULL; //pLayer = pMap->GetLayer(m_type_name.c_str()); //if(pLayer==NULL) //{ // return false; //} //if(pLayer->GetType()!=augeLayerFeature) //{ // return false; //} //FeatureLayer* pFLayer = NULL; //FeatureClass* pFeatureClass = NULL; //pFLayer = static_cast<FeatureLayer*>(pLayer); //pFeatureClass = pFLayer->GetFeatureClass(); //if(pFeatureClass==NULL) //{ // return false; //} //FilterFactory* pFilterFactory = augeGetFilterFactoryInstance(); //m_pQuery = pFilterFactory->CreateQuery(); //XElement* pxFilter = (XElement*)pxQuery->GetFirstChild("Filter"); //if(pxFilter!=NULL) //{ // GFilter* pFilter = NULL; // FilterReader* reader = pFilterFactory->CreateFilerReader(pFeatureClass->GetFields()); // pFilter = reader->Read(pxFilter); // m_pQuery->SetFilter(pFilter); //} ////PropertyName //char field_name[AUGE_NAME_MAX]; //const char* property_name; //XNode* pxNode = NULL; //XNodeSet* pxNodeSet = pxQuery->GetChildren("PropertyName"); //pxNodeSet->Reset(); //while((pxNode=pxNodeSet->Next())!=NULL) //{ // property_name = pxNode->GetContent(); // ParseFieldName(property_name, field_name, AUGE_NAME_MAX); // m_pQuery->AddSubField(field_name); //} //pxNodeSet->Release(); return true; }
CharMapEntry::CharMapEntry() { SetSize(-1.0f); SetEncoding(0); SetCode(0); }
bool wxNativeFontInfo::FromUserString(const wxString& s) { // reset to the default state Init(); // parse a more or less free form string // // TODO: we should handle at least the quoted facenames wxStringTokenizer tokenizer(s, _T(";, "), wxTOKEN_STRTOK); wxString face; unsigned long size; bool weightfound = false, pointsizefound = false; #if wxUSE_FONTMAP bool encodingfound = false; #endif while ( tokenizer.HasMoreTokens() ) { wxString token = tokenizer.GetNextToken(); // normalize it token.Trim(true).Trim(false).MakeLower(); // look for the known tokens if ( token == _T("underlined") || token == _("underlined") ) { SetUnderlined(true); } else if ( token == _T("light") || token == _("light") ) { SetWeight(wxFONTWEIGHT_LIGHT); weightfound = true; } else if ( token == _T("bold") || token == _("bold") ) { SetWeight(wxFONTWEIGHT_BOLD); weightfound = true; } else if ( token == _T("italic") || token == _("italic") ) { SetStyle(wxFONTSTYLE_ITALIC); } else if ( token.ToULong(&size) ) { SetPointSize(size); pointsizefound = true; } else { #if wxUSE_FONTMAP // try to interpret this as an encoding wxFontEncoding encoding = wxFontMapper::Get()->CharsetToEncoding(token, false); if ( encoding != wxFONTENCODING_DEFAULT && encoding != wxFONTENCODING_SYSTEM ) // returned when the recognition failed { SetEncoding(encoding); encodingfound = true; } else { #endif // wxUSE_FONTMAP // assume it is the face name if ( !face.empty() ) { face += _T(' '); } face += token; // skip the code which resets face below continue; #if wxUSE_FONTMAP } #endif // wxUSE_FONTMAP } // if we had had the facename, we shouldn't continue appending tokens // to it (i.e. "foo bold bar" shouldn't result in the facename "foo // bar") if ( !face.empty() ) { // NB: the check on the facename is implemented in wxFontBase::SetFaceName // and not in wxNativeFontInfo::SetFaceName thus we need to explicitely // call here wxFontEnumerator::IsValidFacename if (!wxFontEnumerator::IsValidFacename(face) || !SetFaceName(face)) SetFaceName(wxNORMAL_FONT->GetFaceName()); face.clear(); } } // we might not have flushed it inside the loop if ( !face.empty() ) { // NB: the check on the facename is implemented in wxFontBase::SetFaceName // and not in wxNativeFontInfo::SetFaceName thus we need to explicitely // call here wxFontEnumerator::IsValidFacename if (!wxFontEnumerator::IsValidFacename(face) || !SetFaceName(face)) SetFaceName(wxNORMAL_FONT->GetFaceName()); } // set point size to default value if size was not given if ( !pointsizefound ) SetPointSize(wxNORMAL_FONT->GetPointSize()); // set font weight to default value if weight was not given if ( !weightfound ) SetWeight(wxFONTWEIGHT_NORMAL); #if wxUSE_FONTMAP // set font encoding to default value if encoding was not given if ( !encodingfound ) SetEncoding(wxFONTENCODING_SYSTEM); #endif // wxUSE_FONTMAP return true; }
bool wxNativeFontInfo::FromUserString(const wxString& s) { // reset to the default state Init(); // ToUserString() will quote the facename if it contains spaces, commas // or semicolons: we must be able to understand that quoted text is // a single token: wxString toparse(s); // parse a more or less free form string wxStringTokenizer tokenizer(toparse, wxT(";, "), wxTOKEN_STRTOK); wxString face; unsigned long size; bool weightfound = false, pointsizefound = false; #if wxUSE_FONTMAP bool encodingfound = false; #endif bool insideQuotes = false; while ( tokenizer.HasMoreTokens() ) { wxString token = tokenizer.GetNextToken(); // normalize it token.Trim(true).Trim(false).MakeLower(); if (insideQuotes) { if (token.StartsWith("'") || token.EndsWith("'")) { insideQuotes = false; // add this last token to the facename: face += " " + token; // normalize facename: face = face.Trim(true).Trim(false); face.Replace("'", ""); continue; } } else { if (token.StartsWith("'")) insideQuotes = true; } // look for the known tokens if ( insideQuotes ) { // only the facename may be quoted: face += " " + token; continue; } if ( token == wxT("underlined") || token == _("underlined") ) { SetUnderlined(true); } else if ( token == wxT("strikethrough") || token == _("strikethrough") ) { SetStrikethrough(true); } else if ( token == wxT("light") || token == _("light") ) { SetWeight(wxFONTWEIGHT_LIGHT); weightfound = true; } else if ( token == wxT("bold") || token == _("bold") ) { SetWeight(wxFONTWEIGHT_BOLD); weightfound = true; } else if ( token == wxT("italic") || token == _("italic") ) { SetStyle(wxFONTSTYLE_ITALIC); } else if ( token.ToULong(&size) ) { SetPointSize(size); pointsizefound = true; } else { #if wxUSE_FONTMAP // try to interpret this as an encoding wxFontEncoding encoding = wxFontMapper::Get()->CharsetToEncoding(token, false); if ( encoding != wxFONTENCODING_DEFAULT && encoding != wxFONTENCODING_SYSTEM ) // returned when the recognition failed { SetEncoding(encoding); encodingfound = true; } else { #endif // wxUSE_FONTMAP // assume it is the face name if ( !face.empty() ) { face += wxT(' '); } face += token; // skip the code which resets face below continue; #if wxUSE_FONTMAP } #endif // wxUSE_FONTMAP } // if we had had the facename, we shouldn't continue appending tokens // to it (i.e. "foo bold bar" shouldn't result in the facename "foo // bar") if ( !face.empty() ) { wxString familyStr; if ( face.EndsWith(" family", &familyStr) ) { // it's not a facename but rather a font family wxFontFamily family; if ( familyStr == "decorative" ) family = wxFONTFAMILY_DECORATIVE; else if ( familyStr == "roman" ) family = wxFONTFAMILY_ROMAN; else if ( familyStr == "script" ) family = wxFONTFAMILY_SCRIPT; else if ( familyStr == "swiss" ) family = wxFONTFAMILY_SWISS; else if ( familyStr == "modern" ) family = wxFONTFAMILY_MODERN; else if ( familyStr == "teletype" ) family = wxFONTFAMILY_TELETYPE; else return false; SetFamily(family); } // NB: the check on the facename is implemented in wxFontBase::SetFaceName // and not in wxNativeFontInfo::SetFaceName thus we need to explicitly // call here wxFontEnumerator::IsValidFacename else if ( #if wxUSE_FONTENUM !wxFontEnumerator::IsValidFacename(face) || #endif // wxUSE_FONTENUM !SetFaceName(face) ) { SetFaceName(wxNORMAL_FONT->GetFaceName()); } face.clear(); } } // we might not have flushed it inside the loop if ( !face.empty() ) { // NB: the check on the facename is implemented in wxFontBase::SetFaceName // and not in wxNativeFontInfo::SetFaceName thus we need to explicitly // call here wxFontEnumerator::IsValidFacename if ( #if wxUSE_FONTENUM !wxFontEnumerator::IsValidFacename(face) || #endif // wxUSE_FONTENUM !SetFaceName(face) ) { SetFaceName(wxNORMAL_FONT->GetFaceName()); } } // set point size to default value if size was not given if ( !pointsizefound ) SetPointSize(wxNORMAL_FONT->GetPointSize()); // set font weight to default value if weight was not given if ( !weightfound ) SetWeight(wxFONTWEIGHT_NORMAL); #if wxUSE_FONTMAP // set font encoding to default value if encoding was not given if ( !encodingfound ) SetEncoding(wxFONTENCODING_SYSTEM); #endif // wxUSE_FONTMAP return true; }
nsresult nsDirIndexParser::ProcessData(nsIRequest *aRequest, nsISupports *aCtxt) { if (!mListener) return NS_ERROR_FAILURE; PRInt32 numItems = 0; while(PR_TRUE) { ++numItems; PRInt32 eol = mBuf.FindCharInSet("\n\r", mLineStart); if (eol < 0) break; mBuf.SetCharAt(PRUnichar('\0'), eol); const char *line = mBuf.get() + mLineStart; PRInt32 lineLen = eol - mLineStart; mLineStart = eol + 1; if (lineLen >= 4) { nsresult rv; const char *buf = line; if (buf[0] == '1') { if (buf[1] == '0') { if (buf[2] == '0' && buf[3] == ':') { // 100. Human-readable comment line. Ignore } else if (buf[2] == '1' && buf[3] == ':') { // 101. Human-readable information line. mComment.Append(buf + 4); char *value = ((char *)buf) + 4; nsUnescape(value); mListener->OnInformationAvailable(aRequest, aCtxt, NS_ConvertUTF8toUTF16(value)); } else if (buf[2] == '2' && buf[3] == ':') { // 102. Human-readable information line, HTML. mComment.Append(buf + 4); } } } else if (buf[0] == '2') { if (buf[1] == '0') { if (buf[2] == '0' && buf[3] == ':') { // 200. Define field names rv = ParseFormat(buf + 4); if (NS_FAILED(rv)) { return rv; } } else if (buf[2] == '1' && buf[3] == ':') { // 201. Field data nsCOMPtr<nsIDirIndex> idx = do_CreateInstance("@mozilla.org/dirIndex;1",&rv); if (NS_FAILED(rv)) return rv; rv = ParseData(idx, ((char *)buf) + 4); if (NS_FAILED(rv)) { return rv; } mListener->OnIndexAvailable(aRequest, aCtxt, idx); } } } else if (buf[0] == '3') { if (buf[1] == '0') { if (buf[2] == '0' && buf[3] == ':') { // 300. Self-referring URL } else if (buf[2] == '1' && buf[3] == ':') { // 301. OUR EXTENSION - encoding int i = 4; while (buf[i] && nsCRT::IsAsciiSpace(buf[i])) ++i; if (buf[i]) SetEncoding(buf+i); } } } } } return NS_OK; }
bool CFarInetMessage::setEncoding( LPCSTR encoding ) { return encoding ? SetEncoding( getCharacterTable( encoding ) ) : false; }