2010-05-16 16:02:50 -05:00
|
|
|
/*
|
2011-12-03 16:38:03 -06:00
|
|
|
* Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved.
|
2010-05-16 16:02:50 -05:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _CAYA_PROTOCOL_ADDON_H
|
|
|
|
#define _CAYA_PROTOCOL_ADDON_H
|
|
|
|
|
|
|
|
#include <image.h>
|
|
|
|
|
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
class BBitmap;
|
|
|
|
class CayaProtocol;
|
|
|
|
|
Allow multiple protocols per add-on
Now an add-on can contain multiple protocols, and the protocol API has
changed. An add-on must now export protocol_count() and protocol_at(),
with the latter replacing protocol(). protocol_count() returning the
amount of protocols in a given add-on, and protocol_at(i) giving a
new CayaProtocol* "at" the given index.
CayaProtocol has also been changed, adding Signature(),
FriendlySignature(), Icon(), Path(), and SetPath(). The reasoning is
that different protocols (even within a single add-on) will have
different signatures and icons, so this data should be accessible from
the protocol itself.
CayaProtocolAddOn now has CountProtocols() and ProtocolAt(i), allowing
the accessing of multiple protocols. A CayaProtocolAddOn can be given a
default protocol index in the constructor, whose protocol will be
returned with Protocol(). Version() was also moved from CayaProtocol to
CayaProtocolAddOn.
2021-05-21 13:33:43 -05:00
|
|
|
|
2010-05-16 16:02:50 -05:00
|
|
|
class CayaProtocolAddOn {
|
|
|
|
public:
|
Allow multiple protocols per add-on
Now an add-on can contain multiple protocols, and the protocol API has
changed. An add-on must now export protocol_count() and protocol_at(),
with the latter replacing protocol(). protocol_count() returning the
amount of protocols in a given add-on, and protocol_at(i) giving a
new CayaProtocol* "at" the given index.
CayaProtocol has also been changed, adding Signature(),
FriendlySignature(), Icon(), Path(), and SetPath(). The reasoning is
that different protocols (even within a single add-on) will have
different signatures and icons, so this data should be accessible from
the protocol itself.
CayaProtocolAddOn now has CountProtocols() and ProtocolAt(i), allowing
the accessing of multiple protocols. A CayaProtocolAddOn can be given a
default protocol index in the constructor, whose protocol will be
returned with Protocol(). Version() was also moved from CayaProtocol to
CayaProtocolAddOn.
2021-05-21 13:33:43 -05:00
|
|
|
CayaProtocolAddOn(image_id image, const char* path,
|
|
|
|
int32 subProto=0);
|
2010-05-16 16:02:50 -05:00
|
|
|
|
|
|
|
status_t InitCheck() const;
|
|
|
|
|
|
|
|
const char* Path() const;
|
|
|
|
|
|
|
|
CayaProtocol* Protocol() const;
|
Allow multiple protocols per add-on
Now an add-on can contain multiple protocols, and the protocol API has
changed. An add-on must now export protocol_count() and protocol_at(),
with the latter replacing protocol(). protocol_count() returning the
amount of protocols in a given add-on, and protocol_at(i) giving a
new CayaProtocol* "at" the given index.
CayaProtocol has also been changed, adding Signature(),
FriendlySignature(), Icon(), Path(), and SetPath(). The reasoning is
that different protocols (even within a single add-on) will have
different signatures and icons, so this data should be accessible from
the protocol itself.
CayaProtocolAddOn now has CountProtocols() and ProtocolAt(i), allowing
the accessing of multiple protocols. A CayaProtocolAddOn can be given a
default protocol index in the constructor, whose protocol will be
returned with Protocol(). Version() was also moved from CayaProtocol to
CayaProtocolAddOn.
2021-05-21 13:33:43 -05:00
|
|
|
CayaProtocol* ProtocolAt(int32 i) const;
|
|
|
|
|
|
|
|
int32 CountProtocols() const;
|
2010-05-28 12:11:16 -05:00
|
|
|
|
2010-05-16 16:02:50 -05:00
|
|
|
const char* Signature() const;
|
|
|
|
const char* FriendlySignature() const;
|
|
|
|
BBitmap* Icon() const;
|
|
|
|
|
2021-05-22 12:05:44 -05:00
|
|
|
const char* ProtoSignature() const;
|
|
|
|
const char* ProtoFriendlySignature() const;
|
|
|
|
BBitmap* ProtoIcon() const;
|
|
|
|
|
|
|
|
uint32 Version() const;
|
|
|
|
|
2010-05-16 16:02:50 -05:00
|
|
|
private:
|
|
|
|
image_id fImage;
|
|
|
|
BString fPath;
|
Allow multiple protocols per add-on
Now an add-on can contain multiple protocols, and the protocol API has
changed. An add-on must now export protocol_count() and protocol_at(),
with the latter replacing protocol(). protocol_count() returning the
amount of protocols in a given add-on, and protocol_at(i) giving a
new CayaProtocol* "at" the given index.
CayaProtocol has also been changed, adding Signature(),
FriendlySignature(), Icon(), Path(), and SetPath(). The reasoning is
that different protocols (even within a single add-on) will have
different signatures and icons, so this data should be accessible from
the protocol itself.
CayaProtocolAddOn now has CountProtocols() and ProtocolAt(i), allowing
the accessing of multiple protocols. A CayaProtocolAddOn can be given a
default protocol index in the constructor, whose protocol will be
returned with Protocol(). Version() was also moved from CayaProtocol to
CayaProtocolAddOn.
2021-05-21 13:33:43 -05:00
|
|
|
CayaProtocol* (*fGetProtocol)(int32 i);
|
|
|
|
int32 (*fCountProtocols)();
|
|
|
|
int32 fProtoIndex;
|
|
|
|
uint32 fVersion;
|
2010-05-16 16:02:50 -05:00
|
|
|
BString fSignature;
|
|
|
|
BString fFriendlySignature;
|
|
|
|
BBitmap* fIcon;
|
|
|
|
status_t fStatus;
|
|
|
|
|
|
|
|
void _Init();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _CAYA_PROTOCOL_ADDON_H
|