|
From: Linus A. <lin...@sm...> - 2002-03-23 15:13:29
|
I have been thought some about how to store generic information( user info,
contact info etc ).
I start with some ugly code to give the general idea:
/* Person class */
class Person: public BMessage {
protected:
=09Person( int32 aWhat );=09=09//More args are probably likely.
public:
=09status_t SetNick( const char *aNick );
};
/* User class */
class User: public Person {
public:
=09User(): Person( USER_INFO ) {}
=09status_t SetPassword(); //Probably unecessary.
};
/* Contact class */
class Contact: public Person {
public:
=09Contact(): Person( CONTACT_INFO ) {}
};
This can be done with quite a lot of storage classes in the server.
The nice part is that one can directly send the classes using a BMessenger
without having to create or convert them into BMessages. The drawback is
that BMessages will use more resources than if we use our own format for
data storage, and then convert those classes into BMessages when needed.
Thoughts?
Regards
/Procton
|