[haiku-development] Re: RFC: password roster API

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 25 Jan 2011 01:01:59 +0100

Am Montag, den 24.01.2011, 23:46 +0100 schrieb Axel Dörfler:

[...]

The API looks good to me, but I am uninformed on the subject. Only some
remarks on naming and inner types:

> --------------8<--------------
> class BPassword {
> public:
>       enum password_type {
>               B_WEB,
>               B_NETWORK,
>               B_VOLUME
>       };
> 
>       enum password_flags {
>               B_CONVERT_IF_HEX                = 0x01
>               // TODO!
>       };
>       typedef BFlags<password_flags> Flags;

I would define global types in the file "enum BPasswordType" with values
"B_PASSWORD_WEB" or "B_PASSWORD_TYPE_WEB". In BControlLook I did it like
you here, but I find my solution with BCursorID better/more convenient.


You can see this here:

> --------------8<--------------
> class BPasswordRoster {
> public:
>                                                               
> BPasswordRoster();
>       virtual                                         ~BPasswordRoster();
> 
>                       status_t                        
> GetPassword(BPassword::password_type 
> type,

GetPassword(BPasswordType type, ...) looks much better and is more
readable/convenient. While BPassword::Type looks almost as slick, it is
much less readable in Password.cpp itself.

Best regards,
-Stephan



Other related posts: