Example #1
0
void SelectAllTreeItems(const wxString &searchStr, wxTreeCtrl *tvCtrl,
  int SelImageIdx, const wxTreeItemId& idParent, wxTreeItemIdValue cookie)
{
	wxTreeItemId id;
	if (!cookie)
		id = tvCtrl->GetFirstChild(idParent, cookie);
	else
		id = tvCtrl->GetNextChild(idParent, cookie);

	if (!id.IsOk())
		return;
	if (searchStr.Cmp(wxEmptyString) == 0)
		tvCtrl->SetItemImage(id, SelImageIdx);
	else
	{
		if (tvCtrl->GetItemText(id).Upper().Contains(searchStr.Upper()))
		{
			tvCtrl->SetItemImage(id, SelImageIdx);
		}
	}

	if (tvCtrl->ItemHasChildren(id))
		SelectAllTreeItems(searchStr, tvCtrl, SelImageIdx, id);

	SelectAllTreeItems(searchStr, tvCtrl, SelImageIdx, idParent, cookie);

}
Example #2
0
static int LoadCheatsFiles(const wxDirName& folderName, wxString& fileSpec, const wxString& friendlyName)
{
	if (!folderName.Exists()) {
		Console.WriteLn(Color_Red, L"The %s folder ('%s') is inaccessible. Skipping...", WX_STR(friendlyName), WX_STR(folderName.ToString()));
		return 0;
	}
	wxDir dir(folderName.ToString());

	int before = cheatnumber;
	wxString buffer;
	wxTextFile f;
	bool found = dir.GetFirst(&buffer, L"*", wxDIR_FILES);
	while (found) {
		if (buffer.Upper().Matches(fileSpec.Upper())) {
			Console.WriteLn(Color_Gray, L"Found %s file: '%s'", WX_STR(friendlyName), WX_STR(buffer));
			int before = cheatnumber;
			f.Open(Path::Combine(dir.GetName(), buffer));
			inifile_process(f);
			f.Close();
			int loaded = cheatnumber - before;
			Console.WriteLn((loaded ? Color_Green : Color_Gray), L"Loaded %d %s from '%s'", loaded, WX_STR(friendlyName), WX_STR(buffer));
		}
		found = dir.GetNext(&buffer);
	}

	return cheatnumber - before;
}
Example #3
0
bool EDA_ITEM::Replace( wxFindReplaceData& aSearchData, wxString& aText )
{
    wxCHECK_MSG( IsReplaceable(), false,
                 wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );

    wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();

    int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
                                    aSearchData.GetFindString() :
                                    aSearchData.GetFindString().Upper() );

    if( result == wxNOT_FOUND )
        return false;

    wxString prefix = aText.Left( result );
    wxString suffix;

    if( aSearchData.GetFindString().length() + result < aText.length() )
        suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );

    wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
                GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
                GetChars( suffix ) );

    aText = prefix + aSearchData.GetReplaceString() + suffix;

    return true;
}
// returns a list of EnumModuleSymbolInfo which contain the substr
std::list<EnumModulesSymbolInfo> enumModulesDlg::GetSymbolsContaining( wxString substr, wxString moduleSubstr )
{
    GetAllModules( ::GetCurrentProcessId() ); // you must get all modules before getting symbols

    std::list<EnumModulesSymbolInfo> result;
    std::set<EnumModuleInfo>::iterator i = moduleSymbols.begin();
    for( ; i != moduleSymbols.end(); ++i )
    {
        if( i->moduleName.Upper().Find(moduleSubstr.Upper()) != wxNOT_FOUND )
        {
            wxString     childName = wxString::Format("%08X", i->handle) + _(" - ") + i->moduleName;
            wxTreeItemId childId;

            // append only the symbols/modules which contain a substring
            std::set<EnumModulesSymbolInfo>::iterator j = i->symInfoArr.begin();
            for( ; j != i->symInfoArr.end(); ++j )
            {
                wxString tempSearchStr = j->name;
                tempSearchStr.MakeUpper();
                wxString tempInputStr = substr;
                tempInputStr.MakeUpper();
                if( tempInputStr.size() > 0 && tempSearchStr.Find(tempInputStr) != -1) // search for substring
                {
                    result.push_back(*j); // if substring is found, push it to the back
                }
            }
        }
    }

    return result;
}
KeynameConverter::ModifierList KeynameConverter::stringToKeyModifier(const wxString &keyModifier)
{
	ModifierList modifiers;

	// this search must be case-insensitive
	const wxString str = keyModifier.Upper();

	if (str.Contains(wxT("ALT+")))
	{
		modifiers.insert( ALT );
	}

	if (str.Contains(wxT("CTRL+")))
	{
		modifiers.insert( CTRL );
	}

	if (str.Contains(wxT("SHIFT+")))
	{
		modifiers.insert( SHIFT );
	}

	if (str.Contains(wxT("ANY+")))
	{
		modifiers.insert( ANY );
	}

	if (str.Contains(wxT("META+")))
	{
		modifiers.insert( META );
	}

	return modifiers;
}
Example #6
0
// -------------------------------------------------------------------------------- //
bool guSmartModeThread::CheckAddTrack( const wxString &artistname, const wxString &trackname, guTrackArray * tracks )
{
    //guLogMessage( wxT( "CheckAddTrack: '%s' - '%s'" ), artistname.c_str(), trackname.c_str() );
    // Check if we added the artist before
    if( !m_SmartAddedArtists || ( m_SmartAddedArtists->Index( artistname.Upper() ) == wxNOT_FOUND ) )
    {
        guTrack * Track = m_Db->FindSong( artistname, trackname, m_FilterAllowPlayList, m_FilterDenyPlayList );
        if( Track )
        {
            //guLogMessage( wxT( "Similar: '%s' - '%s'" ), artistname.c_str(), trackname.c_str() );
            // Check if we previously added the track
            if( !m_SmartAddedTracks || ( m_SmartAddedTracks->Index( Track->m_SongId ) == wxNOT_FOUND ) )
            {
                //guLogMessage( wxT( "Found Track '%s' '%s'" ), LenToString( Track->m_Length ).c_str(), SizeToString( Track->m_FileSize ).c_str() );
                Track->m_TrackMode = guTRACK_MODE_SMART;
                tracks->Add( Track );
                return true;
            }
            else
            {
                delete Track;
            }
        }
    }
    return false;
}
Example #7
0
//Process text messages from chat
void VotePanel::OnChatAction(const wxString& /*actionAuthor*/, const wxString& actionDescription)
{
	if (yesButton == nullptr || noButton == nullptr || dontCareButton == nullptr) {
		return;
	}

	//Do not show this panel if player in spectator mode
	if (player != nullptr) {
		if (player->GetBattleStatus().spectator == true) {
			return;
		}
	}

	wxString actionString = actionDescription.Upper();

	//Vote has been started
	if (actionString.find(VOTE_HAS_BEGAN) != std::string::npos) {
		onVoteBegins(actionDescription);
		return;
	}

	//Vote has ended
	if (actionString.find(VOTING_END) != std::string::npos || actionString.find(VOTE_CANCELLED) != std::string::npos ||
	    actionString.find(VOTE_CANCELLING) != std::string::npos) {
		onVoteStopped();
		return;
	}
}
Example #8
0
void EdiDocument::SetValue(size_t row, size_t col, const wxString& value) {
    wxASSERT(0 <= row);
    wxASSERT(0 <= col);
    wxASSERT(row < m_data.size());
    wxASSERT(col < m_data[row].size());

    if (0 == GetColumnDescriptor(col).GetType().CmpNoCase("text")) {
        m_data[row][col] = GetColumnDescriptor(col).PrepareValue(value.Upper().Trim());
    } else {
        m_data[row][col] = GetColumnDescriptor(col).PrepareValue(value);
    }

//dependences  ---------        
    const FieldDependence* dep = GetColumnDescriptor(col).GetDependence();
    if ( NULL != dep ) {
        int idx;
        for ( int i=0; i<GetColumnDescriptor(col).GetDependences().size(); i++ ) {
            idx = GetColumnIdx( GetColumnDescriptor(col).GetDependences()[i].field );
            if ( idx >= 0 && idx < m_data[row].size() ) {
                m_data[row][idx] = GetColumnDescriptor(col).GetDependenceValue(m_data[row][col], i);
            }
        }
    }
    m_changed = true;
};
Example #9
0
void APE_Tag::setItem(const wxString& key, const APE_Item& item)
{
	APE_Item* oldItem = (APE_Item*)m_itemListMap.Insert(key.Upper(), new APE_Item(item));
	if( oldItem )
	{
		delete oldItem;
	}
}
Example #10
0
void APE_Tag::removeItem(const wxString &key)
{
	APE_Item* i = (APE_Item*)m_itemListMap.Remove(key.Upper());
	if( i )
	{
		delete i;
	}
}
Example #11
0
wxString Upper(const wxString & input)
{
#ifdef __WXMSW__
	wxWCharBuffer buf = input.c_str();
	CharUpper(buf.data());
	return buf;
#else
	return input.Upper();
#endif
}
Example #12
0
// Tests for a filename extension in both upper and lower case, if the filesystem happens
// to be case-sensitive.
bool pxFileExists_WithExt( const wxFileName& filename, const wxString& ext )
{
	wxFileName part1 = filename;
	part1.SetExt( ext.Lower() );

	if (part1.FileExists()) return true;
	if (!wxFileName::IsCaseSensitive()) return false;

	part1.SetExt( ext.Upper() );
	return part1.FileExists();
}
Example #13
0
/*static*/
SqlTokenType SqlTokenizer::getKeywordTokenType(const wxString& word)
{
    if (word.IsEmpty())
        return tkIDENTIFIER;

    const KeywordToTokenMap& keywords = getKeywordToTokenMap();
    KeywordToTokenMap::const_iterator pos = keywords.find(word.Upper());
    if (pos != keywords.end())
        return (*pos).second;
    return tkIDENTIFIER;
}
Example #14
0
//! @brief Output a message said in the channel.
//!
//! @param who nick of the person who said something.
//! @param message the message to be outputted.
void ChatPanel::Said( const wxString& who, const wxString& message )
{
	wxString me = GetMe().GetNick();
	wxColour col;
	bool req_user = false;
	if ( who.Upper() == me.Upper() )
  {
		col = sett().GetChatColorMine();
	} else
	{
    // change the image of the tab to show new events
    SetIconHighlight( highlight_say );
    if ( m_type == CPT_User ) req_user = true;
    //process logic for custom word highlights
    if ( ContainsWordToHighlight( message ) )
    {
        req_user = sett().GetRequestAttOnHighlight();
        col = sett().GetChatColorHighlight();
    }
    else
        col = sett().GetChatColorNormal();
  }

	if ( ( who == _T( "MelBot" ) || who == _T( "[BOT]tizbacbridgebot" ) )
            && message.StartsWith( _T( "<" ) ) && message.Find( _T( ">" ) ) != wxNOT_FOUND )
    {
		wxString who2;
		wxString message2;
		who2 = message.BeforeFirst( '>' ).AfterFirst( '<' );
		if ( who != _T( "[BOT]tizbacbridgebot" ) ) who2 += _T( "@IRC" );
		//don't highlight if i'm talking from irc to channel
		if ( who2.Upper().BeforeLast(_T('@')) == me.Upper() )
		{
		    req_user = false;
		    col = sett().GetChatColorNormal();
		}
		message2 = message.AfterFirst( '>' );
		OutputLine( _T( " <" ) + who2 + _T( "> " ) + message2, col, sett().GetChatFont() );
	} else {
		OutputLine( _T( " <" ) + who + _T( "> " ) + message, col, sett().GetChatFont() );
	}


	if ( req_user ) {
		bool inactive = ui().GetActiveChatPanel() != this  || !wxTheApp->IsActive() ;
		ui().mw().RequestUserAttention();
		if ( inactive )
			UiEvents::GetNotificationEventSender().SendEvent(
					UiEvents::NotficationData( UiEvents::PrivateMessage,
											   wxString::Format( _T("%s:\n%s"), who.c_str(), message.Left(50).c_str() ) ) );
	}
}
Example #15
0
void RawData::SetStrFileType(const wxString &str_type)
{
    str_type.Upper();

    if (str_type == "COM")
        SetFileType(COM);
    else if (str_type == "ROM")
        SetFileType(ROM);
    else if (str_type == "BIN")
        SetFileType(BIN);
    else
        SetFileType(UNKNOWN);
}
Example #16
0
wxImage SpringUnitSync::GetSidePicture( const wxString& modname, const wxString& SideName ) const
{
  wxLogDebugFunc( _T("") );

	wxLogDebugFunc( _T("SideName = \"") + SideName + _T("\"") );
	wxString ImgName = _T("SidePics");
	ImgName += _T("/");
	ImgName += SideName.Upper();

	try {
		return GetImage( modname, ImgName + _T(".png"), false );
	}
	catch ( assert_exception& e){}
	return GetImage( modname, ImgName + _T(".bmp"), true );
}
    /**
     * Method FilterMatches
     *
     * Checks if the filter matches the given hotkey
     *
     * @return true on match (or if filter is disabled)
     */
    bool FilterMatches( const EDA_HOTKEY& aHotkey ) const
    {
        if( !m_valid )
            return true;

        // Match in the (translated) filter string
        const auto normedInfo = wxGetTranslation( aHotkey.m_InfoMsg ).Upper();
        if( normedInfo.Contains( m_normalised_filter_str ) )
            return true;

        const wxString keyName = KeyNameFromKeyCode( aHotkey.m_KeyCode );
        if( keyName.Upper().Contains( m_normalised_filter_str ) )
            return true;

        return false;
    }
Example #18
0
bool COMPONENT::MatchesFootprintFilters( const wxString& aFootprintName ) const
{
    if( m_footprintFilters.GetCount() == 0 )
        return true;

    // The matching is case insensitive
    wxString name = aFootprintName.Upper();

    for( unsigned ii = 0; ii < m_footprintFilters.GetCount(); ii++ )
    {
        if( name.Matches( m_footprintFilters[ii].Upper() ) )
            return true;
    }

    return false;
}
Example #19
0
bool wxExMatchesOneOf(const wxFileName& filename, const wxString& pattern)
{
    if (pattern == "*") return true; // asterix matches always.

    const wxString fullname_uppercase = filename.GetFullName().Upper();

    wxStringTokenizer tkz(pattern.Upper(), ";");

    while (tkz.HasMoreTokens())
    {
        const wxString token = tkz.GetNextToken();

        if (fullname_uppercase.Matches(token)) return true;
    }

    return false;
}
Example #20
0
bool CVariableStorage::add( const wxString& varName, const wxString& value, uint8_t type, bool bPersistent )
{
    // Name is always upper case
    wxString name = varName.Upper();
  name.Trim( true );
  name.Trim( false );

    CVSCPVariable *pVar = new CVSCPVariable;
  if ( NULL == pVar ) return false;

  pVar->setType( type );			// Store the type

    // Store persistence
    if ( bPersistent ) {
        pVar->setPersistent( true );
    }
    else {
        pVar->setPersistent( false );
    }

    pVar->setName( name );

    // Store value
    if ( !pVar->setValueFromString( type, value ) ) return false;

    // If persistent store persistant value
    if ( bPersistent ) {
        pVar->setPersistatValue( value );
    }

    if ( NULL != find( name ) ) {
        
        // The variable is there already - just change value
        m_hashVariable[ name ]->setValueFromString( m_hashVariable[ name ]->getType(), value );

        delete pVar;	// No use for the variable

    }
    else {
        // New variable
        m_hashVariable[ name ] = pVar;
        m_listVariable.Append( pVar );
    }

    return true;
}
Example #21
0
void SymbolList::ActionList::Find(const wxString& searchtext, bool refresh) {
	m_searchText = searchtext; // cache for later updates

	if (searchtext.empty()) {
		SetAllItems();
		return;
	}

	// Convert to upper case for case insensitive search
	const wxString text = searchtext.Upper();

	m_items.clear();
	vector<unsigned int> hlChars;
	for (unsigned int i = 0; i < m_actions.GetCount(); ++i) {
		const wxString& name = m_actions[i];
		unsigned int charpos = 0;
		wxChar c = text[charpos];
		hlChars.clear();

		for (unsigned int textpos = 0; textpos < name.size(); ++textpos) {
			if ((wxChar)wxToupper(name[textpos]) == c) {
				hlChars.push_back(textpos);
				++charpos;
				if (charpos == text.size()) {
					// All chars found.
					m_items.push_back(aItem(i, &m_actions[i], hlChars));
					break;
				}
				else c = text[charpos];
			}
		}
	}

	sort(m_items.begin(), m_items.end());

	Freeze();
	SetItemCount(m_items.size());
	if (refresh) {
		if (m_items.empty()) SetSelection(-1); // deselect
		else SetSelection(0);

		RefreshAll();
	}
	Thaw();
}
Example #22
0
//! @brief Output a message said in the channel.
//!
//! @param who nick of the person who said something.
//! @param message the message to be outputted.
void ChatPanel::Said(const wxString& who, const wxString& message)
{
	if (m_active_users.find(who) == m_active_users.end()) {
		m_active_users.insert(who);
	}

	wxString me = TowxString(GetMe().GetNick());
	wxColour col;
	bool req_user = false;
	if (who.Upper() == me.Upper()) {
		col = sett().GetChatColorMine();
	} else {
		// change the image of the tab to show new events
		SetIconHighlight(highlight_say);
		if (m_type == CPT_User)
			req_user = true;
		//process logic for custom word highlights
		if (ContainsWordToHighlight(message)) {
			req_user = sett().GetRequestAttOnHighlight();
			col = sett().GetChatColorHighlight();
		} else
			col = sett().GetChatColorNormal();
	}

	if ((who == cfg().ReadString(_T("/Channel/bridgebot"))) && (message.StartsWith(_T( "<" ))) && (message.Find(_T( ">" )) != wxNOT_FOUND)) {
		wxString who2;
		wxString message2;
		who2 = message.BeforeFirst('>').AfterFirst('<');
		message2 = message.AfterFirst('>');
		OutputLine(_T( "<" ) + who2 + _T( "> " ) + message2, col);
	} else {
		OutputLine(_T( "<" ) + who + _T( "> " ) + message, col);
	}


	if (req_user) {
		bool inactive = ui().GetActiveChatPanel() != this || !wxTheApp->IsActive();
		if (inactive) {
			ui().mw().RequestUserAttention();
			const wxString msg = wxString::Format(_T("%s:\n%s"), who.c_str(), message.Left(50).c_str());
			UiEvents::GetNotificationEventSender().SendEvent(
			    UiEvents::NotficationData(UiEvents::PrivateMessage, msg));
		}
	}
}
Example #23
0
/*---------------------------------------------------------------------------*/
bool wxGridColumnsTable::CheckName(const wxString& name, int row)
{
   wxChar c;
   // Vérification du nom
   for (size_t i = 0; i < name.Len(); i++)
   {
      c = name.GetChar(i);
      if (!wxIsalnum(c) && c != ('_') && c != (' '))
         return false;
   }
   // Vérifie que le nom est unique
   for (size_t i = 0; i < m_Columns.GetCount(); i++)
      if ((int)i != row)
         if (m_Columns[i]->GetName().Upper() == name.Upper())
            return false;

   return true;
}
Example #24
0
void FontTestCase::NativeFontInfoUserDesc()
{
    unsigned numFonts;
    const wxFont *pf = GetTestFonts(numFonts);
    for ( size_t n = 0; n < numFonts; n++ )
    {
        wxFont test(*pf++);

        const wxString& niud = test.GetNativeFontInfoUserDesc();
        CPPUNIT_ASSERT( !niud.empty() );
            // documented to be never empty

        wxFont temp2;
        CPPUNIT_ASSERT( temp2.SetNativeFontInfoUserDesc(niud) );
        CPPUNIT_ASSERT( temp2.IsOk() );

#ifdef __WXGTK__
        // Pango saves/restores all font info in the user-friendly string:
        WX_ASSERT_MESSAGE(
            ("Test #%lu failed; native info user desc was \"%s\" for test and \"%s\" for temp2", \
             n, niud, temp2.GetNativeFontInfoUserDesc()),
            temp2 == test );
#else
        // NOTE: as documented GetNativeFontInfoUserDesc/SetNativeFontInfoUserDesc
        //       are not granted to save/restore all font info.
        //       In fact e.g. the font family is not saved at all; test only those
        //       info which GetNativeFontInfoUserDesc() does indeed save:
        CPPUNIT_ASSERT_EQUAL( test.GetWeight(), temp2.GetWeight() );
        CPPUNIT_ASSERT_EQUAL( test.GetStyle(), temp2.GetStyle() );

        // if the original face name was empty, it means that any face name (in
        // this family) can be used for the new font so we shouldn't be
        // surprised to find that they differ in this case
        const wxString facename = test.GetFaceName();
        if ( !facename.empty() )
        {
            CPPUNIT_ASSERT_EQUAL( facename.Upper(), temp2.GetFaceName().Upper() );
        }

        CPPUNIT_ASSERT_EQUAL( test.GetPointSize(), temp2.GetPointSize() );
        CPPUNIT_ASSERT_EQUAL( test.GetEncoding(), temp2.GetEncoding() );
#endif
    }
}
Example #25
0
bool GetSizeForDevID(wxString &TargetDevID, int *WidthMm, int *HeightMm)
{
    HDEVINFO devInfo = SetupDiGetClassDevsEx(
        &GUID_CLASS_MONITOR, //class GUID
        NULL, //enumerator
        NULL, //HWND
        DIGCF_PRESENT, // Flags //DIGCF_ALLCLASSES|
        NULL, // device info, create a new one.
        NULL, // machine name, local machine
        NULL);// reserved
    
    if (NULL == devInfo)
        return false;
    
    bool bRes = false;
    
    for (ULONG i=0; ERROR_NO_MORE_ITEMS != GetLastError(); ++i)
    {
        SP_DEVINFO_DATA devInfoData;
        memset(&devInfoData,0,sizeof(devInfoData));
        devInfoData.cbSize = sizeof(devInfoData);
        
        if (SetupDiEnumDeviceInfo(devInfo,i,&devInfoData))
        {
            wchar_t    Instance[80];
            SetupDiGetDeviceInstanceId(devInfo, &devInfoData, Instance, MAX_PATH, NULL);
            wxString instance(Instance);
            if(instance.Upper().Find( TargetDevID.Upper() ) == wxNOT_FOUND )
                continue;
            
            HKEY hDevRegKey = SetupDiOpenDevRegKey(devInfo,&devInfoData,
                                                   DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ);
            
            if(!hDevRegKey || (hDevRegKey == INVALID_HANDLE_VALUE))
                continue;
            
            bRes = GetMonitorSizeFromEDID(hDevRegKey, WidthMm, HeightMm);
            
            RegCloseKey(hDevRegKey);
        }
    }
    SetupDiDestroyDeviceInfoList(devInfo);
    return bRes;
}
Example #26
0
int wxOdbcResultSet::LookupField(const wxString& strField)
{
    StringToIntMap::iterator SearchIterator = m_FieldLookupMap.find(strField.Upper());
    if (SearchIterator == m_FieldLookupMap.end())
    {
        wxString msg(_("Field '") + strField + _("' not found in the resultset"));
#if wxUSE_DATABASE_EXCEPTIONS
        wxDatabaseException error(wxDATABASE_FIELD_NOT_IN_RESULTSET, msg);
        throw error;
#else
        wxLogError(msg);
#endif
        //return -1;
    }
    else
    {
        return ((*SearchIterator).second+1); // Add +1 to make the result set 1-based rather than 0-based
    }
}
Example #27
0
bool ALMRunConfig::set(const wxString& name,const wxString &value)
{
	if (name.Cmp("Explorer") == 0)
		Explorer = value;
	else if (name.Cmp("Root") == 0)
	{
		Root = value;
		if (Root.empty())
			return false;
		wxSetWorkingDirectory(Root);
	}
	else if(name.Cmp("HotKey") == 0)
		HotKey = value;
	else if(name.Cmp("HotKeyReLoad") == 0)
		HotKeyReLoad = value;
	else
		return false;
	return ::wxSetEnv(wxT("ALMRUN_")+name.Upper(),value);
}
Example #28
0
wxString CreateFilter(wxString s)
{
    wxString Result;
    size_t i;

    if (s.IsEmpty())
        return wxT("");

    s.Prepend(wxT("*"));

    // Uppercase
    s = s.Upper();

    // Replace whitespace with kleene stars for better matching
    s.Replace(wxT(' '), wxT('*'));

    s += wxT("*");

    return s;
}
Example #29
0
void APE_Tag::addValue(const wxString &key, const wxString &value, bool replace)
{
	if(replace)
	{
		removeItem(key);
	}

	if(!value.IsEmpty())
	{
		APE_Item* i = lookupItem(key.Upper());
		if( i )
		{
			i->toStringList().Add(value);
		}
		else
		{
			setItem(key, APE_Item(key, value));
		}
	}
}
Example #30
0
wxChar HexToDec( const wxString& hex )
{
	wxChar result = 0;
	wxString str = hex.Upper();
	
	for ( size_t i = 0; i < str.Len(); ++i ) {
		result *= 16;
		wxChar cur = str.GetChar(i);
		
		if ( isdigit( cur ) ) {
			result += cur - wxT('0');
		} else if ( cur >= wxT('A') && cur <= wxT('F') ) {
			result += cur - wxT('A') + 10;
		} else {
			return wxT('\0');
		}
	}

	return result;
}