本文整理汇总了C++中BString::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ BString::Remove方法的具体用法?C++ BString::Remove怎么用?C++ BString::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BString
的用法示例。
在下文中一共展示了BString::Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BWindow
dialCalendar::dialCalendar(const char *inidate, BTextControl *ptr, int32 msg, BHandler *hr) : BWindow(
BRect(100+20, 100+20, 295+20, 320+20+25),
NULL,
B_TITLED_WINDOW,
B_NOT_RESIZABLE ) {
msgdc = msg;
dateField = ptr;
handler = hr;
// split inidate into y/m/d
BString tmp;
tmp = inidate;
tmp.Remove(4,tmp.Length()-4);
year = toint(tmp.String());
tmp = inidate;
tmp.Remove(0,5);
tmp.Remove(2,tmp.Length()-2);
month = toint(tmp.String());
tmp = inidate;
tmp.Remove(0,8);
day = toint(tmp.String());
this->SetTitle("Wybierz datę");
this->SetFeel(B_FLOATING_APP_WINDOW_FEEL);
view = new BView(this->Bounds(), "calendarView", B_FOLLOW_ALL_SIDES, 0);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
this->AddChild(view);
view->AddChild(monthyear = new BStringView(BRect(60,5,135,25), "calendarMonthYear", NULL));
monthyear->SetAlignment(B_ALIGN_CENTER);
view->AddChild(but_prevy = new BButton(BRect(10,5,30,25), "calendarButPrevy", "<<", new BMessage(BUT_PREVY)));
view->AddChild(but_prevm = new BButton(BRect(35,5,55,25), "calendarButPrevm", "<", new BMessage(BUT_PREVM)));
view->AddChild(but_nextm = new BButton(BRect(140,5,160,25), "calendarButNextm", ">", new BMessage(BUT_NEXTM)));
view->AddChild(but_nexty = new BButton(BRect(165,5,185,25), "calendarButNexty", ">>", new BMessage(BUT_NEXTY)));
int i,j;
for (i=0;i<=6;i++) {
view->AddChild(new BStringView(BRect(10+i*25,30,30+i*25,50), NULL, shortweekdays[i]));
}
BMessage *msg;
for (j=0;j<=5;j++) {
for (i=0;i<=6;i++) {
msg = new BMessage(BUT_CAL);
msg->AddInt32("_x", i);
msg->AddInt32("_y", j);
view->AddChild(caltab[i][j] = new BButton(BRect(10+i*25,55+j*25,30+i*25,75+j*25), NULL, "33", msg));
}
}
view->AddChild(but_ok = new BButton(BRect(120,210,165,230), "calendarButOk", "OK", new BMessage(BUT_OK)));
but_ok->MakeDefault(true);
but_ok->ResizeToPreferred();
RefreshCalendar();
}
示例2: ceilf
void
StringTest::Prepare(BView* view)
{
// SetupClipping(view);
font_height fh;
view->GetFontHeight(&fh);
fLineHeight = ceilf(fh.ascent) + ceilf(fh.descent)
+ ceilf(fh.leading);
fStartHeight = ceilf(fh.ascent) + ceilf(fh.descent);
fViewBounds = view->Bounds();
BString string;
string.Append('M', fGlyphsPerLine);
while (view->StringWidth(string.String()) < fViewBounds.Width() - 10)
string.Append('M', 1);
while (view->StringWidth(string.String()) > fViewBounds.Width() - 10)
string.Remove(string.Length() - 1, 1);
fGlyphsPerLine = 60; //string.Length();
fTestDuration = 0;
fGlyphsRendered = 0;
fIterations = 0;
fTestStart = system_time();
}
示例3: isspace
void
KeyboardLayout::_Trim(BString& string, bool stripComments)
{
// Strip leading spaces
int32 i = 0;
while (isspace(string[i])) {
i++;
}
if (i > 0)
string.Remove(0, i);
// Remove comments
if (stripComments) {
i = string.FindFirst('#');
if (i >= 0)
string.Truncate(i);
}
// Strip trailing spaces
i = string.Length() - 1;
while (i > 0 && isspace(string[i])) {
i--;
}
string.Truncate(i + 1);
}
示例4: parseMenuItemTrigger
/**
* @brief Reads items array in menu design resource.
* @return trigger character
*/
char BeSkinView::parseMenuItemTrigger(
const char* sourceLabel, ///< source label string
BString& outLabel ///< OUTPUT. label string without '&' prefix character.
)
{
char trigger = 0;
outLabel = sourceLabel;
int32 find = 0;
while (true)
{
find = outLabel.FindFirst('~', find);
if (B_ERROR == find)
{
break;
}
outLabel.Remove(find, 1);
if (outLabel[find] != '~')
{
if (0 == trigger)
{
trigger = tolower(outLabel[find]);
}
}
else
{
find++;
}
}
return trigger;
}
示例5:
_EXPORT void
extract_address(BString &address)
{
const char *string = address.String();
int32 first;
// first, remove all quoted text
if ((first = address.FindFirst('"')) >= 0) {
int32 last = first + 1;
while (string[last] && string[last] != '"')
last++;
if (string[last] == '"')
address.Remove(first, last + 1 - first);
}
// try to extract the address now
if ((first = address.FindFirst('<')) >= 0) {
// the world likes us and we can just get the address the easy way...
int32 last = address.FindFirst('>');
if (last >= 0) {
address.Truncate(last);
address.Remove(0, first + 1);
return;
}
}
// then, see if there is anything in parenthesis to throw away
if ((first = address.FindFirst('(')) >= 0) {
int32 last = first + 1;
while (string[last] && string[last] != ')')
last++;
if (string[last] == ')')
address.Remove(first, last + 1 - first);
}
// now, there shouldn't be much else left
trim_white_space(address);
}
示例6:
void
Emoticor::_findTokens(RunView *fTextView,BString text,int tokenstart, int16 cols ,int16 font ,int16 cols2 ,int16 font2)
{
//******************************************
// "Iteration is human, recursion is divine"
//******************************************
int32 newindex = 0;
BString cur;
int i=tokenstart;
while(config->FindString("face",i,&cur)==B_OK)
//for(int i=tokenstart;i<config->numfaces;i++)
{
i++;
//if(config->FindString("face",i,&cur)!=B_OK) return;
newindex=0;
while(true)
{
newindex=text.IFindFirst(cur.String(),0);
//printf("Try %d %s -- match %d\n",i,cur->original.String(),newindex);
if(newindex!=B_ERROR)
{
//take a walk on the left side ;)
//printf("Found at %ld \n",newindex);
if(newindex-1>=0)
{
BString left;
text.CopyInto(left,0,newindex);
//printf("ready to recourse! [%s]\n",left.String());
_findTokens(fTextView,left,tokenstart+1,cols,font,cols2,font2);
}
text.Remove(0,newindex+cur.Length());
//printf("remaning [%s] printed [%s]\n",text.String(),cur->original.String());
fTextView->Append(cur.String(),cols2,cols2,font2);
if(text.Length()==0) return; //useless stack
}
else
break;
}
}
fTextView->Append(text.String(),cols,cols,font);
}
示例7: RemoveComment
void DataFile::RemoveComment(BString &result)
////////////////////////////////////////////////////////////////////////
{
int len = result.Length();
int x = result.FindFirst('#');
if (x>=0)
result.Remove(x, len-x);
}
示例8:
void
HaikuMailFormatFilter::_RemoveLeadingDots(BString& name)
{
int dots = 0;
while (dots < name.Length() && name.ByteAt(dots) == '.')
dots++;
if (dots > 0)
name.Remove(0, dots);
}
示例9: switch
static void
CoerceFormatTo24HourClock(BString& format)
{
char* buffer = format.LockBuffer(format.Length());
char* currentPos = buffer;
if (currentPos == NULL)
return;
// change the format to use H instead of h, K instead of k, and determine
// and remove the am/pm marker (including leading whitespace)
bool inQuote = false;
bool lastWasWhitespace = false;
uint32 ch;
const char* amPmStartPos = NULL;
const char* amPmEndPos = NULL;
const char* lastWhitespaceStart = NULL;
for (char* previousPos = currentPos; (ch = BUnicodeChar::FromUTF8(
(const char**)¤tPos)) != 0; previousPos = currentPos) {
switch (ch) {
case '\'':
inQuote = !inQuote;
break;
case 'h':
if (!inQuote)
*previousPos = 'H';
break;
case 'k':
if (!inQuote)
*previousPos = 'K';
break;
case 'a':
if (!inQuote) {
if (lastWasWhitespace)
amPmStartPos = lastWhitespaceStart;
else
amPmStartPos = previousPos;
amPmEndPos = currentPos;
}
break;
default:
if (!inQuote && BUnicodeChar::IsWhitespace(ch)) {
if (!lastWasWhitespace) {
lastWhitespaceStart = previousPos;
lastWasWhitespace = true;
}
continue;
}
}
lastWasWhitespace = false;
}
format.UnlockBuffer(format.Length());
if (amPmStartPos != NULL && amPmEndPos > amPmStartPos)
format.Remove(amPmStartPos - buffer, amPmEndPos - amPmStartPos);
}
示例10:
void
BAddressContactField::_PopValue(BString& str, BString& value)
{
int32 index = str.FindFirst(";", 0);
if (index == B_ERROR) {
fWellFormed = false;
value.SetTo("");
return;
}
str.MoveInto(value, 0, index);
str.Remove(0,1);
}
示例11: Trim
void DataFile::Trim(BString &result)
////////////////////////////////////////////////////////////////////////
{
if (result.Length() == 0)
return;
// Elejen a space-ek...
while (result.ByteAt(0) == ' ')
{
result.Remove(0, 1);
}
if (result.Length() == 0)
return;
// Vegen a space-ek...
while (result.ByteAt(result.Length()-1) == ' ')
{
result.Remove(result.Length()-1, 1);
}
}
示例12:
void
BAddressContactField::_PopValue(BString& str, BString& value)
{
int32 index = str.FindFirst(fDivider, 0);
printf("%s\n", str.String());
if (index == B_ERROR && str.Length() < 1) {
value.SetTo("");
return;
}
str.MoveInto(value, 0, index);
str.Remove(0,1);
}
示例13:
OpenPackageAction(PackageInfoRef package, Model* model,
const DeskbarLink& link)
:
PackageAction(PACKAGE_ACTION_OPEN, package, model),
fDeskbarLink(link),
fLabel(B_TRANSLATE("Open %DeskbarLink%"))
{
BString target = fDeskbarLink.link;
int32 lastPathSeparator = target.FindLast('/');
if (lastPathSeparator > 0 && lastPathSeparator + 1 < target.Length())
target.Remove(0, lastPathSeparator + 1);
fLabel.ReplaceAll("%DeskbarLink%", target);
}
示例14: entry
status_t
BLocaleRoster::_PrepareCatalogEntry(const entry_ref& ref, BString& signature,
BString& context, BString& string, bool traverse)
{
BEntry entry(&ref, traverse);
if (!entry.Exists())
return B_ENTRY_NOT_FOUND;
BNode node(&entry);
status_t status = node.InitCheck();
if (status != B_OK)
return status;
status = node.ReadAttrString("SYS:NAME", &signature);
if (status != B_OK)
return status;
int32 first = signature.FindFirst(':');
int32 last = signature.FindLast(':');
if (first == last)
return B_ENTRY_NOT_FOUND;
context = signature;
string = signature;
signature.Truncate(first);
context.Truncate(last);
context.Remove(0, first + 1);
string.Remove(0, last + 1);
if (signature.Length() == 0 || context.Length() == 0
|| string.Length() == 0)
return B_ENTRY_NOT_FOUND;
return B_OK;
}
示例15: LoadAliases
void VisionApp::LoadAliases(void)
{
BPath settingsPath;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &settingsPath) < B_OK) return;
settingsPath.Append(kAliasPathName);
if (settingsPath.InitCheck() < B_OK) return;
BFile file(settingsPath.Path(), B_READ_ONLY);
if (file.InitCheck() == B_OK) {
BString data;
char buffer[2048];
memset(buffer, 0, sizeof(buffer));
while (file.Read((void*)buffer, 2048) > 0) {
data += buffer;
memset(buffer, 0, sizeof(buffer));
}
file.Unset();
while (data.Length() > 0) {
BString cmd, value;
int32 idx = data.IFindFirst("\t");
if (idx != B_ERROR) {
data.MoveInto(cmd, 0, idx);
data.Remove(0, 1);
} else {
break;
}
idx = data.IFindFirst("\n");
if (idx != B_ERROR) {
data.MoveInto(value, 0, idx);
data.Remove(0, 1);
} else {
break;
}
fAliases[cmd.ToUpper()] = value;
}
}
}