Cleanup!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15806 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+46
-105
@@ -1,128 +1,69 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Frans van Nispen ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: Invoker.h
|
|
||||||
// Author: Frans van Nispen ([email protected])
|
|
||||||
// Description: BInvoker class defines a protocol for objects that
|
|
||||||
// post messages to a "target".
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef _INVOKER_H
|
#ifndef _INVOKER_H
|
||||||
#define _INVOKER_H
|
#define _INVOKER_H
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <BeBuild.h>
|
#include <BeBuild.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Includes --------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Defines ---------------------------------------------------------------
|
|
||||||
|
|
||||||
// Globals ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BHandler;
|
class BHandler;
|
||||||
class BLooper;
|
class BLooper;
|
||||||
class BMessage;
|
class BMessage;
|
||||||
|
|
||||||
// BInvoker class --------------------------------------------------------------
|
|
||||||
class BInvoker {
|
class BInvoker {
|
||||||
public:
|
public:
|
||||||
BInvoker();
|
BInvoker();
|
||||||
BInvoker(BMessage *message,
|
BInvoker(BMessage* message, const BHandler* handler,
|
||||||
const BHandler *handler,
|
const BLooper* looper = NULL);
|
||||||
const BLooper *looper = NULL);
|
BInvoker(BMessage* message, BMessenger target);
|
||||||
BInvoker(BMessage *message, BMessenger target);
|
virtual ~BInvoker();
|
||||||
virtual ~BInvoker();
|
|
||||||
|
|
||||||
virtual status_t SetMessage(BMessage *message);
|
virtual status_t SetMessage(BMessage *message);
|
||||||
BMessage *Message() const;
|
BMessage* Message() const;
|
||||||
uint32 Command() const;
|
uint32 Command() const;
|
||||||
|
|
||||||
virtual status_t SetTarget(const BHandler *h, const BLooper *loop = NULL);
|
virtual status_t SetTarget(const BHandler *handler,
|
||||||
virtual status_t SetTarget(BMessenger messenger);
|
const BLooper *looper = NULL);
|
||||||
bool IsTargetLocal() const;
|
virtual status_t SetTarget(BMessenger messenger);
|
||||||
BHandler *Target(BLooper **looper = NULL) const;
|
bool IsTargetLocal() const;
|
||||||
BMessenger Messenger() const;
|
BHandler* Target(BLooper** _looper = NULL) const;
|
||||||
|
BMessenger Messenger() const;
|
||||||
|
|
||||||
virtual status_t SetHandlerForReply(BHandler *handler);
|
virtual status_t SetHandlerForReply(BHandler* handler);
|
||||||
BHandler *HandlerForReply() const;
|
BHandler* HandlerForReply() const;
|
||||||
|
|
||||||
virtual status_t Invoke(BMessage *msg = NULL);
|
virtual status_t Invoke(BMessage* message = NULL);
|
||||||
|
status_t InvokeNotify(BMessage* message,
|
||||||
|
uint32 kind = B_CONTROL_INVOKED);
|
||||||
|
status_t SetTimeout(bigtime_t timeout);
|
||||||
|
bigtime_t Timeout() const;
|
||||||
|
|
||||||
// Invoke with BHandler notification. Use this to perform an
|
protected:
|
||||||
// Invoke() with some other kind of notification change code.
|
uint32 InvokeKind(bool* _notify = NULL);
|
||||||
// (A raw invoke should always notify as B_CONTROL_INVOKED.)
|
void BeginInvokeNotify(uint32 kind = B_CONTROL_INVOKED);
|
||||||
// Unlike a raw Invoke(), there is no standard message that is
|
void EndInvokeNotify();
|
||||||
// sent. If 'msg' is NULL, then nothing will be sent to this
|
|
||||||
// invoker's target... however, a notification message will
|
|
||||||
// still be sent to any watchers of the invoker's handler.
|
|
||||||
// Note that the BInvoker class does not actually implement
|
|
||||||
// any of this behavior -- it is up to subclasses to override
|
|
||||||
// Invoke() and call Notify() with the appropriate change code.
|
|
||||||
status_t InvokeNotify(BMessage *msg, uint32 kind = B_CONTROL_INVOKED);
|
|
||||||
status_t SetTimeout(bigtime_t timeout);
|
|
||||||
bigtime_t Timeout() const;
|
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
// Return the change code for a notification. This is either
|
virtual void _ReservedInvoker1();
|
||||||
// B_CONTROL_INVOKED for raw Invoke() calls, or the kind
|
virtual void _ReservedInvoker2();
|
||||||
// supplied to InvokeNotify(). In addition, 'notify' will be
|
virtual void _ReservedInvoker3();
|
||||||
// set to true if this was an InvokeNotify() call, else false.
|
|
||||||
uint32 InvokeKind(bool* notify = NULL);
|
|
||||||
|
|
||||||
// Start and end an InvokeNotify context around an Invoke() call.
|
BInvoker(const BInvoker&);
|
||||||
// These are only needed for writing custom methods that
|
BInvoker& operator=(const BInvoker&);
|
||||||
// emulate the standard InvokeNotify() call.
|
|
||||||
void BeginInvokeNotify(uint32 kind = B_CONTROL_INVOKED);
|
|
||||||
void EndInvokeNotify();
|
|
||||||
|
|
||||||
// Private or reserved ---------------------------------------------------------
|
BMessage* fMessage;
|
||||||
private:
|
BMessenger fMessenger;
|
||||||
// to be able to keep binary compatibility
|
BHandler* fReplyTo;
|
||||||
virtual void _ReservedInvoker1();
|
bigtime_t fTimeout;
|
||||||
virtual void _ReservedInvoker2();
|
uint32 fNotifyKind;
|
||||||
virtual void _ReservedInvoker3();
|
uint32 _reserved[1];
|
||||||
|
|
||||||
BInvoker(const BInvoker&);
|
|
||||||
BInvoker &operator=(const BInvoker&);
|
|
||||||
|
|
||||||
BMessage *fMessage;
|
|
||||||
BMessenger fMessenger;
|
|
||||||
BHandler *fReplyTo;
|
|
||||||
bigtime_t fTimeout;
|
|
||||||
uint32 fNotifyKind;
|
|
||||||
uint32 _reserved[1]; // to be able to keep binary compatibility
|
|
||||||
};
|
};
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#endif // _INVOKER_H
|
#endif // _INVOKER_H
|
||||||
|
|
||||||
/*
|
|
||||||
* $Log $
|
|
||||||
*
|
|
||||||
* $Id $
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,46 +1,17 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Erik Jaesler ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: MessageFilter.h
|
|
||||||
// Author: Erik Jaesler ([email protected])
|
|
||||||
// Description: BMessageFilter class creates objects that filter
|
|
||||||
// in-coming BMessages.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef _MESSAGE_FILTER_H
|
#ifndef _MESSAGE_FILTER_H
|
||||||
#define _MESSAGE_FILTER_H
|
#define _MESSAGE_FILTER_H
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <BeBuild.h>
|
#include <BeBuild.h>
|
||||||
#include <Handler.h>
|
#include <Handler.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Includes --------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Defines ---------------------------------------------------------------
|
|
||||||
|
|
||||||
// Globals ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BMessage;
|
class BMessage;
|
||||||
|
|
||||||
@@ -67,60 +38,48 @@ enum message_source {
|
|||||||
B_LOCAL_SOURCE
|
B_LOCAL_SOURCE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// BMessageFilter Class --------------------------------------------------------
|
// BMessageFilter Class --------------------------------------------------------
|
||||||
class BMessageFilter {
|
class BMessageFilter {
|
||||||
|
public:
|
||||||
|
BMessageFilter(uint32 what,
|
||||||
|
filter_hook func = NULL);
|
||||||
|
BMessageFilter(message_delivery delivery,
|
||||||
|
message_source source, filter_hook func = NULL);
|
||||||
|
BMessageFilter(message_delivery delivery,
|
||||||
|
message_source source, uint32 what,
|
||||||
|
filter_hook func = NULL);
|
||||||
|
BMessageFilter(const BMessageFilter& filter);
|
||||||
|
BMessageFilter(const BMessageFilter* filter);
|
||||||
|
virtual ~BMessageFilter();
|
||||||
|
|
||||||
public:
|
BMessageFilter& operator=(const BMessageFilter& from);
|
||||||
BMessageFilter( uint32 what,
|
|
||||||
filter_hook func = NULL);
|
|
||||||
BMessageFilter( message_delivery delivery,
|
|
||||||
message_source source,
|
|
||||||
filter_hook func = NULL);
|
|
||||||
BMessageFilter( message_delivery delivery,
|
|
||||||
message_source source,
|
|
||||||
uint32 what,
|
|
||||||
filter_hook func = NULL);
|
|
||||||
BMessageFilter(const BMessageFilter& filter);
|
|
||||||
BMessageFilter(const BMessageFilter* filter);
|
|
||||||
virtual ~BMessageFilter();
|
|
||||||
|
|
||||||
BMessageFilter &operator=(const BMessageFilter& from);
|
// Hook function; ignored if filter_hook is non-NULL
|
||||||
|
virtual filter_result Filter(BMessage* message, BHandler** _target);
|
||||||
|
|
||||||
// Hook function; ignored if filter_hook is non-NULL
|
message_delivery MessageDelivery() const;
|
||||||
virtual filter_result Filter(BMessage* message, BHandler** target);
|
message_source MessageSource() const;
|
||||||
|
uint32 Command() const;
|
||||||
|
bool FiltersAnyCommand() const;
|
||||||
|
BLooper* Looper() const;
|
||||||
|
|
||||||
message_delivery MessageDelivery() const;
|
private:
|
||||||
message_source MessageSource() const;
|
friend class BLooper;
|
||||||
uint32 Command() const;
|
friend class BHandler;
|
||||||
bool FiltersAnyCommand() const;
|
|
||||||
BLooper *Looper() const;
|
|
||||||
|
|
||||||
// Private or reserved ---------------------------------------------------------
|
virtual void _ReservedMessageFilter1();
|
||||||
private:
|
virtual void _ReservedMessageFilter2();
|
||||||
friend class BLooper;
|
|
||||||
friend class BHandler;
|
|
||||||
|
|
||||||
virtual void _ReservedMessageFilter1();
|
void SetLooper(BLooper* owner);
|
||||||
virtual void _ReservedMessageFilter2();
|
filter_hook FilterFunction() const;
|
||||||
|
bool fFiltersAny;
|
||||||
void SetLooper(BLooper* owner);
|
uint32 fWhat;
|
||||||
filter_hook FilterFunction() const;
|
message_delivery fDelivery;
|
||||||
bool fFiltersAny;
|
message_source fSource;
|
||||||
uint32 what;
|
BLooper *fLooper;
|
||||||
message_delivery fDelivery;
|
filter_hook fFilterFunction;
|
||||||
message_source fSource;
|
uint32 _reserved[3];
|
||||||
BLooper *fLooper;
|
|
||||||
filter_hook fFilterFunction;
|
|
||||||
uint32 _reserved[3];
|
|
||||||
};
|
};
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#endif // _MESSAGE_FILTER_H
|
#endif // _MESSAGE_FILTER_H
|
||||||
|
|
||||||
/*
|
|
||||||
* $Log $
|
|
||||||
*
|
|
||||||
* $Id $
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,11 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Ingo Weinhold, bonefish@@users.sf.net
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: AppMisc.cpp
|
|
||||||
// Author: Ingo Weinhold ([email protected])
|
|
||||||
// Description: Miscellaneous private functionality.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
@@ -32,6 +15,7 @@
|
|||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
// get_app_path
|
// get_app_path
|
||||||
|
|||||||
+19
-36
@@ -1,44 +1,23 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2004, Haiku
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Gabe Yoder ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: Clipboard.cpp
|
|
||||||
// Author: Gabe Yoder ([email protected])
|
|
||||||
// Description: BClipboard provides an interface to a system-wide clipboard
|
|
||||||
// storage area.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
#include <ClipboardPrivate.h>
|
||||||
|
|
||||||
#include <Clipboard.h>
|
#include <Clipboard.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <RegistrarDefs.h>
|
#include <RegistrarDefs.h>
|
||||||
#include <RosterPrivate.h>
|
#include <RosterPrivate.h>
|
||||||
|
|
||||||
#include <ClipboardPrivate.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
// Globals ---------------------------------------------------------------------
|
|
||||||
#ifdef RUN_WITHOUT_REGISTRAR
|
#ifdef RUN_WITHOUT_REGISTRAR
|
||||||
static BClipboard sClipboard(NULL);
|
static BClipboard sClipboard(NULL);
|
||||||
BClipboard *be_clipboard = &sClipboard;
|
BClipboard *be_clipboard = &sClipboard;
|
||||||
@@ -86,6 +65,7 @@ BClipboard::Name() const
|
|||||||
return (const char *)fName;
|
return (const char *)fName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Returns the (locally cached) number of commits to the clipboard.
|
/*! \brief Returns the (locally cached) number of commits to the clipboard.
|
||||||
|
|
||||||
The returned value is the number of successful Commit() invocations for
|
The returned value is the number of successful Commit() invocations for
|
||||||
@@ -102,6 +82,7 @@ BClipboard::LocalCount() const
|
|||||||
return fCount;
|
return fCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Returns the number of commits to the clipboard.
|
/*! \brief Returns the number of commits to the clipboard.
|
||||||
|
|
||||||
The returned value is the number of successful Commit() invocations for
|
The returned value is the number of successful Commit() invocations for
|
||||||
@@ -240,8 +221,7 @@ BClipboard::Data() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - Private methods
|
||||||
// Private methods
|
|
||||||
|
|
||||||
|
|
||||||
BClipboard::BClipboard(const BClipboard &)
|
BClipboard::BClipboard(const BClipboard &)
|
||||||
@@ -305,7 +285,10 @@ BClipboard::UploadToSystem()
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// init_clipboard
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Initializes the global \c be_clipboard.
|
/*! \brief Initializes the global \c be_clipboard.
|
||||||
|
|
||||||
Invoked at libbe initialization time.
|
Invoked at libbe initialization time.
|
||||||
|
|||||||
+13
-36
@@ -1,29 +1,11 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2005, Haiku
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Erik Jaesler ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: Handler.cpp
|
|
||||||
// Author: Erik Jaesler ([email protected])
|
|
||||||
// Description: BHandler defines the message-handling protocol.
|
|
||||||
// MessageReceived() is its lynchpin.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
/**
|
/**
|
||||||
@note Some musings on the member variable 'fToken'. In searching a dump
|
@note Some musings on the member variable 'fToken'. In searching a dump
|
||||||
of libbe.so, I found a struct/class called 'TokenSpace', which has
|
of libbe.so, I found a struct/class called 'TokenSpace', which has
|
||||||
@@ -119,15 +101,8 @@
|
|||||||
Maybe that's too heavy-weight a solution, though.
|
Maybe that's too heavy-weight a solution, though.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
#include <TokenSpace.h>
|
||||||
#include <algorithm>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <map>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <AppDefs.h>
|
#include <AppDefs.h>
|
||||||
#include <Handler.h>
|
#include <Handler.h>
|
||||||
#include <Looper.h>
|
#include <Looper.h>
|
||||||
@@ -136,8 +111,10 @@
|
|||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <PropertyInfo.h>
|
#include <PropertyInfo.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
#include <algorithm>
|
||||||
#include <TokenSpace.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using std::map;
|
using std::map;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|||||||
+118
-112
@@ -1,145 +1,138 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Marc Flerackers ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: Invoker.cpp
|
|
||||||
// Author: Marc Flerackers ([email protected])
|
|
||||||
// Description: BInvoker class defines a protocol for objects that
|
|
||||||
// post messages to a "target".
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <Invoker.h>
|
#include <Invoker.h>
|
||||||
#include <Errors.h>
|
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Includes --------------------------------------------------------------
|
BInvoker::BInvoker(BMessage* message, BMessenger messenger)
|
||||||
|
:
|
||||||
// Local Defines ---------------------------------------------------------------
|
fMessage(message),
|
||||||
|
fMessenger(messenger),
|
||||||
// Globals ---------------------------------------------------------------------
|
fReplyTo(NULL),
|
||||||
|
fTimeout(B_INFINITE_TIMEOUT),
|
||||||
//------------------------------------------------------------------------------
|
fNotifyKind(0)
|
||||||
BInvoker::BInvoker(BMessage *message, BMessenger messenger)
|
|
||||||
: fMessage(message),
|
|
||||||
fMessenger(messenger),
|
|
||||||
fReplyTo(NULL),
|
|
||||||
fTimeout(B_INFINITE_TIMEOUT),
|
|
||||||
fNotifyKind(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BInvoker::BInvoker(BMessage *message, const BHandler *handler,
|
|
||||||
const BLooper *looper)
|
BInvoker::BInvoker(BMessage* message, const BHandler* handler,
|
||||||
: fMessage(message),
|
const BLooper* looper)
|
||||||
fMessenger(BMessenger(handler, looper)),
|
:
|
||||||
fReplyTo(NULL),
|
fMessage(message),
|
||||||
fTimeout(B_INFINITE_TIMEOUT),
|
fMessenger(BMessenger(handler, looper)),
|
||||||
fNotifyKind(0)
|
fReplyTo(NULL),
|
||||||
|
fTimeout(B_INFINITE_TIMEOUT),
|
||||||
|
fNotifyKind(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BInvoker::BInvoker()
|
BInvoker::BInvoker()
|
||||||
: fMessage(NULL),
|
:
|
||||||
fReplyTo(NULL),
|
fMessage(NULL),
|
||||||
fTimeout(B_INFINITE_TIMEOUT),
|
fReplyTo(NULL),
|
||||||
fNotifyKind(0)
|
fTimeout(B_INFINITE_TIMEOUT),
|
||||||
|
fNotifyKind(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BInvoker::~BInvoker()
|
BInvoker::~BInvoker()
|
||||||
{
|
{
|
||||||
delete fMessage;
|
delete fMessage;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BInvoker::SetMessage(BMessage *message)
|
|
||||||
|
status_t
|
||||||
|
BInvoker::SetMessage(BMessage* message)
|
||||||
{
|
{
|
||||||
if (fMessage == message)
|
if (fMessage == message)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
if (fMessage)
|
delete fMessage;
|
||||||
delete fMessage;
|
|
||||||
|
|
||||||
fMessage = message;
|
fMessage = message;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BMessage *BInvoker::Message() const
|
|
||||||
|
BMessage *
|
||||||
|
BInvoker::Message() const
|
||||||
{
|
{
|
||||||
return fMessage;
|
return fMessage;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
uint32 BInvoker::Command() const
|
|
||||||
|
uint32
|
||||||
|
BInvoker::Command() const
|
||||||
{
|
{
|
||||||
if (fMessage)
|
if (fMessage)
|
||||||
return fMessage->what;
|
return fMessage->what;
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BInvoker::SetTarget(BMessenger messenger)
|
|
||||||
|
status_t
|
||||||
|
BInvoker::SetTarget(BMessenger messenger)
|
||||||
{
|
{
|
||||||
fMessenger = messenger;
|
fMessenger = messenger;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BInvoker::SetTarget(const BHandler *handler, const BLooper *looper)
|
|
||||||
|
status_t
|
||||||
|
BInvoker::SetTarget(const BHandler* handler, const BLooper* looper)
|
||||||
{
|
{
|
||||||
fMessenger = BMessenger(handler, looper);
|
fMessenger = BMessenger(handler, looper);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BInvoker::IsTargetLocal() const
|
|
||||||
|
bool
|
||||||
|
BInvoker::IsTargetLocal() const
|
||||||
{
|
{
|
||||||
return fMessenger.IsTargetLocal();
|
return fMessenger.IsTargetLocal();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BHandler *BInvoker::Target(BLooper **looper) const
|
|
||||||
|
BHandler*
|
||||||
|
BInvoker::Target(BLooper** _looper) const
|
||||||
{
|
{
|
||||||
return fMessenger.Target(looper);
|
return fMessenger.Target(_looper);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BMessenger BInvoker::Messenger() const
|
|
||||||
|
BMessenger
|
||||||
|
BInvoker::Messenger() const
|
||||||
{
|
{
|
||||||
return fMessenger;
|
return fMessenger;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BInvoker::SetHandlerForReply(BHandler *replyHandler)
|
|
||||||
|
status_t
|
||||||
|
BInvoker::SetHandlerForReply(BHandler* replyHandler)
|
||||||
{
|
{
|
||||||
fReplyTo = replyHandler;
|
fReplyTo = replyHandler;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BHandler *BInvoker::HandlerForReply() const
|
|
||||||
|
BHandler *
|
||||||
|
BInvoker::HandlerForReply() const
|
||||||
{
|
{
|
||||||
return fReplyTo;
|
return fReplyTo;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BInvoker::Invoke(BMessage *message)
|
|
||||||
|
status_t
|
||||||
|
BInvoker::Invoke(BMessage* message)
|
||||||
{
|
{
|
||||||
if (!message)
|
if (!message)
|
||||||
message = Message();
|
message = Message();
|
||||||
@@ -149,64 +142,77 @@ status_t BInvoker::Invoke(BMessage *message)
|
|||||||
|
|
||||||
return fMessenger.SendMessage(message, fReplyTo, fTimeout);
|
return fMessenger.SendMessage(message, fReplyTo, fTimeout);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BInvoker::InvokeNotify(BMessage *message, uint32 kind)
|
|
||||||
|
status_t
|
||||||
|
BInvoker::InvokeNotify(BMessage* message, uint32 kind)
|
||||||
{
|
{
|
||||||
if (fNotifyKind != 0)
|
if (fNotifyKind != 0)
|
||||||
return B_WOULD_BLOCK;
|
return B_WOULD_BLOCK;
|
||||||
|
|
||||||
BeginInvokeNotify(kind);
|
BeginInvokeNotify(kind);
|
||||||
|
|
||||||
status_t err = Invoke(message);
|
status_t err = Invoke(message);
|
||||||
|
|
||||||
EndInvokeNotify();
|
EndInvokeNotify();
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BInvoker::SetTimeout(bigtime_t timeout)
|
|
||||||
|
status_t
|
||||||
|
BInvoker::SetTimeout(bigtime_t timeout)
|
||||||
{
|
{
|
||||||
fTimeout = timeout;
|
fTimeout = timeout;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bigtime_t BInvoker::Timeout() const
|
|
||||||
|
bigtime_t
|
||||||
|
BInvoker::Timeout() const
|
||||||
{
|
{
|
||||||
return fTimeout;
|
return fTimeout;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
uint32 BInvoker::InvokeKind(bool *notify)
|
|
||||||
|
uint32
|
||||||
|
BInvoker::InvokeKind(bool* _notify)
|
||||||
{
|
{
|
||||||
if (notify)
|
if (_notify)
|
||||||
*notify = (fNotifyKind != 0) ? true : false;
|
*_notify = fNotifyKind != 0;
|
||||||
|
|
||||||
if (fNotifyKind != 0)
|
if (fNotifyKind != 0)
|
||||||
return fNotifyKind;
|
return fNotifyKind;
|
||||||
else
|
|
||||||
return B_CONTROL_INVOKED;
|
return B_CONTROL_INVOKED;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BInvoker::BeginInvokeNotify(uint32 kind)
|
|
||||||
|
void
|
||||||
|
BInvoker::BeginInvokeNotify(uint32 kind)
|
||||||
{
|
{
|
||||||
fNotifyKind = kind;
|
fNotifyKind = kind;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BInvoker::EndInvokeNotify()
|
|
||||||
|
void
|
||||||
|
BInvoker::EndInvokeNotify()
|
||||||
{
|
{
|
||||||
fNotifyKind = 0;
|
fNotifyKind = 0;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void BInvoker::_ReservedInvoker1() {}
|
void BInvoker::_ReservedInvoker1() {}
|
||||||
void BInvoker::_ReservedInvoker2() {}
|
void BInvoker::_ReservedInvoker2() {}
|
||||||
void BInvoker::_ReservedInvoker3() {}
|
void BInvoker::_ReservedInvoker3() {}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BInvoker::BInvoker(const BInvoker &)
|
BInvoker::BInvoker(const BInvoker &)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BInvoker &BInvoker::operator=(const BInvoker &)
|
|
||||||
|
BInvoker &
|
||||||
|
BInvoker::operator=(const BInvoker &)
|
||||||
{
|
{
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|||||||
+124
-136
@@ -1,89 +1,72 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Erik Jaesler ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: LooperList.cpp
|
|
||||||
// Author(s): Erik Jaesler ([email protected])
|
|
||||||
// Description: Maintains a global list of all loopers in a given team.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
//! Maintains a global list of all loopers in a given team.
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
|
#include "LooperList.h"
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <Looper.h>
|
#include <Looper.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
#include <algorithm>
|
||||||
|
|
||||||
// Local Includes --------------------------------------------------------------
|
|
||||||
#include "LooperList.h"
|
|
||||||
|
|
||||||
// Local Defines ---------------------------------------------------------------
|
|
||||||
|
|
||||||
// Globals ---------------------------------------------------------------------
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
BLooperList gLooperList;
|
BLooperList gLooperList;
|
||||||
|
|
||||||
typedef vector<BLooperList::LooperData>::iterator LDIter;
|
typedef vector<BLooperList::LooperData>::iterator LooperDataIterator;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BLooperList::BLooperList()
|
BLooperList::BLooperList()
|
||||||
: fLock("BLooperList lock"),
|
:
|
||||||
|
fLock("BLooperList lock"),
|
||||||
fLooperID(0)
|
fLooperID(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BLooperList::Lock()
|
|
||||||
|
bool
|
||||||
|
BLooperList::Lock()
|
||||||
{
|
{
|
||||||
return fLock.Lock();
|
return fLock.Lock();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BLooperList::Unlock()
|
|
||||||
|
void
|
||||||
|
BLooperList::Unlock()
|
||||||
{
|
{
|
||||||
fLock.Unlock();
|
fLock.Unlock();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BLooperList::IsLocked()
|
|
||||||
|
bool
|
||||||
|
BLooperList::IsLocked()
|
||||||
{
|
{
|
||||||
return fLock.IsLocked();
|
return fLock.IsLocked();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BLooperList::AddLooper(BLooper* looper)
|
|
||||||
|
void
|
||||||
|
BLooperList::AddLooper(BLooper* looper)
|
||||||
{
|
{
|
||||||
BAutolock Listlock(fLock);
|
BAutolock Listlock(fLock);
|
||||||
AssertLocked();
|
AssertLocked();
|
||||||
if (!IsLooperValid(looper))
|
if (!IsLooperValid(looper)) {
|
||||||
{
|
LooperDataIterator i = find_if(fData.begin(), fData.end(), EmptySlotPred);
|
||||||
LDIter i = find_if(fData.begin(), fData.end(), EmptySlotPred);
|
if (i == fData.end()) {
|
||||||
if (i == fData.end())
|
|
||||||
{
|
|
||||||
fData.push_back(LooperData(looper, ++fLooperID));
|
fData.push_back(LooperData(looper, ++fLooperID));
|
||||||
looper->fLooperID = fLooperID;
|
looper->fLooperID = fLooperID;
|
||||||
looper->Lock();
|
looper->Lock();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
i->looper = looper;
|
i->looper = looper;
|
||||||
i->id = ++fLooperID;
|
i->id = ++fLooperID;
|
||||||
looper->fLooperID = fLooperID;
|
looper->fLooperID = fLooperID;
|
||||||
@@ -91,183 +74,188 @@ void BLooperList::AddLooper(BLooper* looper)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BLooperList::IsLooperValid(const BLooper* looper)
|
|
||||||
|
bool
|
||||||
|
BLooperList::IsLooperValid(const BLooper* looper)
|
||||||
{
|
{
|
||||||
BAutolock Listlock(fLock);
|
BAutolock Listlock(fLock);
|
||||||
AssertLocked();
|
AssertLocked();
|
||||||
|
|
||||||
return find_if(fData.begin(), fData.end(), FindLooperPred(looper)) !=
|
return find_if(fData.begin(), fData.end(),
|
||||||
fData.end();
|
FindLooperPred(looper)) != fData.end();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BLooperList::RemoveLooper(BLooper* looper)
|
|
||||||
|
bool
|
||||||
|
BLooperList::RemoveLooper(BLooper* looper)
|
||||||
{
|
{
|
||||||
BAutolock Listlock(fLock);
|
BAutolock Listlock(fLock);
|
||||||
AssertLocked();
|
AssertLocked();
|
||||||
|
|
||||||
LDIter i = find_if(fData.begin(), fData.end(), FindLooperPred(looper));
|
LooperDataIterator i = find_if(fData.begin(), fData.end(),
|
||||||
if (i != fData.end())
|
FindLooperPred(looper));
|
||||||
{
|
if (i != fData.end()) {
|
||||||
i->looper = NULL;
|
i->looper = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BLooperList::GetLooperList(BList* list)
|
|
||||||
|
void
|
||||||
|
BLooperList::GetLooperList(BList* list)
|
||||||
{
|
{
|
||||||
BAutolock Listlock(fLock);
|
BAutolock Listlock(fLock);
|
||||||
AssertLocked();
|
AssertLocked();
|
||||||
for (uint32 i = 0; i < fData.size(); ++i)
|
|
||||||
{
|
for (uint32 i = 0; i < fData.size(); ++i) {
|
||||||
if (fData[i].looper)
|
if (fData[i].looper)
|
||||||
list->AddItem(fData[i].looper);
|
list->AddItem(fData[i].looper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
int32 BLooperList::CountLoopers()
|
|
||||||
|
int32
|
||||||
|
BLooperList::CountLoopers()
|
||||||
{
|
{
|
||||||
BAutolock Listlock(fLock);
|
BAutolock Listlock(fLock);
|
||||||
AssertLocked();
|
AssertLocked();
|
||||||
return (int32)fData.size();
|
return (int32)fData.size();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BLooper* BLooperList::LooperAt(int32 index)
|
|
||||||
|
BLooper*
|
||||||
|
BLooperList::LooperAt(int32 index)
|
||||||
{
|
{
|
||||||
BAutolock Listlock(fLock);
|
BAutolock Listlock(fLock);
|
||||||
AssertLocked();
|
AssertLocked();
|
||||||
|
|
||||||
BLooper* Looper = NULL;
|
BLooper* looper = NULL;
|
||||||
if (index < (int32)fData.size())
|
if (index < (int32)fData.size())
|
||||||
{
|
looper = fData[(uint32)index].looper;
|
||||||
Looper = fData[(uint32)index].looper;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Looper;
|
return looper;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BLooper* BLooperList::LooperForThread(thread_id tid)
|
|
||||||
|
BLooper*
|
||||||
|
BLooperList::LooperForThread(thread_id thread)
|
||||||
{
|
{
|
||||||
BAutolock Listlock(fLock);
|
BAutolock Listlock(fLock);
|
||||||
AssertLocked();
|
AssertLocked();
|
||||||
BLooper* looper = NULL;
|
BLooper* looper = NULL;
|
||||||
LDIter i = find_if(fData.begin(), fData.end(), FindThreadPred(tid));
|
LooperDataIterator i = find_if(fData.begin(), fData.end(), FindThreadPred(thread));
|
||||||
if (i != fData.end())
|
if (i != fData.end())
|
||||||
{
|
|
||||||
looper = i->looper;
|
looper = i->looper;
|
||||||
}
|
|
||||||
|
|
||||||
return looper;
|
return looper;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BLooper* BLooperList::LooperForName(const char* name)
|
|
||||||
|
BLooper*
|
||||||
|
BLooperList::LooperForName(const char* name)
|
||||||
{
|
{
|
||||||
BAutolock Listlock(fLock);
|
BAutolock Listlock(fLock);
|
||||||
AssertLocked();
|
AssertLocked();
|
||||||
BLooper* looper = NULL;
|
BLooper* looper = NULL;
|
||||||
LDIter i = find_if(fData.begin(), fData.end(), FindNamePred(name));
|
LooperDataIterator i = find_if(fData.begin(), fData.end(), FindNamePred(name));
|
||||||
if (i != fData.end())
|
if (i != fData.end())
|
||||||
{
|
|
||||||
looper = i->looper;
|
looper = i->looper;
|
||||||
}
|
|
||||||
|
|
||||||
return looper;
|
return looper;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BLooper* BLooperList::LooperForPort(port_id port)
|
|
||||||
|
BLooper*
|
||||||
|
BLooperList::LooperForPort(port_id port)
|
||||||
{
|
{
|
||||||
BAutolock Listlock(fLock);
|
BAutolock Listlock(fLock);
|
||||||
AssertLocked();
|
AssertLocked();
|
||||||
BLooper* looper = NULL;
|
BLooper* looper = NULL;
|
||||||
LDIter i = find_if(fData.begin(), fData.end(), FindPortPred(port));
|
LooperDataIterator i = find_if(fData.begin(), fData.end(), FindPortPred(port));
|
||||||
if (i != fData.end())
|
if (i != fData.end())
|
||||||
{
|
|
||||||
looper = i->looper;
|
looper = i->looper;
|
||||||
}
|
|
||||||
|
|
||||||
return looper;
|
return looper;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BLooperList::EmptySlotPred(LooperData& Data)
|
|
||||||
|
bool
|
||||||
|
BLooperList::EmptySlotPred(LooperData& Data)
|
||||||
{
|
{
|
||||||
return Data.looper == NULL;
|
return Data.looper == NULL;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BLooperList::AssertLocked()
|
|
||||||
|
void
|
||||||
|
BLooperList::AssertLocked()
|
||||||
{
|
{
|
||||||
if (!IsLocked())
|
if (!IsLocked())
|
||||||
{
|
|
||||||
debugger("looperlist is not locked; proceed at great risk!");
|
debugger("looperlist is not locked; proceed at great risk!");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
// #pragma mark - BLooperList::LooperData
|
||||||
// #pragma mark -
|
|
||||||
// #pragma mark BLooperList::LooperData
|
|
||||||
// #pragma mark -
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BLooperList::LooperData::LooperData()
|
BLooperList::LooperData::LooperData()
|
||||||
: looper(NULL), id(0)
|
: looper(NULL), id(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BLooperList::LooperData::LooperData(BLooper* loop, uint32 i)
|
BLooperList::LooperData::LooperData(BLooper* loop, uint32 i)
|
||||||
: looper(loop), id(i)
|
: looper(loop), id(i)
|
||||||
{
|
{
|
||||||
;
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BLooperList::LooperData::LooperData(const LooperData& rhs)
|
|
||||||
|
BLooperList::LooperData::LooperData(const LooperData& other)
|
||||||
{
|
{
|
||||||
*this = rhs;
|
*this = other;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BLooperList::LooperData&
|
BLooperList::LooperData&
|
||||||
BLooperList::LooperData::operator=(const LooperData& rhs)
|
BLooperList::LooperData::operator=(const LooperData& other)
|
||||||
{
|
{
|
||||||
if (this != &rhs)
|
if (this != &other) {
|
||||||
{
|
looper = other.looper;
|
||||||
looper = rhs.looper;
|
id = other.id;
|
||||||
id = rhs.id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
bool
|
||||||
bool BLooperList::FindLooperPred::operator()(BLooperList::LooperData& Data)
|
BLooperList::FindLooperPred::operator()(BLooperList::LooperData& Data)
|
||||||
{
|
{
|
||||||
return Data.looper && (looper == Data.looper);
|
return Data.looper && looper == Data.looper;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BLooperList::FindThreadPred::operator()(LooperData& Data)
|
|
||||||
|
bool
|
||||||
|
BLooperList::FindThreadPred::operator()(LooperData& Data)
|
||||||
{
|
{
|
||||||
return Data.looper && (thread == Data.looper->Thread());
|
return Data.looper && thread == Data.looper->Thread();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BLooperList::FindNamePred::operator()(LooperData& Data)
|
|
||||||
|
bool
|
||||||
|
BLooperList::FindNamePred::operator()(LooperData& Data)
|
||||||
{
|
{
|
||||||
return Data.looper && (strcmp(name, Data.looper->Name()) == 0);
|
return Data.looper && !strcmp(name, Data.looper->Name());
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BLooperList::FindPortPred::operator()(LooperData& Data)
|
|
||||||
|
bool
|
||||||
|
BLooperList::FindPortPred::operator()(LooperData& Data)
|
||||||
{
|
{
|
||||||
return Data.looper && (port == _get_looper_port_(Data.looper));
|
return Data.looper && port == _get_looper_port_(Data.looper);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
/*
|
|
||||||
* $Log $
|
|
||||||
*
|
|
||||||
* $Id $
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,63 +1,49 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Erik Jaesler ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: MessageFilter.cpp
|
|
||||||
// Author: Erik Jaesler ([email protected])
|
|
||||||
// Description: BMessageFilter class creates objects that filter
|
|
||||||
// in-coming BMessages.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include <MessageFilter.h>
|
#include <MessageFilter.h>
|
||||||
|
|
||||||
|
|
||||||
BMessageFilter::BMessageFilter(uint32 inWhat, filter_hook func)
|
BMessageFilter::BMessageFilter(uint32 inWhat, filter_hook func)
|
||||||
: fFiltersAny(false),
|
:
|
||||||
what(inWhat),
|
fFiltersAny(false),
|
||||||
fDelivery(B_ANY_DELIVERY),
|
fWhat(inWhat),
|
||||||
fSource(B_ANY_SOURCE),
|
fDelivery(B_ANY_DELIVERY),
|
||||||
fLooper(NULL),
|
fSource(B_ANY_SOURCE),
|
||||||
fFilterFunction(func)
|
fLooper(NULL),
|
||||||
|
fFilterFunction(func)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BMessageFilter::BMessageFilter(message_delivery delivery, message_source source,
|
BMessageFilter::BMessageFilter(message_delivery delivery,
|
||||||
filter_hook func)
|
message_source source, filter_hook func)
|
||||||
: fFiltersAny(true),
|
:
|
||||||
what(0),
|
fFiltersAny(true),
|
||||||
fDelivery(delivery),
|
fWhat(0),
|
||||||
fSource(source),
|
fDelivery(delivery),
|
||||||
fLooper(NULL),
|
fSource(source),
|
||||||
fFilterFunction(func)
|
fLooper(NULL),
|
||||||
|
fFilterFunction(func)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BMessageFilter::BMessageFilter(message_delivery delivery, message_source source,
|
BMessageFilter::BMessageFilter(message_delivery delivery,
|
||||||
uint32 inWhat, filter_hook func)
|
message_source source, uint32 inWhat, filter_hook func)
|
||||||
: fFiltersAny(false),
|
:
|
||||||
what(inWhat),
|
fFiltersAny(false),
|
||||||
fDelivery(delivery),
|
fWhat(inWhat),
|
||||||
fSource(source),
|
fDelivery(delivery),
|
||||||
fLooper(NULL),
|
fSource(source),
|
||||||
fFilterFunction(func)
|
fLooper(NULL),
|
||||||
|
fFilterFunction(func)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +69,7 @@ BMessageFilter &
|
|||||||
BMessageFilter::operator=(const BMessageFilter& from)
|
BMessageFilter::operator=(const BMessageFilter& from)
|
||||||
{
|
{
|
||||||
fFiltersAny = from.FiltersAnyCommand();
|
fFiltersAny = from.FiltersAnyCommand();
|
||||||
what = from.Command();
|
fWhat = from.Command();
|
||||||
fDelivery = from.MessageDelivery();
|
fDelivery = from.MessageDelivery();
|
||||||
fSource = from.MessageSource();
|
fSource = from.MessageSource();
|
||||||
fFilterFunction = from.FilterFunction();
|
fFilterFunction = from.FilterFunction();
|
||||||
@@ -118,7 +104,7 @@ BMessageFilter::MessageSource() const
|
|||||||
uint32
|
uint32
|
||||||
BMessageFilter::Command() const
|
BMessageFilter::Command() const
|
||||||
{
|
{
|
||||||
return what;
|
return fWhat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,12 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Ingo Weinhold ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: MessageRunner.cpp
|
|
||||||
// Author: Ingo Weinhold ([email protected])
|
|
||||||
// Description: A BMessageRunner periodically sends a message to a
|
|
||||||
// specified target.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <AppMisc.h>
|
#include <AppMisc.h>
|
||||||
#include <MessageRunner.h>
|
#include <MessageRunner.h>
|
||||||
@@ -33,6 +16,7 @@
|
|||||||
|
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
/*! \brief Creates and initializes a new BMessageRunner.
|
/*! \brief Creates and initializes a new BMessageRunner.
|
||||||
|
|
||||||
|
|||||||
+22
-47
@@ -1,40 +1,21 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2005, Haiku
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Ingo Weinhold ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: Messenger.h
|
|
||||||
// Author: Ingo Weinhold ([email protected])
|
|
||||||
// Description: BMessenger delivers messages to local or remote targets.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// debugging
|
|
||||||
//#define DBG(x) x
|
|
||||||
#define DBG(x)
|
|
||||||
#define OUT printf
|
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
#include <AppMisc.h>
|
||||||
#include <new>
|
#include <MessageUtils.h>
|
||||||
#include <stdio.h>
|
#include "ObjectLocker.h"
|
||||||
#include <string.h>
|
#include "TokenSpace.h"
|
||||||
|
|
||||||
|
#ifdef USING_MESSAGE4
|
||||||
|
# include <MessagePrivate.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Handler.h>
|
#include <Handler.h>
|
||||||
#include <Looper.h>
|
#include <Looper.h>
|
||||||
@@ -45,21 +26,15 @@
|
|||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <TokenSpace.h>
|
#include <TokenSpace.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
#include <new>
|
||||||
#include <AppMisc.h>
|
#include <stdio.h>
|
||||||
#include <MessageUtils.h>
|
#include <string.h>
|
||||||
#include "ObjectLocker.h"
|
|
||||||
#include "TokenSpace.h"
|
|
||||||
|
|
||||||
#ifdef USING_MESSAGE4
|
|
||||||
#include <MessagePrivate.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Local Includes --------------------------------------------------------------
|
// debugging
|
||||||
|
//#define DBG(x) x
|
||||||
// Local Defines ---------------------------------------------------------------
|
#define DBG(x)
|
||||||
|
#define OUT printf
|
||||||
// Globals ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
using BPrivate::gDefaultTokens;
|
using BPrivate::gDefaultTokens;
|
||||||
using BPrivate::gLooperList;
|
using BPrivate::gLooperList;
|
||||||
|
|||||||
+144
-161
@@ -1,116 +1,94 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Marc Flerackers ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: PropertyInfo.h
|
|
||||||
// Author: Marc Flerackers ([email protected])
|
|
||||||
// Description: Utility class for maintain scripting information.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <PropertyInfo.h>
|
|
||||||
#include <Message.h>
|
|
||||||
#include <Errors.h>
|
|
||||||
#include <ByteOrder.h>
|
#include <ByteOrder.h>
|
||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
|
#include <Message.h>
|
||||||
|
#include <PropertyInfo.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Includes --------------------------------------------------------------
|
BPropertyInfo::BPropertyInfo(property_info* propertyInfo, value_info* valueInfo,
|
||||||
|
bool freeOnDelete)
|
||||||
// Local Defines ---------------------------------------------------------------
|
:
|
||||||
|
fPropInfo(propertyInfo),
|
||||||
// Globals ---------------------------------------------------------------------
|
fValueInfo(valueInfo),
|
||||||
|
fPropCount(0),
|
||||||
//------------------------------------------------------------------------------
|
fInHeap(freeOnDelete),
|
||||||
BPropertyInfo::BPropertyInfo(property_info *p, value_info *ci,
|
fValueCount(0)
|
||||||
bool free_on_delete)
|
|
||||||
: fPropInfo(p),
|
|
||||||
fValueInfo(ci),
|
|
||||||
fPropCount(0),
|
|
||||||
fInHeap(free_on_delete),
|
|
||||||
fValueCount(0)
|
|
||||||
{
|
{
|
||||||
if (fPropInfo)
|
if (fPropInfo != NULL) {
|
||||||
{
|
|
||||||
while (fPropInfo[fPropCount].name)
|
while (fPropInfo[fPropCount].name)
|
||||||
fPropCount++;
|
fPropCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fValueInfo)
|
if (fValueInfo != NULL) {
|
||||||
{
|
|
||||||
while (fValueInfo[fValueCount].name)
|
while (fValueInfo[fValueCount].name)
|
||||||
fValueCount++;
|
fValueCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BPropertyInfo::~BPropertyInfo()
|
BPropertyInfo::~BPropertyInfo()
|
||||||
{
|
{
|
||||||
FreeMem();
|
FreeMem();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
int32 BPropertyInfo::FindMatch(BMessage *msg, int32 index, BMessage *spec,
|
|
||||||
int32 form, const char *prop, void *data) const
|
int32 BPropertyInfo::FindMatch(BMessage* message, int32 index,
|
||||||
|
BMessage* specifier, int32 form, const char* property, void* data) const
|
||||||
{
|
{
|
||||||
int32 property_index = 0;
|
int32 propertyIndex = 0;
|
||||||
|
|
||||||
while ((fPropInfo != NULL) && (fPropInfo[property_index].name)) {
|
while (fPropInfo != NULL && fPropInfo[propertyIndex].name != NULL) {
|
||||||
property_info *propInfo = fPropInfo + property_index;
|
property_info* propertyInfo = fPropInfo + propertyIndex;
|
||||||
|
|
||||||
if ((strcmp(propInfo->name, prop) == 0) &&
|
if (!strcmp(propertyInfo->name, property)
|
||||||
(FindCommand(msg->what, index, propInfo)) &&
|
&& FindCommand(message->what, index, propertyInfo)
|
||||||
(FindSpecifier(form, propInfo))) {
|
&& FindSpecifier(form, propertyInfo)) {
|
||||||
if (data)
|
if (data)
|
||||||
*((uint32*)data) = propInfo->extra_data;
|
*((uint32*)data) = propertyInfo->extra_data;
|
||||||
return property_index;
|
|
||||||
|
return propertyIndex;
|
||||||
}
|
}
|
||||||
property_index++;
|
propertyIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BPropertyInfo::IsFixedSize() const
|
|
||||||
|
bool
|
||||||
|
BPropertyInfo::IsFixedSize() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
type_code BPropertyInfo::TypeCode() const
|
|
||||||
|
type_code
|
||||||
|
BPropertyInfo::TypeCode() const
|
||||||
{
|
{
|
||||||
return B_PROPERTY_INFO_TYPE;
|
return B_PROPERTY_INFO_TYPE;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
ssize_t BPropertyInfo::FlattenedSize() const
|
|
||||||
|
ssize_t
|
||||||
|
BPropertyInfo::FlattenedSize() const
|
||||||
{
|
{
|
||||||
size_t size = (2 * sizeof(int32)) + 1;
|
size_t size = (2 * sizeof(int32)) + 1;
|
||||||
|
|
||||||
if (fPropInfo)
|
if (fPropInfo) {
|
||||||
{
|
|
||||||
// Main chunks
|
// Main chunks
|
||||||
for (int32 pi = 0; fPropInfo[pi].name != NULL; pi++)
|
for (int32 pi = 0; fPropInfo[pi].name != NULL; pi++) {
|
||||||
{
|
|
||||||
size += strlen(fPropInfo[pi].name) + 1;
|
size += strlen(fPropInfo[pi].name) + 1;
|
||||||
|
|
||||||
if (fPropInfo[pi].usage)
|
if (fPropInfo[pi].usage)
|
||||||
@@ -130,16 +108,13 @@ ssize_t BPropertyInfo::FlattenedSize() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Type chunks
|
// Type chunks
|
||||||
for (int32 pi = 0; fPropInfo[pi].name != NULL; pi++)
|
for (int32 pi = 0; fPropInfo[pi].name != NULL; pi++) {
|
||||||
{
|
|
||||||
for (int32 i = 0; i < 10 && fPropInfo[pi].types[i] != 0; i++)
|
for (int32 i = 0; i < 10 && fPropInfo[pi].types[i] != 0; i++)
|
||||||
size += sizeof(int32);
|
size += sizeof(int32);
|
||||||
size += sizeof(int32);
|
size += sizeof(int32);
|
||||||
|
|
||||||
for (int32 i = 0; i < 3 && fPropInfo[pi].ctypes[i].pairs[0].name != 0; i++)
|
for (int32 i = 0; i < 3 && fPropInfo[pi].ctypes[i].pairs[0].name != 0; i++) {
|
||||||
{
|
for (int32 j = 0; j < 5 && fPropInfo[pi].ctypes[i].pairs[j].name != 0; j++) {
|
||||||
for (int32 j = 0; j < 5 && fPropInfo[pi].ctypes[i].pairs[j].name != 0; j++)
|
|
||||||
{
|
|
||||||
size += strlen(fPropInfo[pi].ctypes[i].pairs[j].name) + 1;
|
size += strlen(fPropInfo[pi].ctypes[i].pairs[j].name) + 1;
|
||||||
size += sizeof(int32);
|
size += sizeof(int32);
|
||||||
}
|
}
|
||||||
@@ -149,13 +124,11 @@ ssize_t BPropertyInfo::FlattenedSize() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fValueInfo)
|
if (fValueInfo) {
|
||||||
{
|
|
||||||
size += sizeof(int16);
|
size += sizeof(int16);
|
||||||
|
|
||||||
// Chunks
|
// Chunks
|
||||||
for (int32 vi = 0; fValueInfo[vi].name != NULL; vi++)
|
for (int32 vi = 0; fValueInfo[vi].name != NULL; vi++) {
|
||||||
{
|
|
||||||
size += sizeof(int32);
|
size += sizeof(int32);
|
||||||
size += sizeof(int32);
|
size += sizeof(int32);
|
||||||
|
|
||||||
@@ -172,8 +145,10 @@ ssize_t BPropertyInfo::FlattenedSize() const
|
|||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BPropertyInfo::Flatten(void *buffer, ssize_t numBytes) const
|
|
||||||
|
status_t
|
||||||
|
BPropertyInfo::Flatten(void* buffer, ssize_t numBytes) const
|
||||||
{
|
{
|
||||||
if (numBytes < FlattenedSize())
|
if (numBytes < FlattenedSize())
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
@@ -191,13 +166,13 @@ status_t BPropertyInfo::Flatten(void *buffer, ssize_t numBytes) const
|
|||||||
tmpInt = 0x01 | (fValueInfo ? 0x2 : 0x0);
|
tmpInt = 0x01 | (fValueInfo ? 0x2 : 0x0);
|
||||||
flatData.Write(&tmpInt, sizeof(tmpInt));
|
flatData.Write(&tmpInt, sizeof(tmpInt));
|
||||||
|
|
||||||
if (fPropInfo) { // Main chunks
|
if (fPropInfo) {
|
||||||
|
// Main chunks
|
||||||
for (int32 pi = 0; fPropInfo[pi].name != NULL; pi++) {
|
for (int32 pi = 0; fPropInfo[pi].name != NULL; pi++) {
|
||||||
flatData.Write(fPropInfo[pi].name, strlen(fPropInfo[pi].name) + 1);
|
flatData.Write(fPropInfo[pi].name, strlen(fPropInfo[pi].name) + 1);
|
||||||
if (fPropInfo[pi].usage != NULL) {
|
if (fPropInfo[pi].usage != NULL) {
|
||||||
flatData.Write(fPropInfo[pi].usage, strlen(fPropInfo[pi].usage) + 1);
|
flatData.Write(fPropInfo[pi].usage, strlen(fPropInfo[pi].usage) + 1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
tmpChar = 0;
|
tmpChar = 0;
|
||||||
flatData.Write(&tmpChar, sizeof(tmpChar));
|
flatData.Write(&tmpChar, sizeof(tmpChar));
|
||||||
}
|
}
|
||||||
@@ -228,9 +203,9 @@ status_t BPropertyInfo::Flatten(void *buffer, ssize_t numBytes) const
|
|||||||
for (int32 i = 0; i < 3 && fPropInfo[pi].ctypes[i].pairs[0].name != 0; i++) {
|
for (int32 i = 0; i < 3 && fPropInfo[pi].ctypes[i].pairs[0].name != 0; i++) {
|
||||||
for (int32 j = 0; j < 5 && fPropInfo[pi].ctypes[i].pairs[j].name != 0; j++) {
|
for (int32 j = 0; j < 5 && fPropInfo[pi].ctypes[i].pairs[j].name != 0; j++) {
|
||||||
flatData.Write(fPropInfo[pi].ctypes[i].pairs[j].name,
|
flatData.Write(fPropInfo[pi].ctypes[i].pairs[j].name,
|
||||||
strlen(fPropInfo[pi].ctypes[i].pairs[j].name) + 1);
|
strlen(fPropInfo[pi].ctypes[i].pairs[j].name) + 1);
|
||||||
flatData.Write(&fPropInfo[pi].ctypes[i].pairs[j].type,
|
flatData.Write(&fPropInfo[pi].ctypes[i].pairs[j].type,
|
||||||
sizeof(fPropInfo[pi].ctypes[i].pairs[j].type));
|
sizeof(fPropInfo[pi].ctypes[i].pairs[j].type));
|
||||||
}
|
}
|
||||||
tmpInt = 0;
|
tmpInt = 0;
|
||||||
flatData.Write(&tmpInt, sizeof(tmpInt));
|
flatData.Write(&tmpInt, sizeof(tmpInt));
|
||||||
@@ -249,8 +224,7 @@ status_t BPropertyInfo::Flatten(void *buffer, ssize_t numBytes) const
|
|||||||
flatData.Write(fValueInfo[vi].name, strlen(fValueInfo[vi].name) + 1);
|
flatData.Write(fValueInfo[vi].name, strlen(fValueInfo[vi].name) + 1);
|
||||||
if (fValueInfo[vi].usage) {
|
if (fValueInfo[vi].usage) {
|
||||||
flatData.Write(fValueInfo[vi].usage, strlen(fValueInfo[vi].usage) + 1);
|
flatData.Write(fValueInfo[vi].usage, strlen(fValueInfo[vi].usage) + 1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
tmpChar = 0;
|
tmpChar = 0;
|
||||||
flatData.Write(&tmpChar, sizeof(tmpChar));
|
flatData.Write(&tmpChar, sizeof(tmpChar));
|
||||||
}
|
}
|
||||||
@@ -260,14 +234,18 @@ status_t BPropertyInfo::Flatten(void *buffer, ssize_t numBytes) const
|
|||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BPropertyInfo::AllowsTypeCode(type_code code) const
|
|
||||||
|
bool
|
||||||
|
BPropertyInfo::AllowsTypeCode(type_code code) const
|
||||||
{
|
{
|
||||||
return (code == B_PROPERTY_INFO_TYPE);
|
return code == B_PROPERTY_INFO_TYPE;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BPropertyInfo::Unflatten(type_code code, const void *buffer,
|
|
||||||
ssize_t numBytes)
|
status_t
|
||||||
|
BPropertyInfo::Unflatten(type_code code, const void* buffer,
|
||||||
|
ssize_t numBytes)
|
||||||
{
|
{
|
||||||
if (!AllowsTypeCode(code))
|
if (!AllowsTypeCode(code))
|
||||||
return B_BAD_TYPE;
|
return B_BAD_TYPE;
|
||||||
@@ -345,14 +323,14 @@ status_t BPropertyInfo::Unflatten(type_code code, const void *buffer,
|
|||||||
for (int32 j = 0; tmpInt != 0; j++) {
|
for (int32 j = 0; tmpInt != 0; j++) {
|
||||||
flatData.Seek(-sizeof(tmpInt), SEEK_CUR);
|
flatData.Seek(-sizeof(tmpInt), SEEK_CUR);
|
||||||
fPropInfo[pi].ctypes[i].pairs[j].name =
|
fPropInfo[pi].ctypes[i].pairs[j].name =
|
||||||
strdup(static_cast<const char *>(buffer) + flatData.Position());
|
strdup(static_cast<const char *>(buffer) + flatData.Position());
|
||||||
flatData.Seek(strlen(fPropInfo[pi].ctypes[i].pairs[j].name) + 1, SEEK_CUR);
|
flatData.Seek(strlen(fPropInfo[pi].ctypes[i].pairs[j].name) + 1, SEEK_CUR);
|
||||||
|
|
||||||
flatData.Read(&fPropInfo[pi].ctypes[i].pairs[j].type,
|
flatData.Read(&fPropInfo[pi].ctypes[i].pairs[j].type,
|
||||||
sizeof(fPropInfo[pi].ctypes[i].pairs[j].type));
|
sizeof(fPropInfo[pi].ctypes[i].pairs[j].type));
|
||||||
if (swapRequired) {
|
if (swapRequired) {
|
||||||
fPropInfo[pi].ctypes[i].pairs[j].type =
|
fPropInfo[pi].ctypes[i].pairs[j].type =
|
||||||
B_SWAP_INT32(fPropInfo[pi].ctypes[i].pairs[j].type);
|
B_SWAP_INT32(fPropInfo[pi].ctypes[i].pairs[j].type);
|
||||||
}
|
}
|
||||||
flatData.Read(&tmpInt, sizeof(tmpInt));
|
flatData.Read(&tmpInt, sizeof(tmpInt));
|
||||||
}
|
}
|
||||||
@@ -370,8 +348,7 @@ status_t BPropertyInfo::Unflatten(type_code code, const void *buffer,
|
|||||||
fValueInfo = static_cast<value_info *>(malloc(sizeof(value_info) * (fValueCount + 1)));
|
fValueInfo = static_cast<value_info *>(malloc(sizeof(value_info) * (fValueCount + 1)));
|
||||||
memset(fValueInfo, 0, (fValueCount + 1) * sizeof(value_info));
|
memset(fValueInfo, 0, (fValueCount + 1) * sizeof(value_info));
|
||||||
|
|
||||||
for (int32 vi = 0; vi < fValueCount; vi++)
|
for (int32 vi = 0; vi < fValueCount; vi++) {
|
||||||
{
|
|
||||||
flatData.Read(&fValueInfo[vi].kind, sizeof(fValueInfo[vi].kind));
|
flatData.Read(&fValueInfo[vi].kind, sizeof(fValueInfo[vi].kind));
|
||||||
flatData.Read(&fValueInfo[vi].value, sizeof(fValueInfo[vi].value));
|
flatData.Read(&fValueInfo[vi].value, sizeof(fValueInfo[vi].value));
|
||||||
|
|
||||||
@@ -392,28 +369,38 @@ status_t BPropertyInfo::Unflatten(type_code code, const void *buffer,
|
|||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
const property_info *BPropertyInfo::Properties() const
|
|
||||||
|
const property_info*
|
||||||
|
BPropertyInfo::Properties() const
|
||||||
{
|
{
|
||||||
return fPropInfo;
|
return fPropInfo;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
const value_info *BPropertyInfo::Values() const
|
|
||||||
|
const value_info*
|
||||||
|
BPropertyInfo::Values() const
|
||||||
{
|
{
|
||||||
return fValueInfo;
|
return fValueInfo;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
int32 BPropertyInfo::CountProperties() const
|
|
||||||
|
int32
|
||||||
|
BPropertyInfo::CountProperties() const
|
||||||
{
|
{
|
||||||
return fPropCount;
|
return fPropCount;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
int32 BPropertyInfo::CountValues() const
|
|
||||||
|
int32
|
||||||
|
BPropertyInfo::CountValues() const
|
||||||
{
|
{
|
||||||
return fValueCount;
|
return fValueCount;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BPropertyInfo::PrintToStream() const
|
|
||||||
|
void
|
||||||
|
BPropertyInfo::PrintToStream() const
|
||||||
{
|
{
|
||||||
printf(" property commands types specifiers\n");
|
printf(" property commands types specifiers\n");
|
||||||
printf("--------------------------------------------------------------------------------\n");
|
printf("--------------------------------------------------------------------------------\n");
|
||||||
@@ -444,82 +431,89 @@ void BPropertyInfo::PrintToStream() const
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BPropertyInfo::FindCommand(uint32 what, int32 index, property_info *p)
|
|
||||||
|
bool
|
||||||
|
BPropertyInfo::FindCommand(uint32 what, int32 index, property_info *propertyInfo)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (p->commands[0] == 0) {
|
if (propertyInfo->commands[0] == 0) {
|
||||||
result = true;
|
result = true;
|
||||||
} else if (index == 0) {
|
} else if (index == 0) {
|
||||||
for (int32 i = 0; i < 10 && p->commands[i] != 0; i++) {
|
for (int32 i = 0; i < 10 && propertyInfo->commands[i] != 0; i++) {
|
||||||
if (p->commands[i] == what) {
|
if (propertyInfo->commands[i] == what) {
|
||||||
result = true;
|
result = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(result);
|
return result;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BPropertyInfo::FindSpecifier(uint32 form, property_info *p)
|
|
||||||
|
bool
|
||||||
|
BPropertyInfo::FindSpecifier(uint32 form, property_info *propertyInfo)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (p->specifiers[0] == 0) {
|
if (propertyInfo->specifiers[0] == 0) {
|
||||||
result = true;
|
result = true;
|
||||||
} else {
|
} else {
|
||||||
for (int32 i = 0; i < 10 && p->specifiers[i] != 0; i++) {
|
for (int32 i = 0; i < 10 && propertyInfo->specifiers[i] != 0; i++) {
|
||||||
if (p->specifiers[i] == form) {
|
if (propertyInfo->specifiers[i] == form) {
|
||||||
result = true;
|
result = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(result);
|
return result;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void BPropertyInfo::_ReservedPropertyInfo1() {}
|
void BPropertyInfo::_ReservedPropertyInfo1() {}
|
||||||
void BPropertyInfo::_ReservedPropertyInfo2() {}
|
void BPropertyInfo::_ReservedPropertyInfo2() {}
|
||||||
void BPropertyInfo::_ReservedPropertyInfo3() {}
|
void BPropertyInfo::_ReservedPropertyInfo3() {}
|
||||||
void BPropertyInfo::_ReservedPropertyInfo4() {}
|
void BPropertyInfo::_ReservedPropertyInfo4() {}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BPropertyInfo::BPropertyInfo(const BPropertyInfo &)
|
BPropertyInfo::BPropertyInfo(const BPropertyInfo &)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BPropertyInfo &BPropertyInfo::operator=(const BPropertyInfo &)
|
|
||||||
|
BPropertyInfo&
|
||||||
|
BPropertyInfo::operator=(const BPropertyInfo &)
|
||||||
{
|
{
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BPropertyInfo::FreeMem()
|
|
||||||
|
void
|
||||||
|
BPropertyInfo::FreeMem()
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
if (!fInHeap) {
|
if (!fInHeap)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (fPropInfo != NULL) {
|
if (fPropInfo != NULL) {
|
||||||
for(i = 0; i < fPropCount; i++) {
|
for (i = 0; i < fPropCount; i++) {
|
||||||
if (fPropInfo[i].name != NULL) {
|
free(fPropInfo[i].name);
|
||||||
free(fPropInfo[i].name);
|
free(fPropInfo[i].usage);
|
||||||
}
|
|
||||||
if (fPropInfo[i].usage != NULL) {
|
for (j = 0; j < 3; j++) {
|
||||||
free(fPropInfo[i].usage);
|
for (k = 0; k < 5; k++) {
|
||||||
}
|
if (fPropInfo[i].ctypes[j].pairs[k].name == NULL)
|
||||||
for(j = 0; j < 3; j++) {
|
|
||||||
for(k = 0; k < 5; k++) {
|
|
||||||
if (fPropInfo[i].ctypes[j].pairs[k].name == NULL) {
|
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
free(fPropInfo[i].ctypes[j].pairs[k].name);
|
free(fPropInfo[i].ctypes[j].pairs[k].name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (fPropInfo[i].ctypes[j].pairs[0].name == NULL) {
|
|
||||||
|
if (fPropInfo[i].ctypes[j].pairs[0].name == NULL)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(fPropInfo);
|
free(fPropInfo);
|
||||||
@@ -528,13 +522,9 @@ void BPropertyInfo::FreeMem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fValueInfo != NULL) {
|
if (fValueInfo != NULL) {
|
||||||
for(i = 0; i < fValueCount; i++) {
|
for (i = 0; i < fValueCount; i++) {
|
||||||
if (fValueInfo[i].name != NULL) {
|
free(fValueInfo[i].name);
|
||||||
free(fValueInfo[i].name);
|
free(fValueInfo[i].usage);
|
||||||
}
|
|
||||||
if (fValueInfo[i].usage != NULL) {
|
|
||||||
free(fValueInfo[i].usage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
free(fValueInfo);
|
free(fValueInfo);
|
||||||
fValueInfo = NULL;
|
fValueInfo = NULL;
|
||||||
@@ -543,11 +533,4 @@ void BPropertyInfo::FreeMem()
|
|||||||
|
|
||||||
fInHeap = false;
|
fInHeap = false;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
* $Log $
|
|
||||||
*
|
|
||||||
* $Id $
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|||||||
@@ -1,32 +1,18 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Ingo Weinhold ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
//! API classes - registrar interface.
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: RegistrarDefs.cpp
|
|
||||||
// Author(s): Ingo Weinhold ([email protected])
|
|
||||||
// Description: API classes - registrar interface.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include <AppMisc.h>
|
#include <AppMisc.h>
|
||||||
#include <RegistrarDefs.h>
|
#include <RegistrarDefs.h>
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
// names
|
// names
|
||||||
|
|||||||
@@ -1,34 +1,18 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Ingo Weinhold ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
//! Base thread class for threads spawned and managed by the registrar
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: RegistrarThread.cpp
|
|
||||||
// Author(s): Ingo Weinhold ([email protected])
|
|
||||||
//
|
|
||||||
// Description: Base thread class for threads spawned and managed by the registrar
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
#include "RegistrarThread.h"
|
#include "RegistrarThread.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
/*! \class RegistrarThread
|
/*! \class RegistrarThread
|
||||||
\brief Base thread class for threads spawned and managed by the registrar
|
\brief Base thread class for threads spawned and managed by the registrar
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
//----------------------------------------------------------------------
|
/*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Copyright 2001-2005, Haiku.
|
||||||
// by the OpenBeOS license.
|
* Distributed under the terms of the MIT License.
|
||||||
//---------------------------------------------------------------------
|
*
|
||||||
/*!
|
* Authors:
|
||||||
\file RegistrarThreadManager.cpp
|
* Tyler Dauwalder
|
||||||
RegistrarThreadManager implementation
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
#include "RegistrarThreadManager.h"
|
#include "RegistrarThreadManager.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,13 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Ingo Weinhold ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
//! Access class for BRoster members
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: RosterPrivate.cpp
|
|
||||||
// Author(s): Ingo Weinhold ([email protected])
|
|
||||||
// Description: Access class for BRoster members
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include <RosterPrivate.h>
|
#include <RosterPrivate.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
|||||||
@@ -85,10 +85,9 @@ BTokenSpace::RemoveToken(int32 token, remove_token_callback callback)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Checks wether or not the \a token exists with the specified
|
/*! Checks wether or not the \a token exists with the specified
|
||||||
* \a type in the token space or not.
|
\a type in the token space or not.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BTokenSpace::CheckToken(int32 token, int16 type) const
|
BTokenSpace::CheckToken(int32 token, int16 type) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,29 +1,12 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2005, Haiku
|
* Copyright 2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Michael Lotz <[email protected]>
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
//! These type constants are exported by libbe under R5.
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: TypeConstants.cpp
|
|
||||||
// Description: These type constants are exported by libbe under R5.
|
|
||||||
// We need them for binary compatibility.
|
|
||||||
// See <TypeConstants.h>.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
const char *B_URL_HTTP = "application/x-vnd.Be.URL.http";
|
const char *B_URL_HTTP = "application/x-vnd.Be.URL.http";
|
||||||
const char *B_URL_HTTPS = "application/x-vnd.Be.URL.https";
|
const char *B_URL_HTTPS = "application/x-vnd.Be.URL.https";
|
||||||
|
|||||||
Reference in New Issue
Block a user