void TextComponent::calculateExtent() { if(mAutoCalcExtent.x()) { mSize = mFont->sizeText(mUppercase ? strToUpper(mText) : mText, mLineSpacing); }else{ if(mAutoCalcExtent.y()) { mSize[1] = mFont->sizeWrappedText(mUppercase ? strToUpper(mText) : mText, getSize().x(), mLineSpacing).y(); } } }
VCProject* SBTarget::constructVCProject(VSTemplateProject* projTemplate) { // Create the project VCProject* proj = new VCProject(projTemplate); // Get path to WinObjC SDK const BuildSettings& projBS = m_parentProject.getBuildSettings(); String useRelativeSdkPath = projBS.getValue("VSIMPORTER_RELATIVE_SDK_PATH"); String sdkDir = projBS.getValue("WINOBJC_SDK_ROOT"); // Try to create a relative path to the SDK, if requested if (strToUpper(useRelativeSdkPath) == "YES") { String projectDir = sb_dirname(projTemplate->getPath()); sdkDir = getRelativePath(projectDir, sdkDir); } proj->addGlobalProperty("WINOBJC_SDK_ROOT", platformPath(sdkDir), "'$(WINOBJC_SDK_ROOT)' == ''"); // Set configuration properties for (auto configBS : m_buildSettings) { VCProjectConfiguration *projConfig = proj->addConfiguration(configBS.first); String productName = configBS.second->getValue("PRODUCT_NAME"); if (!productName.empty()) { projConfig->setProperty("TargetName", productName); } } // Write files associated with each build phase SBBuildPhaseList::const_iterator phaseIt = m_buildPhases.begin(); for (; phaseIt != m_buildPhases.end(); ++phaseIt) (*phaseIt)->writeVCProjectFiles(*proj); return proj; }
int16 Op_LoadBackground() { int result = 0; char bgName[36] = ""; char *ptr; int bgIdx; ptr = (char *) popPtr(); Common::strlcpy(bgName, ptr, sizeof(bgName)); bgIdx = popVar(); if (bgIdx >= 0 || bgIdx < NBSCREENS) { strToUpper(bgName); gfxModuleData_gfxWaitVSync(); gfxModuleData_gfxWaitVSync(); result = loadBackground(bgName, bgIdx); gfxModuleData_addDirtyRect(Common::Rect(0, 0, 320, 200)); } changeCursor(CURSOR_NORMAL); return result; }
LPCTSTR CFileName::GetType(const __int8 _case /* = 0*/) { if (!filename || (m_attribute & CFN_NOTFILE)) return _T(""); if (ext && _case == m_iLastExtCase) return ext; LPTSTR ptr = filename; ptr = _tcsrchr(ptr, _T('.')); if (ptr) { ptr++; if (ext) free(ext); ext = (LPTSTR) malloc(sizeof(TCHAR) * (_tcslen(ptr) + 1)); switch (_case) { case 1: strToUpper(ext, ptr); break; case -1: strToLower(ext, ptr); break; default: _tcscpy(ext, ptr); break; } m_iLastExtCase = _case; return ext; } return _T(""); }
/* * Adds a new activity to the database and fill the ID of the activity pointed by [atividade]. * Returns 0 if no error occur, and a different number otherwise. */ int ativAdicionar( Atividade *atividade ) { int result; char query[1024*5]; char sqlTemplate[] = " INSERT INTO atividade(codtipoatividade, coddisc, nome, data, pontos, descricao) " " VALUES('%s', %d, '%s', strftime('%%Y-%%m-%%d %%H:%%M:%%S', %d, 'unixepoch'), %f, '%s'); "; if( !discPegar(atividade->disciplina) ) { fprintf(stderr, "Não existe uma disciplina com o código %d.", atividade->disciplina); exit(1); } strToUpper(atividade->tipoAtividade); sprintf(query, sqlTemplate, atividade->tipoAtividade, atividade->disciplina, atividade->titulo, atividade->data, atividade->pontos, atividade->descricao); result = db_query(NULL, NULL, query); atividade->codigo = db_getLastInsertId(); return result != SQLITE_OK; }
static BOOLEAN is_reserved_word(char token_string[], Token *token) { /* Examine the reserved word table and determine if the function input is a reserved word. */ size_t i; /* row counter 9 */ char tmp[MAX_SOURCE_LINE_LENGTH]; strToUpper(token_string, tmp); for (i = 0; i < 61; ++i) { if (strcmp(SYMBOL_STRINGS2[i], &tmp[0]) == 0) { token->code = (TokenCode) i; return TRUE; } } token->code = IDENTIFIER; /*/ if not a reserve word then identifier */ return FALSE; }
void CSystemCreateStats::AddEntry (const CString &sAttributes) // AddEntry // // Adds this attribute set { CString sAttribCap = strToUpper(sAttributes); // Find the entry SLabelAttributeEntry *pEntry; if (m_LabelAttributeCounts.Lookup(sAttribCap, (CObject **)&pEntry) != NOERROR) { pEntry = new SLabelAttributeEntry; pEntry->iCount = 0; pEntry->sAttributes = sAttributes; m_LabelAttributeCounts.AddEntry(sAttribCap, (CObject *)pEntry); } // Increment the count pEntry->iCount++; }
LPCTSTR CFileName::GetTitle(const __int8 _case /* = 0*/) { if (!filename) return _T(""); LPTSTR ptr = _tcsrchr(filename, _T('.')); if ((m_attribute & CFN_NOTFILE) || !ptr) return filename; if (title) { if (m_iLastTitleCase == _case) return title; free(title); } title = (LPTSTR) malloc(sizeof(TCHAR) * (_tcslen(filename) + 1)); switch (_case) { case 1: strToUpper(title, filename); break; case -1: strToLower(title, filename); break; default: _tcscpy(title, filename); break; } ptr = _tcsrchr(title, _T('.')); *ptr = _T('\0'); m_iLastTitleCase = _case; return title; }
int16 Op_LoadFrame() { int param1; int param2; int param3; char name[36] = ""; char *ptr = (char *) popPtr(); Common::strlcpy(name, ptr, sizeof(name)); param1 = popVar(); param2 = popVar(); param3 = popVar(); if (param3 >= 0 || param3 < NUM_FILE_ENTRIES) { strToUpper(name); gfxModuleData_gfxWaitVSync(); gfxModuleData_gfxWaitVSync(); lastAni[0] = 0; loadFileRange(name, param2, param3, param1); lastAni[0] = 0; } changeCursor(CURSOR_NORMAL); return 0; }
bool_t dictionaryInitialize(dictionary_t * self, const char * rawDict) { uint_t i = 0; uint_t dictLen = 0; char * currWord; uint_t currWordLen = 0; uint_t rawDictLen = strlen(rawDict); /* Create a copy of the raw data - lower cased followed by upper cased */ self->rawDataLowerUpper = (char *) malloc(((2 * rawDictLen) + 1) * sizeof(*(self->rawDataLowerUpper))); CHECK(NULL != self->rawDataLowerUpper); strcpy(self->rawDataLowerUpper, rawDict); strToLower(self->rawDataLowerUpper, rawDictLen); strcpy(self->rawDataLowerUpper + rawDictLen, rawDict); strToUpper(self->rawDataLowerUpper + rawDictLen, rawDictLen); self->rawDataLowerUpper[2 * rawDictLen] = '\0'; /* Scan the upper cased part in order to count the words */ currWord = self->rawDataLowerUpper + rawDictLen; while (findNextWordInRawDict(currWord, &currWord, &currWordLen)) { ++dictLen; currWord += currWordLen + 1; } /* Alloc the vector of string pointer pairs. We alloc one extra member for a null terminator */ self->entries = (stringPair_t *) calloc(dictLen + 1, sizeof(*(self->entries))); CHECK(NULL != self->entries); self->numEntries = dictLen + 1; self->maxEntryLength = 0; /* Now scan the raw dict again, this time updating the resulting array and splitting the strings */ currWord = self->rawDataLowerUpper + rawDictLen; findNextWordInRawDict(currWord, &currWord, &currWordLen); for (i = 0; i < dictLen; ++i) { findNextWordInRawDict(currWord, &currWord, &currWordLen); self->entries[i][LOWER_CASE] = currWord - rawDictLen; self->entries[i][LOWER_CASE][currWordLen] = '\0'; self->entries[i][UPPER_CASE] = currWord; self->entries[i][UPPER_CASE][currWordLen] = '\0'; if (self->maxEntryLength < currWordLen) { self->maxEntryLength = currWordLen; } currWord += currWordLen + 1; } /* Every dictionary contains the empty word, so the last entry points to '\0' */ self->entries[i][LOWER_CASE] = self->rawDataLowerUpper + (2 * rawDictLen); self->entries[i][UPPER_CASE] = self->rawDataLowerUpper + (2 * rawDictLen); return TRUE; LBL_ERROR: PERROR(); FREE(self->rawDataLowerUpper); return FALSE; }
static void leavesStringUnchanged_test2(void **state) { char str[] = "0123456789..."; const char expected[] = "0123456789..."; assert_string_equal(strToUpper(str), expected); }
static void leavesStringUnchanged_test1(void **state) { char str[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const char expected[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; assert_string_equal(strToUpper(str), expected); }
int main (int argc, char* argv[]) { char str[] = {"Every good boy does fine."}; char str2[30] = {"Every good boy does fine."}; char str3[30] = {""}; //Test Word Count int wordCount = strWordCount(str); printf("Word count: %d\n", wordCount); //end test word count // //Test str to upper. strToUpper(str, str2); printStringArray(str); printStringArray(str2); //end test str to upper. // //Test str Strip char c = 'o'; strStrip(str, c, str2); printStringArray(str); printStringArray(str2); //end test str Strip // //Test str Substring char d[] = {"boy"}; printf("Where does the word boy start? %d", strIsSubstring(str, d)); //end test str is Substring // //Test strSubstitute char e, g; e = 'g'; g = 'o'; strSubstitute(str, e, g, str2); printStringArray(str); printStringArray(str2); //end test strSubstitute // //Test strReverse strReverse(str, str2); printStringArray(str); printStringArray(str2); //Test Palindrome char tacocat[] = {"tacocat"}; printf("Is tacocat a Palindrome? %d", strPalindrome(tacocat)); //end palindrome test // //Test strSplit strSplit (str, 'o', 3, str3, str2); printf("The starting str\n"); printStringArray(str); printf("The second half of str\n"); printStringArray(str2); printf("The first half of str\n"); printStringArray(str3); }
static void canUpperString_test1(void **state) { char str[] = "aBcDeFgHiJkLmNoPqRsTuVwXyZ"; const char expected[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; assert_string_not_equal(str, expected); assert_string_equal(strToUpper(str), expected); }
const std::string& CollectionFileData::getName() { if (mDirty) { mCollectionFileName = removeParenthesis(mSourceFileData->metadata.get("name")); boost::trim(mCollectionFileName); mCollectionFileName += " [" + strToUpper(mSourceFileData->getSystem()->getName()) + "]"; mDirty = false; } return mCollectionFileName; }
int16 Op_FindOverlay() { char name[36] = ""; char *ptr; ptr = (char *) popPtr(); Common::strlcpy(name, ptr, sizeof(name)); strToUpper(name); return (isOverlayLoaded(name)); }
GuiSystemSettings::GuiSystemSettings(Window* window) : GuiComponent(window), mMenu(window, "SYSTEM SETTINGS"), mVersion(window) { // SYSTEM SETTINGS // UPDATES > // NETWORK SETTINGS > // STORAGE > // [version] addEntry("SYSTEM UPDATE", 0x777777FF, true, [this, window] { auto s = new GuiSettings(mWindow, "SYSTEM UPDATE"); ComponentListRow row; auto cb = [this] { system("./systemupdate.sh"); SDL_Event ev; ev.type = SDL_QUIT; SDL_PushEvent(&ev); }; row.addElement(std::make_shared<TextComponent>(mWindow, "GET LATEST BINARY", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); row.makeAcceptInputHandler(cb); s->addRow(row); mWindow->pushGui(s); }); /// Change network settings addEntry("NETWORK SETTINGS", 0x777777FF, true, [this, window] { mWindow->pushGui(new GuiWifi(mWindow)); }); addEntry("EMULATORS", 0x777777FF, true, [this, window] { mWindow->pushGui(new GuiEmulatorList(window)); }); /// See storage on internal memory card. addEntry("STORAGE", 0x777777FF, true, [this] { mWindow->pushGui(new GuiStorageInfo(mWindow)); }); mVersion.setFont(Font::get(FONT_SIZE_SMALL)); mVersion.setColor(0xAAAAFFFF); mVersion.setText("BUILD " + strToUpper(PROGRAM_BUILT_STRING)); mVersion.setAlignment(ALIGN_CENTER); addChild(&mMenu); addChild(&mVersion); setSize(mMenu.getSize()); setPosition((Renderer::getScreenWidth() - mSize.x()) / 2, Renderer::getScreenHeight() * 0.15f); }
int16 Op_LoadSong() { const char *ptr = (const char *)popPtr(); char buffer[33]; Common::strlcpy(buffer, ptr, sizeof(buffer)); strToUpper(buffer); _vm->sound().loadMusic(buffer); changeCursor(CURSOR_NORMAL); return 0; }
double getHybridV(int feb_id, int hyb_id,char ch_name[], char ch_pos[]) { double val = 0.0; char tmp[256]; if(getXmlDocStatus()==0) { strcpy(tmp,ch_name); val = getHybVValue(doc, strToUpper(tmp), feb_id, hyb_id, ch_pos); } else { if(DEBUG>1) printf("[ getHybridV ]: [ WARNING ]: the xml doc status is invalid\n"); } return val; }
int16 Op_FindOverlay() { char name[36] = ""; char *ptr; ptr = (char *) popPtr(); strcpy(name, ptr); strToUpper(name); return (isOverlayLoaded(name)); }
double getHybridI(int index, int hyb, const char* type) { double val = 0.0; char tmp[256]; if(getXmlDocStatus()==0) { strcpy(tmp,type); val = getHybIValue(doc, strToUpper(tmp), index, hyb); } else { if(DEBUG>1) printf("[ getHybridI ]: [ WARNING ]: the xml doc status is invalid\n"); } return val; }
void ButtonComponent::setText(const std::string& text, const std::string& helpText) { mText = strToUpper(boost::locale::gettext(text.c_str())); mHelpText = boost::locale::gettext(helpText.c_str()); mTextCache = std::unique_ptr<TextCache>(mFont->buildTextCache(mText, 0, 0, getCurTextColor())); float minWidth = mFont->sizeText("DELETE").x() + 12; setSize(std::max(mTextCache->metrics.size.x() + 12, minWidth), mTextCache->metrics.size.y()); updateHelpPrompts(); }
/**identifyLevel gives the log level corresponding to level description given. *<p>Level description is given as a string containing the word "S[EVERE]", "W[ARNING]", "I[NFO]", "C[ONFIG]", "[FIN]E", "[FINE]R" or "[FINES]T", *which correspond with the log lavel having the same name. Note: characters between braces are optional. *<p>If level do not match with any of above stated words, the default INFO log level is returned. *<p>Level characters can be in upper o lower case. * *@param levelDescription the word describing the log level to set *@return the log level identifier corresponding to the level description in param level */ Logger::logLevel Logger::identifyLevel(string levelDescription) { logLevel levelId; string lvlUpp = strToUpper(levelDescription); if (lvlUpp.front() == 'S') levelId = SEVERE; else if (lvlUpp.front() == 'W') levelId = WARNING; else if (lvlUpp.front() == 'I') levelId = INFO; else if (lvlUpp.front() == 'C') levelId = CONFIG; else if (lvlUpp.back() == 'E') levelId = FINE; else if (lvlUpp.back() == 'R') levelId = FINER; else if (lvlUpp.back() == 'T') levelId = FINEST; else levelId = INFO; return levelId; }
int16 Op_SongExist() { const char *songName = (char *)popPtr(); if (songName) { char name[33]; Common::strlcpy(name, songName, sizeof(name)); strToUpper(name); if (!strcmp(_vm->sound().musicName(), name)) return 1; } return 0; }
/** * Retrieves a specified vocab entry */ void Dialog::getVocab(int vocabId, char **line) { assert(vocabId > 0); const char *vocabStr = _madsVm->globals()->getVocab(vocabId); strcpy(*line, vocabStr); if (_commandCase) strToUpper(*line); else strToLower(*line); // Move the string pointer to after the added string while (!**line) ++*line; }
int16 Op_FreeOverlay() { char localName[36] = ""; char *namePtr; namePtr = (char *) popPtr(); Common::strlcpy(localName, namePtr, sizeof(localName)); if (localName[0]) { strToUpper(localName); releaseOverlay((char *)localName); } return 0; }
VCProject* SBWorkspace::generateGlueProject() const { // Get a set of all configurations appearing in all projects StringSet slnConfigs; for (auto project : m_openProjects) { const StringSet& configs = project.second->getSelectedConfigurations(); slnConfigs.insert(configs.begin(), configs.end()); } // Get the template VSTemplate* vstemplate = VSTemplate::getTemplate("WinRT"); sbAssertWithTelemetry(vstemplate, "Failed to get WinRT VS template"); // Set up basis template parameters string projectName = getName() + "WinRT"; VSTemplateParameters templateParams; templateParams.setProjectName(projectName); // Expand the template and get the template project vstemplate->expand(sb_dirname(getPath()), templateParams); const VSTemplateProjectVec& projTemplates = vstemplate->getProjects(); sbAssertWithTelemetry(projTemplates.size() == 1, "Unexpected WinRT template size"); // Create the glue project and add it to the solution VCProject* glueProject = new VCProject(projTemplates.front()); // Get path to WinObjC SDK BuildSettings globalBS(NULL); String useRelativeSdkPath = globalBS.getValue("VSIMPORTER_RELATIVE_SDK_PATH"); String sdkDir = globalBS.getValue("WINOBJC_SDK_ROOT"); // Try to create a relative path to the SDK, if requested if (strToUpper(useRelativeSdkPath) == "YES") { String projectDir = sb_dirname(projTemplates.front()->getPath()); sdkDir = getRelativePath(projectDir, sdkDir); } glueProject->addGlobalProperty("WINOBJC_SDK_ROOT", platformPath(sdkDir), "'$(WINOBJC_SDK_ROOT)' == ''"); // Set configuration properties for (auto configName : slnConfigs) { VCProjectConfiguration *projConfig = glueProject->addConfiguration(configName); projConfig->setProperty("TargetName", getName()); } // Set RootNamespace glueProject->addGlobalProperty("RootNamespace", getName()); return glueProject; }
uint32 AccountMgr::GetId(std::string username) { strToUpper( username ); loginDatabase.escape_string(username); QueryResult *result = loginDatabase.PQuery("SELECT id FROM account WHERE username = '******'", username.c_str()); if(!result) return 0; else { uint32 id = (*result)[0].GetUInt32(); delete result; return id; } }
void GuiScraperStart::pressedStart() { std::vector<SystemData*> sys = mSystems->getSelectedObjects(); for(auto it = sys.begin(); it != sys.end(); it++) { if((*it)->getPlatformIds().empty()) { mWindow->pushGui(new GuiMsgBox(mWindow, strToUpper("Warning: some of your selected systems do not have a platform set. Results may be even more inaccurate than usual!\nContinue anyway?"), "YES", std::bind(&GuiScraperStart::start, this), "NO", nullptr)); return; } } start(); }
int16 Op_FindSet() { char *ptr = (char *) popPtr(); if (!ptr) return -1; char name[36] = ""; Common::strlcpy(name, ptr, sizeof(name)); strToUpper(name); for (int i = 0; i < NUM_FILE_ENTRIES; i++) { if (!strcmp(name, filesDatabase[i].subData.name)) { return (i); } } return -1; }