Pyro higlevel API
|
Class to access the registrar server. More...
Classes | |
class | Private |
Public Member Functions | |
RegistrarManager () | |
Constructor. More... | |
~RegistrarManager () | |
Destructor. More... | |
void | AddRef () |
void | Put (bool bAll=false) |
Decrements the reference counter of the instance. More... | |
void | HandleMessage (Message *pcMessage) |
Handle a message targeted at this handler. More... | |
void | SetSynchronousMode (bool bSync) |
Sets whether the registrar manager class is in synchronous mode. More... | |
status_t | RegisterType (String zMimeType, String zIdentifier, bool bOverwrite=false) |
Registers a new filetype. More... | |
status_t | UnregisterType (String zMimeType) |
Unregisters a filetype. More... | |
status_t | RegisterTypeIcon (String zMimeType, Path cIcon, bool bOverwrite=false) |
Sets a new icon for a filetype. More... | |
status_t | RegisterTypeIconFromRes (String zMimeType, String zIconRes, bool bOverwrite=false) |
Sets a new icon for a filetype which will be extracted from the application resources. More... | |
status_t | RegisterTypeExtension (String zMimeType, String zExtension) |
Registers a new extension for a type. More... | |
status_t | ClearTypeExtensions (String zMimeType) |
Clears the extension list for a type. More... | |
status_t | RegisterTypeHandler (String zMimeType, Path cHandler) |
Registers a new handler for a type. More... | |
status_t | RegisterAsTypeHandler (String zMimeType) |
Registers the current application as a handler for a type. More... | |
status_t | ClearTypeHandlers (String zMimeType) |
Clears the handler list for a type. More... | |
int32 | GetTypeCount () |
Returns the number of types that are registered for the calling user. More... | |
RegistrarFileType | GetType (int32 nIndex) |
Returns a RegistrarFileType object that describes a specific type. More... | |
status_t | SetDefaultHandler (String zMimeType, Path zHandler) |
Sets the default handler for a type. More... | |
status_t | GetTypeAndIcon (String zFile, Point cIconSize, String *zTypeName, Image **pcIcon, Message *pcMessage=NULL) |
Returns a description and an image for a file. More... | |
status_t | Launch (Window *pcParentWindow, String zFile, bool bVerbose=false, String zTitle="Select handler", bool bDefaultHandler=true) |
Launches a file. More... | |
void | UpdateAppList (bool bForce=false) |
Update the application list. More... | |
RegistrarAppList | GetAppList () |
Returns the application list. More... | |
Public Member Functions inherited from os::Looper | |
Looper (const String &cName, int nPriority=NORMAL_PRIORITY, int nPortSize=DEFAULT_PORT_SIZE) | |
The looper constructor. More... | |
virtual | ~Looper () |
Looper destructor. More... | |
void | SetName (const String &cName) |
Rename the looper. More... | |
String | GetName () const |
Get the loopers name. More... | |
bool | IsPublic () const |
See if the looper's message port is public. More... | |
void | SetPublic (bool bPublic) |
Make port public/private. More... | |
port_id | GetMsgPort () const |
Obtain the low-level message port used by this looper. More... | |
thread_id | GetThread () const |
Obtain the thread id of the looper thread. More... | |
proc_id | GetProcess () const |
Obtain the process ID of the loopers thread. More... | |
status_t | Lock () |
Lock the looper object. More... | |
status_t | Lock (bigtime_t nTimeout) |
Lock the looper with a timeout. More... | |
status_t | SafeLock () |
Attempt to lock the looper. More... | |
status_t | Unlock () |
Unlock the looper. More... | |
void | SetMutex (Locker *pcMutex) |
Set a custom mutex to be used by the looper. More... | |
Locker * | GetMutex () const |
Get a pointer to the loopers mutex. More... | |
int | GetLockCount () const |
Obtain the number of locks held on the looper. More... | |
thread_id | GetLockingThread () const |
Obtaing the owner of the looper lock. More... | |
bool | IsLocked () const |
Check if the looper lock is owned by the calling thread. More... | |
virtual thread_id | Run () |
Start and unlock the looper. More... | |
int | Wait () const |
Wait for the looper thread to die. More... | |
status_t | PostMessage (uint32 nCode) |
Deliver a message to the looper. More... | |
status_t | PostMessage (Message *pcMsg) |
Deliver a message to the looper. More... | |
status_t | PostMessage (uint32 cCode, Handler *pcHandler, Handler *pcReplyTo=NULL) |
Deliver a message to the looper. More... | |
status_t | PostMessage (Message *pcMsg, Handler *pcHandler, Handler *pcReplyTo=NULL) |
Deliver a message to the looper. More... | |
void | SpoolMessages () |
Drain the low-level message port. More... | |
Message * | GetCurrentMessage () const |
Obtain the message currently being processed. More... | |
Message * | DetachCurrentMessage () |
Steal the current message. More... | |
virtual void | DispatchMessage (Message *pcMessage, Handler *pcHandler) |
The loopers message handling callback. More... | |
virtual void | Started () |
Called by the looper thread before entering the message loop. More... | |
virtual bool | Idle () |
Hook called each time the message queue is drained. More... | |
MessageQueue * | GetMessageQueue () const |
Obtain the internal message queue used by the looper. More... | |
virtual bool | OkToQuit () |
Check if it is ok to break the loop. More... | |
virtual void | Quit () |
Unconditionally terminate the looper. More... | |
void | Terminate () |
Unconditionally terminate the looper. More... | |
void | AddTimer (Handler *pcTarget, int nID, bigtime_t nTimeout, bool bOneShot=true) |
Add a timer to the looper. More... | |
bool | RemoveTimer (Handler *pcTarget, int nID) |
Delete a timer. More... | |
const handler_map & | GetHandlerMap () const |
Get the internal handler list. More... | |
void | AddHandler (Handler *pcHandler) |
Add a handler to the looper. More... | |
bool | RemoveHandler (Handler *pcHandler) |
Remove a handler previously added by AddHandler() More... | |
Handler * | FindHandler (const String &cName) const |
Search the looper for a named handler. More... | |
int | GetHandlerCount () const |
Obtain the count of handlers added to this looper. More... | |
void | SetDefaultHandler (Handler *pcHandler) |
Set the default target for incomming messages. More... | |
Handler * | GetDefaultHandler () const |
Obtain the default handler for the looper. More... | |
void | AddCommonFilter (MessageFilter *pcFilter) |
void | RemoveCommonFilter (MessageFilter *pcFilter) |
const MsgFilterList & | GetCommonFilterList () const |
Public Member Functions inherited from os::Handler | |
Handler (const String &cName) | |
Construct a handler. More... | |
virtual | ~Handler () |
Destructor. More... | |
virtual void | TimerTick (int nID) |
Timer dispatch member. More... | |
String | GetName () const |
Get the handlers name. More... | |
void | SetName (const String &cName) |
Rename the handler. More... | |
Looper * | GetLooper () const |
Get a pointer to the looper this handler belongs to. More... | |
void | SetNextHandler (Handler *pcNextHandler) |
Set a handler that should handle messages this handler is not interrested in. More... | |
Handler * | GetNextHandler () const |
Get the next handler in a handler chain. More... | |
void | AddFilter (MessageFilter *pcFilter) |
void | RemoveFilter (MessageFilter *pcFilter) |
const MsgFilterList & | GetFilterList () const |
const uint32 | GetToken () |
Get the handlers token. More... | |
Static Public Member Functions | |
static RegistrarManager * | Get () |
Provides access to the RegistrarManager class. More... | |
Static Public Member Functions inherited from os::Looper | |
static Looper * | GetLooperForThread (thread_id hThread) |
Additional Inherited Members | |
Public Types inherited from os::Looper | |
typedef std::map< int, Handler * > | handler_map |
Protected Member Functions inherited from os::Looper | |
bool | FilterMessage (Message *pcMsg, Handler **ppcTarget, std::list< MessageFilter * > *pcFilterList) |
RegistrarManager::RegistrarManager | ( | ) |
Should never be called! Use the Get() method instead.
References os::Message::AddInt64(), os::Message::AddString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::RegistrarManager::Private::m_bCloseAllOnQuit, os::RegistrarManager::Private::m_bSync, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_nRefCount, os::RegistrarManager::Private::m_pzUser, os::Looper::Messenger, os::REGISTRAR_LOGIN, os::REGISTRAR_OK, and os::Messenger::SendMessage().
Referenced by Get().
RegistrarManager::~RegistrarManager | ( | ) |
Never delete a RegistrarManager object! Use the Put() method instead.
References os::Message::AddBool(), os::Message::AddInt64(), os::Message::AddString(), os::Looper::GetMsgPort(), os::RegistrarManager::Private::m_bCloseAllOnQuit, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_LOGOUT, and os::Messenger::SendMessage().
void RegistrarManager::AddRef | ( | void | ) |
References os::RegistrarManager::Private::m_nRefCount.
Referenced by Get().
status_t RegistrarManager::ClearTypeExtensions | ( | String | zMimeType | ) |
zMimeType | - Mimetype of the type. |
References os::Message::AddInt64(), os::Message::AddString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::RegistrarManager::Private::m_bSync, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_CLEAR_TYPE_EXTENSIONS, os::REGISTRAR_OK, and os::Messenger::SendMessage().
status_t RegistrarManager::ClearTypeHandlers | ( | String | zMimeType | ) |
zMimeType | - Mimetype of the type. |
References os::Message::AddInt64(), os::Message::AddString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::RegistrarManager::Private::m_bSync, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_CLEAR_TYPE_HANDLERS, os::REGISTRAR_OK, and os::Messenger::SendMessage().
|
static |
References AddRef(), RegistrarManager(), and os::Looper::Run().
Referenced by InfoWin::HandleMessage(), HandlerSelector::HandlerSelector(), os::IconDirectoryView::IconDirectoryView(), and InfoWin::InfoWin().
RegistrarAppList RegistrarManager::GetAppList | ( | ) |
References os::Message::AddString(), os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_GET_APP_LIST, and os::Messenger::SendMessage().
RegistrarFileType RegistrarManager::GetType | ( | int32 | nIndex | ) |
nIndex | - Index of the type. |
References os::Message::AddInt32(), os::Message::AddInt64(), os::Message::AddString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_GET_TYPE, os::REGISTRAR_OK, and os::Messenger::SendMessage().
Referenced by InfoWin::HandleMessage(), and InfoWin::InfoWin().
status_t RegistrarManager::GetTypeAndIcon | ( | String | zFile, |
Point | cIconSize, | ||
String * | zTypeName, | ||
Image ** | pcIcon, | ||
Message * | pcMessage = NULL |
||
) |
zFile | - Path to the file. |
cIconSize | - Requested size of the icon. |
zTypeName | - Contains the type description after the call. |
pcIcon | - Contains the icon after the call. |
pcMessage | - Contains the full description of the type. In the same format as the returned message by GetType(). |
References os::Message::AddInt64(), os::Message::AddPoint(), os::Message::AddString(), os::String::CountChars(), os::Message::FindString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::Resources::GetResourceStream(), os::BitmapImage::GetSize(), os::String::Length(), os::BitmapImage::Load(), os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_GET_TYPE_AND_ICON, os::REGISTRAR_OK, os::Messenger::SendMessage(), os::BitmapImage::SetSize(), os::FSNode::SetTo(), and os::String::substr().
Referenced by os::IconDirectoryView::GetDirIcon(), os::IconDirectoryView::HandleMessage(), HandlerSelector::HandlerSelector(), InfoWin::InfoWin(), and Launch().
int32 RegistrarManager::GetTypeCount | ( | ) |
References os::Message::AddInt64(), os::Message::AddString(), os::Message::FindInt32(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_GET_TYPE_COUNT, os::REGISTRAR_OK, and os::Messenger::SendMessage().
Referenced by InfoWin::InfoWin().
|
virtual |
pcMessage
is also available through os::Looper::GetCurrentMessage() and os::Looper::DetachCurrentMessage() until this member returns. This is normally not very usefull for HandleMessage() itself but it can be convinient for other members called from HandleMessage() in case they need data from the message that was not passed on from HandleMessage(). pcMessage | The message that should be handled. This message will be deleted by the looper when HandleMessage() returns unless you detach it with os::Looper::DetachCurrentMessage(), |
Reimplemented from os::Handler.
References os::Handler::HandleMessage().
status_t RegistrarManager::Launch | ( | Window * | pcParentWindow, |
String | zFile, | ||
bool | bVerbose = false , |
||
os::String | zTitle = "Select handler" , |
||
bool | bDefaultHandler = true |
||
) |
pcParentWindow | - Parent window. Can be NULL. The handler selector will be centered in this window. |
zFile | - Absolute path to the file. |
bVerbose | - Activates verbose mode. |
zTitle | - Title of the handler selector. |
bDefaultHandler | - If set to false, the handler selector will always be shown. |
References os::String::c_str(), os::Window::CenterInScreen(), os::Window::CenterInWindow(), os::Message::FindString(), os::Path::GetPath(), GetTypeAndIcon(), os::Window::MakeFocus(), os::Window::SetTitle(), and os::Window::Show().
Referenced by os::IconDirectoryView::HandleMessage(), and os::IconDirectoryView::Invoked().
void RegistrarManager::Put | ( | bool | bAll = false | ) |
References os::RegistrarManager::Private::m_bCloseAllOnQuit, os::RegistrarManager::Private::m_nRefCount, os::M_QUIT, and os::Looper::PostMessage().
Referenced by InfoWin::HandleMessage(), HandlerSelector::HandlerSelector(), InfoWin::InfoWin(), and os::IconDirectoryView::~IconDirectoryView().
status_t RegistrarManager::RegisterAsTypeHandler | ( | String | zMimeType | ) |
zMimeType | - Mimetype of the type. |
References RegisterTypeHandler().
status_t RegistrarManager::RegisterType | ( | String | zMimeType, |
String | zIdentifier, | ||
bool | bOverwrite = false |
||
) |
zMimeType | - Mimetype of the new type. |
zIdentifier | - Name of the type. |
bOverwrite | - Whether the name should be overwritten if a type with the same mimetype already exists. false is almost always right. |
References os::Message::AddBool(), os::Message::AddInt64(), os::Message::AddString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::RegistrarManager::Private::m_bSync, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_OK, os::REGISTRAR_REGISTER_TYPE, and os::Messenger::SendMessage().
zMimeType | - Mimetype of the type. |
zExtension | - Extension that should be registeread. |
References os::Message::AddInt64(), os::Message::AddString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::String::Lower(), os::RegistrarManager::Private::m_bSync, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_OK, os::REGISTRAR_REGISTER_TYPE_EXTENSION, and os::Messenger::SendMessage().
zMimeType | - Mimetype of the type. |
cHandler | - Absolute path to the handler. |
References os::Message::AddInt64(), os::Message::AddString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::Path::GetPath(), os::RegistrarManager::Private::m_bSync, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_OK, os::REGISTRAR_REGISTER_TYPE_HANDLER, and os::Messenger::SendMessage().
Referenced by RegisterAsTypeHandler().
status_t RegistrarManager::RegisterTypeIcon | ( | String | zMimeType, |
Path | cIcon, | ||
bool | bOverwrite = false |
||
) |
zMimeType | - Mimetype of the type. |
zIcon | - Path to the new icon. The icon should be in /boot/System/resources/icons/filetypes/. |
bOverwrite | - Whether the icon should be overwritten if a type with the same mimetype already exists. false is almost always right. |
References os::Message::AddBool(), os::Message::AddInt64(), os::Message::AddString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::Path::GetPath(), os::RegistrarManager::Private::m_bSync, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_OK, os::REGISTRAR_REGISTER_TYPE_ICON, and os::Messenger::SendMessage().
Referenced by RegisterTypeIconFromRes().
status_t RegistrarManager::RegisterTypeIconFromRes | ( | String | zMimeType, |
String | zIconRes, | ||
bool | bOverwrite = false |
||
) |
zMimeType | - Mimetype of the type. |
zIconRes | - Resource name of the icon. |
bOverwrite | - Whether the icon should be overwritten if a type with the same mimetype already exists. false is almost always right. |
References os::String::c_str(), os::File::Flush(), os::Resources::GetResourceStream(), os::ResStream::Read(), RegisterTypeIcon(), os::FSNode::SetTo(), os::FSNode::Unset(), and os::File::Write().
zMimeType | - Mimetype of the type. |
zHandler | - Absoulte path to the handler. |
References os::Message::AddInt64(), os::Message::AddString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::Path::GetPath(), os::RegistrarManager::Private::m_bSync, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_OK, os::REGISTRAR_SET_DEFAULT_HANDLER, and os::Messenger::SendMessage().
void RegistrarManager::SetSynchronousMode | ( | bool | bSync | ) |
References os::RegistrarManager::Private::m_bSync.
status_t RegistrarManager::UnregisterType | ( | String | zMimeType | ) |
zMimeType | - Mimetype of the type. |
References os::Message::AddInt64(), os::Message::AddString(), os::Message::GetCode(), os::Looper::GetMsgPort(), os::RegistrarManager::Private::m_bSync, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_OK, os::REGISTRAR_UNREGISTER_TYPE, and os::Messenger::SendMessage().
void RegistrarManager::UpdateAppList | ( | bool | bForce = false | ) |
bForce | - Force the registrar to update the list. |
References os::Message::AddString(), os::RegistrarManager::Private::m_bSync, os::RegistrarManager::Private::m_cServerLink, os::RegistrarManager::Private::m_pzUser, os::REGISTRAR_UPDATE_APP_LIST, and os::Messenger::SendMessage().