本文整理汇总了C++中STRACE函数的典型用法代码示例。如果您正苦于以下问题:C++ STRACE函数的具体用法?C++ STRACE怎么用?C++ STRACE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STRACE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: abspath
void
Project::RemoveSystemInclude(const char *path)
{
if (!path)
return;
BString abspath(path);
abspath.ReplaceFirst("<project>",fPath.GetFolder());
if (abspath[0] != '/')
{
abspath.Prepend("/");
abspath.Prepend(fPath.GetFolder());
}
STRACE(1,("%s: Attempting to remove system include %s\n",GetName(),path));
for (int32 i = 0; i < fSystemIncludeList.CountItems(); i++)
{
BString *str = fSystemIncludeList.ItemAt(i);
if (str && str->Compare(abspath) == 0)
{
STRACE(1,("%s: Removed %s\n",GetName(),path));
fSystemIncludeList.RemoveItemAt(i);
delete str;
return;
}
}
}
示例2: STRACE
click_type
WinDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
{
if (fCloseRect.Contains(pt)) {
STRACE(("WinDecorator():Clicked() - Close\n"));
return CLICK_CLOSE;
}
if (fZoomRect.Contains(pt)) {
STRACE(("WinDecorator():Clicked() - Zoom\n"));
return CLICK_ZOOM;
}
// Clicking in the tab?
if (fTabRect.Contains(pt)) {
// Here's part of our window management stuff
/* TODO This is missing CLICK_MOVETOFRONT
if(buttons==B_PRIMARY_MOUSE_BUTTON && !IsFocus())
return CLICK_MOVETOFRONT;
*/
return CLICK_DRAG;
}
// We got this far, so user is clicking on the border?
if (fBorderRect.Contains(pt) && !fFrame.Contains(pt)) {
STRACE(("WinDecorator():Clicked() - Resize\n"));
return CLICK_RESIZE;
}
// Guess user didn't click anything
STRACE(("WinDecorator():Clicked()\n"));
return CLICK_NONE;
}
示例3: ResourceToAttribute
bool
ResourceToAttribute(BFile &file, BResources &res,type_code code, const char *name)
{
if (!name)
return false;
int32 id;
size_t length;
if (res.GetResourceInfo(code,name,&id,&length))
{
const void *buffer = res.LoadResource(code,name,&length);
if (!buffer)
{
STRACE(2,("Resource %s exists, but couldn't be loaded\n",name));
return false;
}
file.WriteAttr(name,code,0,buffer,length);
STRACE(2,("Successfully wrote attribute %s\n",name));
return true;
}
else
{
STRACE(2,("Resource %s doesn't exist\n",name));
}
return false;
}
示例4: STRACE
status_t
CDDBData::Save(const char *filename)
{
if (!filename) {
STRACE(("CDDBData::Save failed - NULL filename\n"));
return B_ERROR;
}
BFile file(filename, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
if (file.InitCheck() != B_OK) {
STRACE(("CDDBData::Save failed - couldn't create file %s\n", filename));
return file.InitCheck();
}
BString entry;
char timestring[10];
sprintf(timestring,"%.2" B_PRId32 ":%.2" B_PRId32 "", fDiscTime.GetMinutes(),
fDiscTime.GetSeconds());
entry << fArtist << " - " << fAlbum << "\t" << timestring << "\n";
file.Write(entry.String(), entry.Length());
STRACE(("CDDBData::Save: wrote first line: %s", entry.String()));
BString tracksattr(fArtist);
tracksattr << " - " << fAlbum << "\n";
for (int32 i = 0; i < fTrackList.CountItems(); i++) {
BString *trackstr = (BString *)fTrackList.ItemAt(i);
CDAudioTime *time= (CDAudioTime*)fTimeList.ItemAt(i);
if (!trackstr || !time)
continue;
entry = *trackstr;
sprintf(timestring,"%.2" B_PRId32 ":%.2" B_PRId32 "", time->GetMinutes(),
time->GetSeconds());
entry << "\t" << timestring << "\n";
file.Write(entry.String(), entry.Length());
STRACE(("CDDBData::Save: Wrote line: %s", entry.String()));
tracksattr << *trackstr << "\n";
}
file.WriteAttr("CD:key", B_INT32_TYPE, 0, &fDiscID, sizeof(int32));
STRACE(("CDDBData::Save: Wrote CD identifier: %" B_PRId32 "(%" B_PRIx32 ")\n",
fDiscID, fDiscID));
file.WriteAttr("CD:tracks", B_STRING_TYPE, 0, tracksattr.String(), tracksattr.Length() + 1);
if (fGenre.CountChars() > 0)
file.WriteAttr("Audio:Genre",B_STRING_TYPE, 0, fGenre.String(), fGenre.Length() + 1);
if (fYear > 0)
file.WriteAttr("Audio:Year", B_INT32_TYPE, 0, &fYear, sizeof(int32));
return B_OK;
}
示例5: Decorator
// TODO: get rid of DesktopSettings here, and introduce private accessor
// methods to the Decorator base class
TabDecorator::TabDecorator(DesktopSettings& settings, BRect frame)
:
Decorator(settings, frame),
fOldMovingTab(0, 0, -1, -1),
// focus color constants
kFocusFrameColor(settings.UIColor(B_WINDOW_BORDER_COLOR)),
kFocusTabColor(settings.UIColor(B_WINDOW_TAB_COLOR)),
kFocusTabColorLight(tint_color(kFocusTabColor,
(B_LIGHTEN_MAX_TINT + B_LIGHTEN_2_TINT) / 2)),
kFocusTabColorBevel(tint_color(kFocusTabColor, B_LIGHTEN_2_TINT)),
kFocusTabColorShadow(tint_color(kFocusTabColor,
(B_DARKEN_1_TINT + B_NO_TINT) / 2)),
kFocusTextColor(settings.UIColor(B_WINDOW_TEXT_COLOR)),
// non-focus color constants
kNonFocusFrameColor(settings.UIColor(B_WINDOW_INACTIVE_BORDER_COLOR)),
kNonFocusTabColor(settings.UIColor(B_WINDOW_INACTIVE_TAB_COLOR)),
kNonFocusTabColorLight(tint_color(kNonFocusTabColor,
(B_LIGHTEN_MAX_TINT + B_LIGHTEN_2_TINT) / 2)),
kNonFocusTabColorBevel(tint_color(kNonFocusTabColor, B_LIGHTEN_2_TINT)),
kNonFocusTabColorShadow(tint_color(kNonFocusTabColor,
(B_DARKEN_1_TINT + B_NO_TINT) / 2)),
kNonFocusTextColor(settings.UIColor(B_WINDOW_INACTIVE_TEXT_COLOR))
{
STRACE(("TabDecorator:\n"));
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",
frame.left, frame.top, frame.right, frame.bottom));
// TODO: If the decorator was created with a frame too small, it should
// resize itself!
}
示例6: STRACE
click_type
WinDecorator::Clicked(BPoint where, int32 buttons, int32 modifiers)
{
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(where))
return CLICK_CLOSE;
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(where))
return CLICK_ZOOM;
// Clicking in the tab?
if (fTabRect.Contains(where)) {
// Here's part of our window management stuff
/* TODO This is missing CLICK_MOVETOFRONT
if(buttons==B_PRIMARY_MOUSE_BUTTON && !IsFocus())
return CLICK_MOVETOFRONT;
*/
return CLICK_DRAG;
}
// We got this far, so user is clicking on the border?
if (fBorderRect.Contains(where) && !fFrame.Contains(where)) {
STRACE(("WinDecorator():Clicked() - Resize\n"));
if (!(fFlags & B_NOT_RESIZABLE)
&& (fLook == B_TITLED_WINDOW_LOOK
|| fLook == B_FLOATING_WINDOW_LOOK
|| fLook == B_MODAL_WINDOW_LOOK)) {
return CLICK_RESIZE;
}
}
// Guess user didn't click anything
STRACE(("WinDecorator():Clicked()\n"));
return CLICK_NONE;
}
示例7: STRACE
status_t
LinkReceiver::AdjustReplyBuffer(bigtime_t timeout)
{
// Here we take advantage of the compiler's dead-code elimination
if (kInitialBufferSize == kMaxBufferSize) {
// fixed buffer size
if (fRecvBuffer != NULL)
return B_OK;
fRecvBuffer = (char *)malloc(kInitialBufferSize);
if (fRecvBuffer == NULL)
return B_NO_MEMORY;
fRecvBufferSize = kInitialBufferSize;
} else {
STRACE(("info: LinkReceiver getting port_buffer_size().\n"));
ssize_t bufferSize;
do {
bufferSize = port_buffer_size_etc(fReceivePort,
timeout == B_INFINITE_TIMEOUT ? B_RELATIVE_TIMEOUT : 0,
timeout);
} while (bufferSize == B_INTERRUPTED);
STRACE(("info: LinkReceiver got port_buffer_size() = %ld.\n", bufferSize));
if (bufferSize < 0)
return (status_t)bufferSize;
// make sure our receive buffer is large enough
if (bufferSize > fRecvBufferSize) {
if (bufferSize <= (ssize_t)kInitialBufferSize)
bufferSize = (ssize_t)kInitialBufferSize;
else
bufferSize = (bufferSize + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);
if (bufferSize > (ssize_t)kMaxBufferSize)
return B_ERROR; // we can't continue
STRACE(("info: LinkReceiver setting receive buffersize to %ld.\n", bufferSize));
char *buffer = (char *)malloc(bufferSize);
if (buffer == NULL)
return B_NO_MEMORY;
free(fRecvBuffer);
fRecvBuffer = buffer;
fRecvBufferSize = bufferSize;
}
}
return B_OK;
}
示例8: STRACE
void
CDDBData::AddTrack(const char *track, const CDAudioTime &time,
const int16 &index)
{
if (!track) {
STRACE(("CDDBData::AddTrack failed - NULL name\n"));
return;
}
STRACE(("CDDBData::AddTrack(%s, %ld:%.2ld,%d)\n", track, time.minutes, time.seconds, index));
fTrackList.AddItem(new BString(track));
fTimeList.AddItem(new CDAudioTime(time));
}
示例9: STRACE
int select_reactor_base::remove_handle(ndk_handle handle, select_handle *&sh)
{
STRACE("");
if (sh->handle == handle)
{
select_handle *p = sh;
sh = sh->next;
this->release_handle(p);
}else
{
select_handle *prev = sh;
select_handle *itor = sh->next;
while (itor != 0)
{
if (itor->handle == handle)
{
prev->next = itor->next;
this->release_handle(itor);
break;
}
prev = itor;
itor = itor->next;
}
}
return 0;
}
示例10: STRACE
status_t
FindWindow::SetWorkingDirectory(BString path)
{
fWorkingDir = path;
STRACE(2,("Set working directory for find: %s\n",fWorkingDir.String()));
return B_OK;
}
示例11: STRACE
/*! \brief Actually draws the close button
Unless a subclass has a particularly large button, it is probably
unnecessary to check the update rectangle.
\param tab The \a tab to update.
\param direct Draw without double buffering.
\param rect The area of the button to update.
*/
void
WinDecorator::_DrawClose(Decorator::Tab* tab, bool direct, BRect rect)
{
STRACE(("_DrawClose(%f, %f, %f, %f)\n", rect.left, rect.top, rect.right,
rect.bottom));
// Just like DrawZoom, but for a close button
_DrawBeveledRect(rect, tab->closePressed);
// Draw the X
BRect closeBox(rect);
closeBox.InsetBy(4, 4);
closeBox.right--;
closeBox.top--;
if (true)
closeBox.OffsetBy(1, 1);
fDrawingEngine->SetHighColor(RGBColor(0, 0, 0));
fDrawingEngine->StrokeLine(closeBox.LeftTop(), closeBox.RightBottom());
fDrawingEngine->StrokeLine(closeBox.RightTop(), closeBox.LeftBottom());
closeBox.OffsetBy(1, 0);
fDrawingEngine->StrokeLine(closeBox.LeftTop(), closeBox.RightBottom());
fDrawingEngine->StrokeLine(closeBox.RightTop(), closeBox.LeftBottom());
}
示例12: _OpenGraphicsDevice
status_t
DWindowHWInterface::Initialize()
{
status_t ret = HWInterface::Initialize();
if (!fRectParams || !fBlitParams)
return B_NO_MEMORY;
if (ret >= B_OK) {
for (int32 i = 1; fCardFD != B_ENTRY_NOT_FOUND; i++) {
fCardFD = _OpenGraphicsDevice(i);
if (fCardFD < 0) {
STRACE(("Failed to open graphics device\n"));
continue;
}
if (_OpenAccelerant(fCardFD) == B_OK)
break;
close(fCardFD);
// _OpenAccelerant() failed, try to open next graphics card
}
return fCardFD >= 0 ? B_OK : fCardFD;
}
return ret;
}
示例13: Decorator
WinDecorator::WinDecorator(DesktopSettings& settings, BRect rect,
window_look look, uint32 flags)
:
Decorator(settings, rect, look, flags),
taboffset(0)
{
_UpdateFont(settings);
// common colors to both focus and non focus state
frame_highcol = (rgb_color){ 255, 255, 255, 255 };
frame_midcol = (rgb_color){ 216, 216, 216, 255 };
frame_lowcol = (rgb_color){ 110, 110, 110, 255 };
frame_lowercol = (rgb_color){ 0, 0, 0, 255 };
// state based colors
fFocusTabColor = settings.UIColor(B_WINDOW_TAB_COLOR);
fFocusTextColor = settings.UIColor(B_WINDOW_TEXT_COLOR);
fNonFocusTabColor = settings.UIColor(B_WINDOW_INACTIVE_TAB_COLOR);
fNonFocusTextColor = settings.UIColor(B_WINDOW_INACTIVE_TEXT_COLOR);
// Set appropriate colors based on the current focus value. In this case,
// each decorator defaults to not having the focus.
_SetFocus();
// Do initial decorator setup
_DoLayout();
textoffset=5;
STRACE(("WinDecorator()\n"));
}
示例14: STRACE
void
TabDecorator::_GetFootprint(BRegion *region)
{
STRACE(("TabDecorator: GetFootprint\n"));
// This function calculates the decorator's footprint in coordinates
// relative to the view. This is most often used to set a Window
// object's visible region.
if (region == NULL)
return;
region->MakeEmpty();
if (fTopTab->look == B_NO_BORDER_WINDOW_LOOK)
return;
region->Include(fTopBorder);
region->Include(fLeftBorder);
region->Include(fRightBorder);
region->Include(fBottomBorder);
if (fTopTab->look == B_BORDERED_WINDOW_LOOK)
return;
region->Include(&fTabsRegion);
if (fTopTab->look == B_DOCUMENT_WINDOW_LOOK) {
// include the rectangular resize knob on the bottom right
float knobSize = kResizeKnobSize - fBorderWidth;
region->Include(BRect(fFrame.right - knobSize, fFrame.bottom - knobSize,
fFrame.right, fFrame.bottom));
}
}
示例15: libpath
void
Project::AddLibrary(const char *path)
{
if (!path)
return;
DPath libpath(path);
if (!BEntry(libpath.GetFullPath()).Exists())
{
libpath = FindLibrary(libpath.GetFileName());
if (libpath.IsEmpty())
{
if (gBuildMode)
{
printf("%s seems to be missing\n", path);
}
else
{
BString err;
err << path << " seems to be missing. Do you want to remove it from the project?";
int32 result = ShowAlert(err.String(),"Remove","Keep");
if (result == 0)
return;
}
}
}
if (!HasLibrary(libpath.GetFullPath()))
{
STRACE(1,("%s: Added library %s\n",GetName(),libpath.GetFullPath()));
fLibraryList.AddItem(gFileFactory.CreateSourceFileItem(libpath.GetFullPath()));
}
}