本文整理汇总了C++中BString::ToUpper方法的典型用法代码示例。如果您正苦于以下问题:C++ BString::ToUpper方法的具体用法?C++ BString::ToUpper怎么用?C++ BString::ToUpper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BString
的用法示例。
在下文中一共展示了BString::ToUpper方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetHash
unsigned char DataFile::GetHash(BString text)
////////////////////////////////////////////////////////////////////////
{
unsigned char result = 0;
text.ToUpper();
for (int i=0; i<text.Length(); i++)
result ^= text.ByteAt(i);
return result;
}
示例2: perform_edit
status_t perform_edit(MTextAddOn *addon)
{
status_t result = B_OK;
entry_ref headerFile;
BPoint where(0,0);
if (addon->Window() && addon->Window()->Lock())
{
uint32 buttons;
addon->Window()->ChildAt(0)->GetMouse(&where, &buttons);
addon->Window()->ChildAt(0)->ConvertToScreen(&where);
addon->Window()->Unlock();
where += BPoint(-3,-3);
}
result = addon->GetRef(headerFile);
BString fileName;
if (result >= B_OK)
fileName = headerFile.name;
CLanguageInterface *languageInterface = NULL;
if (addon->Window())
{
PDoc *doc = dynamic_cast<PDoc *>(addon->Window());
if (doc && doc->TextView())
{
int lang = doc->TextView()->Language();
if (lang > -1)
languageInterface = CLanguageInterface::FindIntf(lang);
}
}
BString header;
result = RunPopUpMenu(where, header, fileName, languageInterface);
//printf("result %s\n", strerror(result));
if (result == B_CANCELED)
return B_OK;
if (result < B_OK)
return result;
#if 0
// Do not change the case if a shift key was pressed
if ((modifiers() & B_SHIFT_KEY) == 0)
fileName.ToUpper();
#endif
addon->Select(0, 0);
addon->Insert(header.String());
return result;
}
示例3: country
void
BootPromptWindow::_InitCatalog(bool saveSettings)
{
// Initilialize the Locale Kit
// TODO: The below code is a work-around for not being able to
// call GetAppCatalog() more than once.
be_catalog = be_app_catalog = NULL;
// NOTE: be_catalog and be_app_catalog will point fo &fCatalog!
be_locale->GetAppCatalog(&fCatalog);
// Generate a settings file
// TODO: This should not be necessary.
// be_locale_roster->SetPreferredLanguages() should take care of things
if (!saveSettings)
return;
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK
|| path.Append("Locale settings") != B_OK) {
return;
}
BMessage settings;
BFile file;
if (file.SetTo(path.Path(), B_READ_ONLY) == B_OK)
settings.Unflatten(&file);
BString language;
if (fCatalog.GetLanguage(&language) == B_OK) {
settings.RemoveName("language");
settings.AddString("language", language.String());
}
settings.RemoveName("country");
BCountry country(language.String(), language.ToUpper());
settings.AddString("country", country.Code());
if (file.SetTo(path.Path(), B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY)
!= B_OK
|| settings.Flatten(&file) != B_OK) {
fprintf(stderr, "Failed to write Local Kit settings!\n");
}
}
示例4:
/* isCue
* checks if selected file is a cue file (checks by file extension)
* if yes, returns true
*/
bool
ProjectTypeSelector::isCue()
{
BString *SelectedFile = (BString*)FileList->FirstItem();
BString SelectedFileTMP;
BString FileExtension;
BString tmp;
//get file extension
SelectedFile->CopyInto(SelectedFileTMP, 0, (int)SelectedFile->Length());
SelectedFileTMP.RemoveAll("/");
for(int i = 3; i > 0; i--) {
tmp.SetTo(SelectedFileTMP.ByteAt((SelectedFileTMP.Length() - i)), 1);
FileExtension.Insert(tmp.String(), FileExtension.Length());
}
FileExtension.ToUpper();
if(FileExtension.Compare("CUE") == 0)
return true;
return false;
}
示例5: GetBool
bool DataFile::GetBool(BString key, bool &result)
////////////////////////////////////////////////////////////////////////
{
BString temp;
if (GetEntry(key, temp))
{
temp.ToUpper();
if (temp == "TRUE")
{
result = true;
return true;
}
else if (temp == "FALSE")
{
result = false;
return true;
}
return false; // nem true es nem is false -> error es akkor default marad
}
else
return false;
}
示例6: CreateNewProject
// CreateNewProject - create all the text files for the new project
void NewProjectWindow::CreateNewProject(void)
{
// Set Project Name and Various other settings
char tmp[300]; // this will be removed when all references are gone
char cmd[256];
int x; // this will be removed when all references are gone
FILE *f; // this will be removed when all references are gone
char FileName[256];
char AppName[256]; // this will be removed when all references are gone
BString FileContents;
BString UpperProjectName;
ProjectName.SetTo(txtNewProject->Text());
UpperProjectName.SetTo(ProjectName.String());
UpperProjectName.ToUpper();
sprintf(AppName,"%s",ProjectName.String()); // this will be removed when all references are gone
// 1) Get Current Directory
app_info daInfo;
be_app->GetAppInfo(&daInfo);
BEntry daEntry(&daInfo.ref);
daEntry.GetParent(&daEntry);
BPath pPath(&daEntry);
char apath[256];
::memcpy(apath, pPath.Path(), 256);
// 2) Create New Directory
sprintf(cmd,"mkdir %s/projects/%s",apath,ProjectName.String());
system(cmd);
// 3) Create Basic Files for a Default App
// Application Header
sprintf(FileName,"%s/projects/%s/%s.h",apath,ProjectName.String(),ProjectName.String());
FileContents.SetTo("#ifndef __");
FileContents.Append(UpperProjectName.String());
FileContents.Append("_H__\n");
FileContents.Append("#define __");
FileContents.Append(UpperProjectName.String());
FileContents.Append("_H__\n\n");
FileContents.Append("extern const char *APP_SIGNATURE;\n\n");
FileContents.Append("class ");
FileContents.Append(ProjectName.String());
FileContents.Append(" : public BApplication\n{\n\tpublic:\n\t\t");
FileContents.Append(ProjectName.String());
FileContents.Append("();\n");
FileContents.Append("\t\tvirtual void MessageReceived(BMessage *message);\n");
FileContents.Append("\tprivate:\n\n};\n\n");
FileContents.Append("#endif\n");
CreateFile(FileName,"Header",FileContents);
// Application Constants.h
sprintf(FileName,"%s/projects/%s/%sConstants.h",apath,ProjectName.String(),ProjectName.String());
FileContents.SetTo("#ifndef __");
FileContents.Append(UpperProjectName.String());
FileContents.Append("CONSTANTS_H__\n");
FileContents.Append("#define __");
FileContents.Append(UpperProjectName.String());
FileContents.Append("CONSTANTS_H__\n\n");
FileContents.Append("// Pointers to BWindows\n");
FileContents.Append("extern ");
FileContents.Append(ProjectName.String());
FileContents.Append("Window* ptr");
FileContents.Append(ProjectName.String());
FileContents.Append("Window;\n\n");
FileContents.Append("// Product Name and Properties\n");
FileContents.Append("const char projtitle[]=\"");
FileContents.Append(ProjectName.String());
FileContents.Append("\";\nconst char projversion[]=\"v0.1\";\nconst char projauthor[]=\"");
FileContents.Append(txtAuthor->Text());
FileContents.Append("\";\n\n");
FileContents.Append("#endif\n");
CreateFile(FileName,"Constants",FileContents);
// Windows Header
sprintf(FileName,"%s/projects/%s/%sWindows.h",apath,ProjectName.String(),ProjectName.String());
FileContents.SetTo("#ifndef __");
FileContents.Append(UpperProjectName.String());
FileContents.Append("WINDOWS_H__\n");
FileContents.Append("#define __");
FileContents.Append(UpperProjectName.String());
FileContents.Append("WINDOWS_H__\n\n");
FileContents.Append("#include \"");
FileContents.Append(ProjectName.String());
FileContents.Append(".h\"\n");
FileContents.Append("#include \"");
FileContents.Append(ProjectName.String());
FileContents.Append("Views.h\"\n\n");
FileContents.Append("class ");
FileContents.Append(ProjectName.String());
FileContents.Append("View;\n\n");
FileContents.Append("class ");
FileContents.Append(ProjectName.String());
FileContents.Append("Window : public BWindow\n");
FileContents.Append("{\n\tpublic:\n\t\t");
FileContents.Append(ProjectName.String());
FileContents.Append("Window(BRect frame);\n");
FileContents.Append("\t\t~");
//.........这里部分代码省略.........
示例7: GetExtension
void GetExtension(const BString &name, BString &string) {
int i = name.Length();
while ((i >= 0) && (name[i] != '.')) i--;
if (i >= 0) string = BString(&name.String()[i+1]);
string.ToUpper();
}
示例8: firstWord
bool
ClientWindow::ParseCmd (const char *data)
{
BString firstWord (GetWord(data, 1).ToUpper());
if (firstWord == "/WALLOPS" // we need to insert a ':' before parm2
|| firstWord == "/SQUIT" // for the user
|| firstWord == "/PRIVMSG")
{
BString theCmd (firstWord.RemoveAll ("/")),
theRest (RestOfString (data, 2));
BMessage send (M_SERVER_SEND);
AddSend (&send, theCmd);
if (theRest != "-9z99")
{
AddSend (&send, " :");
AddSend (&send, theRest);
}
AddSend (&send, endl);
return true;
}
if (firstWord == "/KILL") // we need to insert a ':' before parm3
{ // for the user
BString theCmd (firstWord.RemoveAll ("/")),
theTarget (GetWord (data, 2)),
theRest (RestOfString (data, 3));
BMessage send (M_SERVER_SEND);
AddSend (&send, theCmd);
AddSend (&send, " ");
AddSend (&send, theTarget);
if (theRest != "-9z99")
{
AddSend (&send, " :");
AddSend (&send, theRest);
}
AddSend (&send, endl);
return true;
}
// some quick aliases for scripts, these will of course be
// moved to an aliases section eventually
if (firstWord == "/SOUNDPLAY"
|| firstWord == "/CL-AMP")
{
app_info ai;
be_app->GetAppInfo (&ai);
BEntry entry (&ai.ref);
BPath path;
entry.GetPath (&path);
path.GetParent (&path);
//path.Append ("data");
path.Append ("scripts");
if (firstWord == "/SOUNDPLAY")
path.Append ("soundplay-hey");
else
path.Append ("cl-amp-clr");
BMessage *msg (new BMessage);
msg->AddString ("exec", path.Path());
msg->AddPointer ("client", this);
thread_id execThread = spawn_thread (
ExecPipe,
"exec_thread",
B_LOW_PRIORITY,
msg);
resume_thread (execThread);
return true;
}
if (firstWord == "/ABOUT")
{
be_app_messenger.SendMessage (B_ABOUT_REQUESTED);
return true;
}
if (firstWord == "/AWAY")
{
BString theReason (RestOfString (data, 2));
BString tempString;
if (theReason != "-9z99")
//.........这里部分代码省略.........