Collision with our style guide.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10495 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-12-20 10:30:50 +00:00
parent bae6988e7d
commit beabca50a7
+255 -190
View File
@@ -173,9 +173,9 @@ sPropertyInfo[] = {
extern const int __libc_argc;
extern const char * const *__libc_argv;
class BMenuWindow : public BWindow
{
class BMenuWindow : public BWindow {
};
//------------------------------------------------------------------------------
// debugging
@@ -189,7 +189,7 @@ static const char* looper_name_for(const char *signature);
static status_t check_app_signature(const char *signature);
static void fill_argv_message(BMessage *message);
//------------------------------------------------------------------------------
BApplication::BApplication(const char *signature)
: BLooper(looper_name_for(signature)),
fAppName(NULL),
@@ -205,7 +205,8 @@ BApplication::BApplication(const char* signature)
{
InitData(signature, NULL);
}
//------------------------------------------------------------------------------
BApplication::BApplication(const char* signature, status_t* error)
: BLooper(looper_name_for(signature)),
fAppName(NULL),
@@ -221,7 +222,8 @@ BApplication::BApplication(const char* signature, status_t* error)
{
InitData(signature, error);
}
//------------------------------------------------------------------------------
BApplication::~BApplication()
{
// tell all loopers(usually windows) to quit. Also, wait for them.
@@ -265,7 +267,8 @@ BApplication::~BApplication()
// R5 doesn't uninitialize be_app_messenger.
//be_app_messenger = BMessenger();
}
//------------------------------------------------------------------------------
BApplication::BApplication(BMessage *data)
// Note: BeOS calls the private BLooper(int32, port_id, const char *)
// constructor here, test if it's needed
@@ -291,15 +294,18 @@ BApplication::BApplication(BMessage* data)
SetPulseRate(pulseRate);
}
//------------------------------------------------------------------------------
BArchivable* BApplication::Instantiate(BMessage* data)
BArchivable *
BApplication::Instantiate(BMessage *data)
{
if (validate_instantiation(data, "BApplication"))
return new BApplication(data);
return NULL;
}
//------------------------------------------------------------------------------
status_t
BApplication::Archive(BMessage *data, bool deep) const
{
@@ -316,17 +322,19 @@ BApplication::Archive(BMessage* data, bool deep) const
if (status < B_OK)
return status;
status = data->AddInt64("_pulse", fPulseRate);
return status;
return data->AddInt64("_pulse", fPulseRate);
}
//------------------------------------------------------------------------------
status_t BApplication::InitCheck() const
status_t
BApplication::InitCheck() const
{
return fInitError;
}
//------------------------------------------------------------------------------
thread_id BApplication::Run()
thread_id
BApplication::Run()
{
AssertLocked();
@@ -346,8 +354,10 @@ thread_id BApplication::Run()
return thread;
}
//------------------------------------------------------------------------------
void BApplication::Quit()
void
BApplication::Quit()
{
bool unlock = false;
if (!IsLocked()) {
@@ -385,8 +395,10 @@ void BApplication::Quit()
if (unlock)
Unlock();
}
//------------------------------------------------------------------------------
bool BApplication::QuitRequested()
bool
BApplication::QuitRequested()
{
// No windows -- nothing to do.
// TODO: Au contraire, we can have opened windows, and we have
@@ -394,15 +406,20 @@ bool BApplication::QuitRequested()
return BLooper::QuitRequested();
}
//------------------------------------------------------------------------------
void BApplication::Pulse()
void
BApplication::Pulse()
{
}
//------------------------------------------------------------------------------
void BApplication::ReadyToRun()
void
BApplication::ReadyToRun()
{
}
//------------------------------------------------------------------------------
void
BApplication::MessageReceived(BMessage *message)
{
@@ -435,22 +452,32 @@ BApplication::MessageReceived(BMessage *message)
BLooper::MessageReceived(message);
break;
}
}
}
//------------------------------------------------------------------------------
void BApplication::ArgvReceived(int32 argc, char** argv)
void
BApplication::ArgvReceived(int32 argc, char **argv)
{
// supposed to be implemented by subclasses
}
//------------------------------------------------------------------------------
void BApplication::AppActivated(bool active)
void
BApplication::AppActivated(bool active)
{
// supposed to be implemented by subclasses
}
//------------------------------------------------------------------------------
void BApplication::RefsReceived(BMessage* a_message)
void
BApplication::RefsReceived(BMessage *message)
{
// supposed to be implemented by subclasses
}
//------------------------------------------------------------------------------
void BApplication::AboutRequested()
void
BApplication::AboutRequested()
{
thread_info info;
if (get_thread_info(Thread(), &info) == B_OK) {
@@ -458,45 +485,58 @@ void BApplication::AboutRequested()
alert->Go(NULL);
}
}
//------------------------------------------------------------------------------
BHandler* BApplication::ResolveSpecifier(BMessage* msg, int32 index,
BMessage* specifier, int32 form,
const char* property)
BHandler *
BApplication::ResolveSpecifier(BMessage *msg, int32 index,
BMessage *specifier, int32 form, const char *property)
{
return NULL; // TODO: implement? not implemented?
// ToDo: implement ResolveSpecifier()!
return NULL;
}
//------------------------------------------------------------------------------
void BApplication::ShowCursor()
void
BApplication::ShowCursor()
{
BPrivate::BAppServerLink link;
link.StartMessage(AS_SHOW_CURSOR);
link.Flush();
}
//------------------------------------------------------------------------------
void BApplication::HideCursor()
void
BApplication::HideCursor()
{
BPrivate::BAppServerLink link;
link.StartMessage(AS_HIDE_CURSOR);
link.Flush();
}
//------------------------------------------------------------------------------
void BApplication::ObscureCursor()
void
BApplication::ObscureCursor()
{
BPrivate::BAppServerLink link;
link.StartMessage(AS_OBSCURE_CURSOR);
link.Flush();
}
//------------------------------------------------------------------------------
bool BApplication::IsCursorHidden() const
bool
BApplication::IsCursorHidden() const
{
BPrivate::BAppServerLink link;
int32 code = SERVER_FALSE;
link.StartMessage(AS_QUERY_CURSOR_HIDDEN);
link.FlushWithReply(&code);
return (code==SERVER_TRUE)?true:false;
return code == SERVER_TRUE;
}
//------------------------------------------------------------------------------
void BApplication::SetCursor(const void* cursor)
void
BApplication::SetCursor(const void *cursor)
{
// BeBook sez: If you want to call SetCursor() without forcing an immediate
// sync of the Application Server, you have to use a BCursor.
@@ -504,8 +544,10 @@ void BApplication::SetCursor(const void* cursor)
BCursor Cursor(cursor);
SetCursor(&Cursor, true);
}
//------------------------------------------------------------------------------
void BApplication::SetCursor(const BCursor* cursor, bool sync)
void
BApplication::SetCursor(const BCursor *cursor, bool sync)
{
BPrivate::BAppServerLink link;
int32 code = SERVER_FALSE;
@@ -518,8 +560,10 @@ void BApplication::SetCursor(const BCursor* cursor, bool sync)
else
link.Flush();
}
//------------------------------------------------------------------------------
int32 BApplication::CountWindows() const
int32
BApplication::CountWindows() const
{
// BeBook sez: The windows list includes all windows explicitely created by
// the app ... but excludes private windows create by Be
@@ -528,8 +572,10 @@ int32 BApplication::CountWindows() const
// param is false.
return count_windows(false);
}
//------------------------------------------------------------------------------
BWindow* BApplication::WindowAt(int32 index) const
BWindow *
BApplication::WindowAt(int32 index) const
{
// BeBook sez: The windows list includes all windows explicitely created by
// the app ... but excludes private windows create by Be
@@ -538,43 +584,50 @@ BWindow* BApplication::WindowAt(int32 index) const
// param is false.
return window_at(index, false);
}
//------------------------------------------------------------------------------
int32 BApplication::CountLoopers() const
int32
BApplication::CountLoopers() const
{
using namespace BPrivate;
BObjectLocker<BLooperList> ListLock(gLooperList);
if (ListLock.IsLocked())
{
return gLooperList.CountLoopers();
// Some bad, non-specific thing has happened
return B_ERROR;
}
return B_ERROR; // Some bad, non-specific thing has happened
}
//------------------------------------------------------------------------------
BLooper* BApplication::LooperAt(int32 index) const
BLooper *
BApplication::LooperAt(int32 index) const
{
using namespace BPrivate;
BLooper *Looper = NULL;
BObjectLocker<BLooperList> ListLock(gLooperList);
if (ListLock.IsLocked())
{
Looper = gLooperList.LooperAt(index);
}
return Looper;
}
//------------------------------------------------------------------------------
bool BApplication::IsLaunching() const
bool
BApplication::IsLaunching() const
{
return !fReadyToRunCalled;
}
//------------------------------------------------------------------------------
status_t BApplication::GetAppInfo(app_info* info) const
status_t
BApplication::GetAppInfo(app_info *info) const
{
return be_roster->GetRunningAppInfo(be_app->Team(), info);
}
//------------------------------------------------------------------------------
BResources* BApplication::AppResources()
BResources *
BApplication::AppResources()
{
if (!_app_resources_lock.Lock())
return NULL;
@@ -595,10 +648,10 @@ BResources* BApplication::AppResources()
if (be_app && be_roster->GetRunningAppInfo(be_app->Team(), &appInfo) == B_OK) {
ref = appInfo.ref;
found = true;
} else
} else {
// Run() hasn't been called yet
found = BPrivate::get_app_ref(&ref) == B_OK;
}
if (found) {
BFile file(&ref, B_READ_ONLY);
@@ -606,7 +659,6 @@ BResources* BApplication::AppResources()
BResources *resources = new BResources();
if (resources->SetTo(&file, false) < B_OK)
delete resources;
else
_app_resources = resources;
}
@@ -702,6 +754,7 @@ BApplication::DispatchMessage(BMessage *message, BHandler *handler)
void
BApplication::SetPulseRate(bigtime_t rate)
{
// ToDo: implement pulse runner!
fPulseRate = rate;
}
@@ -709,82 +762,57 @@ BApplication::SetPulseRate(bigtime_t rate)
status_t
BApplication::GetSupportedSuites(BMessage *data)
{
status_t err = B_OK;
if (!data)
{
err = B_BAD_VALUE;
}
return B_BAD_VALUE;
if (!err)
{
err = data->AddString("Suites", "suite/vnd.Be-application");
if (!err)
{
status_t status = data->AddString("Suites", "suite/vnd.Be-application");
if (status == B_OK) {
BPropertyInfo PropertyInfo(sPropertyInfo);
err = data->AddFlat("message", &PropertyInfo);
if (!err)
{
err = BHandler::GetSupportedSuites(data);
}
}
status = data->AddFlat("message", &PropertyInfo);
if (status == B_OK)
status = BHandler::GetSupportedSuites(data);
}
return err;
return status;
}
//------------------------------------------------------------------------------
status_t BApplication::Perform(perform_code d, void* arg)
status_t
BApplication::Perform(perform_code d, void *arg)
{
return BLooper::Perform(d, arg);
}
//------------------------------------------------------------------------------
BApplication::BApplication(uint32 signature)
{
}
//------------------------------------------------------------------------------
BApplication::BApplication(const BApplication& rhs)
{
}
//------------------------------------------------------------------------------
BApplication& BApplication::operator=(const BApplication& rhs)
{
return *this;
}
//------------------------------------------------------------------------------
void BApplication::_ReservedApplication1()
{
}
//------------------------------------------------------------------------------
void BApplication::_ReservedApplication2()
{
}
//------------------------------------------------------------------------------
void BApplication::_ReservedApplication3()
{
}
//------------------------------------------------------------------------------
void BApplication::_ReservedApplication4()
{
}
//------------------------------------------------------------------------------
void BApplication::_ReservedApplication5()
{
}
//------------------------------------------------------------------------------
void BApplication::_ReservedApplication6()
{
}
//------------------------------------------------------------------------------
void BApplication::_ReservedApplication7()
{
}
//------------------------------------------------------------------------------
void BApplication::_ReservedApplication8()
{
}
//------------------------------------------------------------------------------
void BApplication::_ReservedApplication1() {}
void BApplication::_ReservedApplication2() {}
void BApplication::_ReservedApplication3() {}
void BApplication::_ReservedApplication4() {}
void BApplication::_ReservedApplication5() {}
void BApplication::_ReservedApplication6() {}
void BApplication::_ReservedApplication7() {}
void BApplication::_ReservedApplication8() {}
bool
BApplication::ScriptReceived(BMessage *message, int32 index, BMessage *specifier,
int32 what, const char *property)
BApplication::ScriptReceived(BMessage *message, int32 index,
BMessage *specifier, int32 what, const char *property)
{
// TODO: Implement
printf("message:\n");
@@ -796,13 +824,18 @@ BApplication::ScriptReceived(BMessage *message, int32 index, BMessage *specifier
printf("property: %s\n", property ? property : "");
return false;
}
//------------------------------------------------------------------------------
void BApplication::run_task()
void
BApplication::run_task()
{
// ToDo: run_task() could be removed completely
task_looper();
}
//------------------------------------------------------------------------------
void BApplication::InitData(const char* signature, status_t* error)
void
BApplication::InitData(const char *signature, status_t *error)
{
// check whether there exists already an application
if (be_app)
@@ -886,7 +919,6 @@ void BApplication::InitData(const char* signature, status_t* error)
app_info otherAppInfo;
if (be_roster->GetRunningAppInfo(otherTeam, &otherAppInfo) == B_OK
&& !(otherAppInfo.flags & B_ARGV_ONLY)) {
// create an B_ARGV_RECEIVED message
BMessage argvMessage(B_ARGV_RECEIVED);
fill_argv_message(&argvMessage);
@@ -936,7 +968,6 @@ void BApplication::InitData(const char* signature, status_t* error)
get_scs();
#endif // RUN_WITHOUT_APP_SERVER
// init be_app and be_app_messenger
if (fInitError == B_OK) {
be_app = this;
@@ -973,29 +1004,37 @@ void BApplication::InitData(const char* signature, status_t* error)
else if (fInitError != B_OK)
exit(0);
}
//------------------------------------------------------------------------------
void BApplication::BeginRectTracking(BRect r, bool trackWhole)
void
BApplication::BeginRectTracking(BRect rect, bool trackWhole)
{
BPrivate::BAppServerLink link;
link.StartMessage(AS_BEGIN_RECT_TRACKING);
link.Attach<BRect>(r);
link.Attach<BRect>(rect);
link.Attach<int32>(trackWhole);
link.Flush();
}
//------------------------------------------------------------------------------
void BApplication::EndRectTracking()
void
BApplication::EndRectTracking()
{
BPrivate::BAppServerLink link;
link.StartMessage(AS_END_RECT_TRACKING);
link.Flush();
}
//------------------------------------------------------------------------------
void BApplication::get_scs()
void
BApplication::get_scs()
{
gPrivateScreen = new BPrivateScreen();
}
//------------------------------------------------------------------------------
void BApplication::setup_server_heaps()
void
BApplication::setup_server_heaps()
{
// TODO: implement?
@@ -1004,34 +1043,49 @@ void BApplication::setup_server_heaps()
// app_server. Currently (7/29/04), the R1 app_server does not do this and
// may never do this unless a significant need is found for it. --DW
}
//------------------------------------------------------------------------------
void* BApplication::rw_offs_to_ptr(uint32 offset)
void *
BApplication::rw_offs_to_ptr(uint32 offset)
{
return NULL; // TODO: implement
}
//------------------------------------------------------------------------------
void* BApplication::ro_offs_to_ptr(uint32 offset)
void *
BApplication::ro_offs_to_ptr(uint32 offset)
{
return NULL; // TODO: implement
}
//------------------------------------------------------------------------------
void* BApplication::global_ro_offs_to_ptr(uint32 offset)
void *
BApplication::global_ro_offs_to_ptr(uint32 offset)
{
return NULL; // TODO: implement
}
//------------------------------------------------------------------------------
void BApplication::connect_to_app_server()
void
BApplication::connect_to_app_server()
{
fServerFrom = find_port(SERVER_PORT_NAME);
if (fServerFrom >= 0) {
if (fServerFrom < B_OK) {
fInitError = fServerFrom;
return;
}
// Create the port so that the app_server knows where to send messages
fServerTo = create_port(100, "a<fServerTo");
if (fServerTo >= 0) {
if (fServerTo < B_OK) {
fInitError = fServerTo;
return;
}
// We can't use BAppServerLink because be_app == NULL
// AS_CREATE_APP:
//
// Attach data:
// 1) port_id - receiver port of a regular app
// 2) port_id - looper port for this BApplication
@@ -1057,39 +1111,47 @@ void BApplication::connect_to_app_server()
link.Read<port_id>(&fServerFrom);
else
debugger("BApplication: couldn't obtain new app_server comm port");
}
} else
fInitError = fServerTo;
} else
fInitError = fServerFrom;
}
//------------------------------------------------------------------------------
void BApplication::send_drag(BMessage* msg, int32 vs_token, BPoint offset, BRect drag_rect, BHandler* reply_to)
void
BApplication::send_drag(BMessage *message, int32 vs_token, BPoint offset,
BRect dragRect, BHandler *replyTo)
{
// TODO: implement
}
//------------------------------------------------------------------------------
void BApplication::send_drag(BMessage* msg, int32 vs_token, BPoint offset, int32 bitmap_token, drawing_mode dragMode, BHandler* reply_to)
void
BApplication::send_drag(BMessage *message, int32 vs_token, BPoint offset,
int32 bitmapToken, drawing_mode dragMode, BHandler *replyTo)
{
// TODO: implement
}
//------------------------------------------------------------------------------
void BApplication::write_drag(_BSession_* session, BMessage* a_message)
void
BApplication::write_drag(_BSession_ *session, BMessage *message)
{
// TODO: implement
}
//------------------------------------------------------------------------------
bool BApplication::quit_all_windows(bool force)
bool
BApplication::quit_all_windows(bool force)
{
return false; // TODO: implement?
}
//------------------------------------------------------------------------------
bool BApplication::window_quit_loop(bool, bool)
bool
BApplication::window_quit_loop(bool, bool)
{
// TODO: Implement and use in BApplication::QuitRequested()
return false;
}
//------------------------------------------------------------------------------
void
BApplication::do_argv(BMessage *message)
{
@@ -1133,12 +1195,15 @@ BApplication::do_argv(BMessage* message)
delete[] argv;
}
}
//------------------------------------------------------------------------------
uint32 BApplication::InitialWorkspace()
uint32
BApplication::InitialWorkspace()
{
return fInitialWorkspace;
}
//------------------------------------------------------------------------------
int32
BApplication::count_windows(bool includeMenus) const
{
@@ -1149,7 +1214,8 @@ BApplication::count_windows(bool includeMenus) const
return count;
}
//------------------------------------------------------------------------------
BWindow *
BApplication::window_at(uint32 index, bool includeMenus) const
{
@@ -1162,7 +1228,8 @@ BApplication::window_at(uint32 index, bool includeMenus) const
return window;
}
//------------------------------------------------------------------------------
status_t
BApplication::get_window_list(BList *list, bool includeMenus) const
{
@@ -1173,7 +1240,9 @@ BApplication::get_window_list(BList *list, bool includeMenus) const
// Windows are BLoopers, so we can just check each BLooper to see if it's
// a BWindow (or BMenuWindow)
BObjectLocker<BLooperList> listLock(gLooperList);
if (listLock.IsLocked()) {
if (!listLock.IsLocked())
return B_ERROR;
BLooper *looper = NULL;
for (int32 i = 0; i < gLooperList.CountLoopers(); i++) {
looper = gLooperList.LooperAt(i);
@@ -1186,14 +1255,13 @@ BApplication::get_window_list(BList *list, bool includeMenus) const
return B_OK;
}
return B_ERROR;
}
//------------------------------------------------------------------------------
int32 BApplication::async_quit_entry(void* data)
int32
BApplication::async_quit_entry(void *data)
{
return 0; // TODO: implement? not implemented?
}
//------------------------------------------------------------------------------
// check_app_signature
/*! \brief Checks whether the supplied string is a valid application signature.
@@ -1205,6 +1273,7 @@ int32 BApplication::async_quit_entry(void* data)
- \c B_OK: \a signature is a valid app signature.
- \c B_BAD_VALUE: \a signature is \c NULL or no valid app signature.
*/
static
status_t
check_app_signature(const char *signature)
@@ -1223,6 +1292,7 @@ check_app_signature(const char *signature)
return (isValid ? B_OK : B_BAD_VALUE);
}
// looper_name_for
/*! \brief Returns the looper name for a given signature.
@@ -1231,6 +1301,7 @@ check_app_signature(const char *signature)
\return The looper name.
*/
static
const char*
looper_name_for(const char *signature)
@@ -1244,6 +1315,7 @@ looper_name_for(const char *signature)
// fill_argv_message
/*! \brief Fills the passed BMessage with B_ARGV_RECEIVED infos.
*/
static void
fill_argv_message(BMessage *message)
{
@@ -1267,10 +1339,3 @@ fill_argv_message(BMessage *message)
}
}
/*
* $Log $
*
* $Id $
*
*/