Since I'm working on a major change to how we access the servers in the preferences, I thought I'd post a series of header snippets to do design review. Please take a look at the information and comment on it so that I can take peoples ideas into account.

- Jared

The gist of these changes is to abstract the servers from the GUI so that it doesn't have to no the difference between what is stored in the preferences and what comes from rendezvous.  Also, it will allow us to compartmentalize the processing of each type to simplify the code a great deal.  I've developed a protocol called IServerData that all server classes (ServerFromPrefs and ServerFromRendezvous) will implement and the GUI will only deal with these classes through this interface knowing nothing about the specific implementor. Right now the interface is read only, the set methods will be coming in the future as soon as I decide how I want the GUI to understand whether a set is allowed or not (can't set a lot of things in rendezvous). Here is the protocol:

@protocol IServerData

- (NSString*)name;
- (NSString*)host;
- (NSString*)password;
- (
bool)rememberPassword;
- (NSString*)display;
- (NSString*)lastDisplay;
- (
int)shared;
- (
bool)fullscreen;
- (NSString*)lastProfile;

@end

To access these, and abstract the implementing classes from the GUI I have a ServerDataManager class.  The header is heavily commented, so I'll let it speak for itself.  In the future, groups will also be implemented through this class.

/**
 *  ServerDataManager manages all known accessible servers in Chicken of the VNC
 *  including saved server from preferences, rendezvous servers, etc. Servers will
 *  be accessible through the IServerData protocol. Users should not attempt to access
 *  the servers as their specific class type since those classes may change in ways
 *  incompatible to your code (including adding new server classes), but the protocol
 *  should not.
 *  <BR><BR>
 *  This is a singleton class. Always access the class through the sharedInstance
 *  function. Do not create an instance yourself.
 *
 *  @bug Should clean itself up appropriately when the application is ended so
 *  that real memory leaks can be found more easily.
 */
@interface ServerDataManager : NSObject {
    NSMutableDictionary* servers;
}

/**
 *  Accessor method to fetch the singleton instance for this class. Use this method
 *  instead of creating an instance of your own.
 *  @return Shared singleton instance of the ServerDataManager class. */

+ (ServerDataManager*) sharedInstance;

/*
 *  Allows access to all servers managed by ServerDataManager.
 *  @return The enumerator that can be used to enumerate through all servers.
 */

- (NSEnumerator*) getServerEnumerator;

/*
 *  Retrieves a server by its name. The retrieval process is case sensative.
 *  @param name The name of the server you want to retrieve.
 *  @return The server whose name matches the requested one or nil if the server
 *  was not found.
 */

- (
id<IServerData>)getServerWithName:(NSString*)name;
@end