本文整理汇总了C++中CStdString::ToUpper方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdString::ToUpper方法的具体用法?C++ CStdString::ToUpper怎么用?C++ CStdString::ToUpper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdString
的用法示例。
在下文中一共展示了CStdString::ToUpper方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindMappedDevice
bool CKeymapLoader::FindMappedDevice(const CStdString& deviceId, CStdString& keymapName)
{
CStdString deviceIdTemp = deviceId;
std::map<CStdString, CStdString>::iterator deviceIdIt = deviceMappings.find(deviceIdTemp.ToUpper());
if (deviceIdIt == deviceMappings.end())
return false;
keymapName = deviceIdIt->second;
return true;
}
示例2: OnJumpSMS
void CGUIBaseContainer::OnJumpSMS(int letter)
{
static const char letterMap[8][6] = { "ABC2", "DEF3", "GHI4", "JKL5", "MNO6", "PQRS7", "TUV8", "WXYZ9" };
// only 2..9 supported
if (letter < 2 || letter > 9 || !m_letterOffsets.size())
return;
const CStdString letters = letterMap[letter - 2];
// find where we currently are
int offset = CorrectOffset(m_offset, m_cursor);
unsigned int currentLetter = 0;
while (currentLetter + 1 < m_letterOffsets.size() && m_letterOffsets[currentLetter + 1].first <= offset)
currentLetter++;
// now switch to the next letter
CStdString current = m_letterOffsets[currentLetter].second;
int startPos = (letters.Find(current.ToUpper()) + 1) % letters.size();
// now jump to letters[startPos], or another one in the same range if possible
int pos = startPos;
while (true)
{
// check if we can jump to this letter
for (unsigned int i = 0; i < m_letterOffsets.size(); i++)
{
if (m_letterOffsets[i].second.ToLower() == letters.Mid(pos, 1).ToLower())
{
SelectItem(m_letterOffsets[i].first);
return;
}
}
pos = (pos + 1) % letters.size();
if (pos == startPos)
return;
}
}
示例3: Load
bool CKaraokeLyricsTextUStar::Load()
{
// Header parameters
CStdString coverimage, bgimage;
int bpm = 0, startoffsetms = 0;
bool relative = false;
// Read the text file
std::vector< CStdString > lines = readFile( m_lyricsFile, true );
if ( lines.size() == 0 )
return false;
// Clear the lyrics array
clearLyrics();
// Parse and validate the header according to
// http://ultrastardeluxe.xtremeweb-hosting.net/wiki/doku.php?id=editor:txt_file
unsigned int idx = 0;
for ( ; idx < lines.size() && lines[idx][0] == '#'; idx++ )
{
// Parse into key:value
int offset = lines[idx].Find( ':' );
if ( offset == -1 )
{
CLog::Log( LOGERROR, "UStar lyric loader: invalid line '%s', no semicolon", lines[idx].c_str() );
return false;
}
CStdString key = lines[idx].Mid( 1, offset - 1 );
CStdString value = lines[idx].Mid( offset + 1 );
if ( key == "TITLE" )
m_songName = value;
else if ( key == "ARTIST" )
m_artist = value;
else if ( key == "VIDEO" )
{
CStdString videopath;
URIUtils::GetDirectory( m_lyricsFile, videopath );
m_videoFile = videopath + value;
if ( !XFILE::CFile::Exists( m_videoFile ) )
{
CLog::Log( LOGERROR, "UStar lyric loader: VIDEO entry is present, but video file %s is not found", m_videoFile.c_str() );
m_videoFile.clear();
}
}
else if ( key == "COVER" )
coverimage = value;
else if ( key == "BACKGROUND" )
bgimage = value;
else if ( key == "VIDEOGAP" )
m_videoOffset = atoi( value.c_str() );
else if ( key == "BPM" )
bpm = atoi( value.c_str() );
else if ( key == "GAP" )
startoffsetms = atoi( value.c_str() );
else if ( key == "RELATIVE" )
relative = (value.ToUpper() == "YES" );
else if ( key == "LANGUAGE" || key == "EDITION" || key == "GENRE" || key == "YEAR" || key == "MP3" )
{
; // do nothing
}
else
CLog::Log( LOGWARNING, "UStar lyric loader: unsupported keyword '%s'", key.c_str() );
}
// BPM must be defined
if ( bpm == 0 )
{
CLog::Log( LOGERROR, "UStar lyric loader: BPM is not defined, file is invalid" );
return false;
}
// Should be more lines
if ( idx == lines.size() )
{
CLog::Log( LOGERROR, "UStar lyric loader: no lyrics found besides the header" );
return false;
}
double beatstep = 60.0 / bpm / 4.0;
CLog::Log( LOGDEBUG, "UStar lyric loader: found valid lyrics, BPM is %d (%g)", bpm, beatstep );
// Now parse the words/notes part
int lyric_flags = 0;
for ( ; idx < lines.size() && lines[idx][0] != 'E'; idx++ )
{
char type = lines[idx][0];
// A valid type should be followed by space
if ( type != 'F' && type != ':' && type != '*' && type != '-' && lines[idx][1] != ' ' )
{
CLog::Log( LOGERROR, "UStar lyric loader: invalid line '%s', bad note type or no tail space", lines[idx].c_str() );
return false;
}
//.........这里部分代码省略.........
示例4: EnumDevices
UINT EnumDevices( CStdStrArray &devices, TCHAR * cPrefix )
{
CStdString sPrefix( cPrefix );
CStdString sCurrDev;
int i=0;
//Make sure we clear out any elements which may already be in the array
devices.clear();
//Determine what OS we are running on
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
BOOL bGetVer = GetVersionEx(&osvi);
//On NT use the QueryDosDevice API
if (bGetVer && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT))
{
//Use QueryDosDevice to look for all devices of the form COMx. This is a better
//solution as it means that no devices have to be opened at all.
TCHAR szDevices[65535];
DWORD dwChars = QueryDosDevice(NULL, szDevices, 65535);
if (dwChars)
{
for (;;)
{
//Get the current device name
TCHAR* pszCurrentDevice = &szDevices[i];
sCurrDev = &szDevices[i];
sCurrDev.ToUpper();
//If it looks like "COMX" then
//add it to the array which will be returned
int nLen = sCurrDev.GetLength();
if (nLen > sPrefix.GetLength() && _tcsnicmp(sCurrDev.c_str(), sPrefix.c_str() , sPrefix.GetLength() ) == 0)
{
//Work out the port number
devices.push_back( CStdString(_T("\\\\.\\")) + CStdString( pszCurrentDevice ) );
}
// Go to next NULL character
i+= sCurrDev.GetLength();
//while(szDevices[i] != _T('\0'))
// i++;
// Bump pointer to the next string
i++;
// The list is double-NULL terminated, so if the character is
// now NULL, we're at the end
if (szDevices[i] == _T('\0'))
break;
}
}
else
{
return -1;
}
}
else
{
//On 95/98 open up each port to determine their existence
//Up to 255 COM devices are supported so we iterate through all of them seeing
//if we can open them or if we fail to open them, get an access denied or general error error.
//Both of these cases indicate that there is a COM port at that number.
for (UINT i=1; i<256; i++)
{
//Form the Raw device name
CStdString sDev;
sDev.Format(_T("\\\\.\\%s%d"), sPrefix.c_str(), i);
//Try to open the port
BOOL bSuccess = FALSE;
HANDLE hPort = ::CreateFile(sDev.c_str(), GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
if (hPort == INVALID_HANDLE_VALUE)
{
DWORD dwError = GetLastError();
//Check to see if the error was because some other app had the port open or a general failure
if (dwError == ERROR_ACCESS_DENIED || dwError == ERROR_GEN_FAILURE)
bSuccess = TRUE;
}
else
{
//The port was opened successfully
bSuccess = TRUE;
//Don't forget to close the port, since we are going to do nothing with it anyway
CloseHandle(hPort);
}
//Add the port number to the array which will be returned
if (bSuccess)
devices.push_back(sDev.c_str());
}
}
return devices.size();
//.........这里部分代码省略.........
示例5: ParseText
void CGUITextLayout::ParseText(const CStdString &text, vector<DWORD> &parsedText)
{
if (!m_font)
return;
// run through the string, searching for:
// [B] or [/B] -> toggle bold on and off
// [I] or [/I] -> toggle italics on and off
// [COLOR ffab007f] or [/COLOR] -> toggle color on and off
// [CAPS <option>] or [/CAPS] -> toggle capatilization on and off
DWORD currentStyle = m_font->GetStyle(); // start with the default font's style
DWORD currentColor = 0;
stack<DWORD> colorStack;
colorStack.push(0);
// these aren't independent, but that's probably not too much of an issue
// eg [UPPERCASE]Glah[LOWERCASE]FReD[/LOWERCASE]Georeg[/UPPERCASE] will work (lower case >> upper case)
// but [LOWERCASE]Glah[UPPERCASE]FReD[/UPPERCASE]Georeg[/LOWERCASE] won't
#define FONT_STYLE_UPPERCASE 4
#define FONT_STYLE_LOWERCASE 8
int startPos = 0;
size_t pos = text.Find('[');
while (pos != CStdString::npos && pos + 1 < text.size())
{
DWORD newStyle = 0;
DWORD newColor = currentColor;
bool newLine = false;
// have a [ - check if it's an ON or OFF switch
bool on(true);
int endPos = pos++; // finish of string
if (text[pos] == '/')
{
on = false;
pos++;
}
// check for each type
if (text.Mid(pos,2) == "B]")
{ // bold - finish the current text block and assign the bold state
newStyle = FONT_STYLE_BOLD;
pos += 2;
}
else if (text.Mid(pos,2) == "I]")
{ // italics
newStyle = FONT_STYLE_ITALICS;
pos += 2;
}
else if (text.Mid(pos,10) == "UPPERCASE]")
{
newStyle = FONT_STYLE_UPPERCASE;
pos += 10;
}
else if (text.Mid(pos,10) == "LOWERCASE]")
{
newStyle = FONT_STYLE_LOWERCASE;
pos += 10;
}
else if (text.Mid(pos,3) == "CR]" && on)
{
newLine = true;
pos += 3;
}
else if (text.Mid(pos,5) == "COLOR")
{ // color
size_t finish = text.Find("]", pos + 5);
if (on && finish != CStdString::npos)
{ // create new color
newColor = m_colors.size();
m_colors.push_back(g_colorManager.GetColor(text.Mid(pos + 5, finish - pos - 5)));
colorStack.push(newColor);
}
else if (!on && finish == pos + 5)
{ // revert to previous color
if (colorStack.size() > 1)
colorStack.pop();
newColor = colorStack.top();
}
pos = finish + 1;
}
if (newStyle || newColor != currentColor || newLine)
{ // we have a new style or a new color, so format up the previous segment
CStdString subText = text.Mid(startPos, endPos - startPos);
if (currentStyle & FONT_STYLE_UPPERCASE)
subText.ToUpper();
if (currentStyle & FONT_STYLE_LOWERCASE)
subText.ToLower();
AppendToUTF32(subText, ((currentStyle & 3) << 24) | (currentColor << 16), parsedText);
if (newLine)
parsedText.push_back(L'\n');
// and switch to the new style
startPos = pos;
currentColor = newColor;
if (on)
currentStyle |= newStyle;
else
currentStyle &= ~newStyle;
//.........这里部分代码省略.........