Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

DllAndNamespaceHandling Class Reference

Handles storing and adding/removing of namespaces, paths, and dlls. More...

Inheritance diagram for DllAndNamespaceHandling:

Inheritance graph
[legend]
Collaboration diagram for DllAndNamespaceHandling:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DllAndNamespaceHandling (bool useDefault)
void Lock (string message)
 Locks this object. This means that the calls to add/remove paths, dlls, and namespaces will return an ItemLockedExceptions. Calls to Clone are still allowed.
void UnLock ()
 Unlocks the object.
object Clone ()
 Makes a clone (deep copy) from this object and returns it. However, the locked status of this object is left untouched.
void Clone (DllAndNamespaceHandling from)
 Makes this object equal to the 'from object' (deep copy). However, the locked status of this object is left untouched.
void AddPath (string path)
 Adds a path to search for dlls in.
void RemovePath (string path)
ArrayList GetPaths ()
 Returns the currently added paths.
void AddDll (string dll)
 Adds a dll. This will be linked with the user programs when compiled.
void RemoveDll (string dll)
ArrayList GetDlls ()
 Returns the currently added dlls.
ArrayList GetAvailableDlls ()
 Returns the available dlls.
void AddNamespace (string name)
 Adds a namespace. The namespace will be added to the user programs when compiled (using directive).
void RemoveNamespace (string name)
ArrayList GetNamespaces ()
 Returns the currently added namespaces.
ArrayList GetAvailableNamespaces ()
 Returns the available namespaces.
ArrayList GetAvailableTypes ()
 Returns the available types.
Type GetType (string name)
 Returns a type from a qualified typename,.
bool AreSimilar (DllAndNamespaceHandling to)
 According to http://weblogs.asp.net/bleroy/archive/2004/12/15/316601.aspx Equals should only be used on immutable objects. Therefore we make our own 'Equals' method for mutable objects.
void Load (FileStream fileStream, BinaryFormatter formatter)
void Save (FileStream fileStream, BinaryFormatter formatter)
delegate void ChangeHandler ()

Public Attributes

event ChangeHandler OnChange
 An event is fired whenever paths, dlls, or namespaces are changed.

Private Member Functions

Set FindPathsToAdd ()
 Uses _packagesToFindPaths and _defaultPaths to make a set of paths. This set is used as default paths.
Set GetAvailableNamespaces (string dll)
 Returns the available namespaces in a DLL.
Assembly GetAssembly (string dllname)
 Returns an assembly, given a dllname.
Set GetAvailableTypes (string dll)
 Returns the available types in a DLL.
string GetDllPath (string dll)
 Locates the path where the dll can be found.
ArrayList AvailableDllsInDirectory (string path)
 Returns the available DLL's in a directory.
void ChangeNotifyAll ()

Private Attributes

ArrayList _paths = new ArrayList()
ArrayList _dlls = new ArrayList()
ArrayList _namespaces = new ArrayList()
string _locked

Static Private Attributes

static string[] _packagesToFindPaths
static string[] _defaultPaths
static string[] _defaultDlls
 Standard dlls. These are allways included by mcs.

Detailed Description

Handles storing and adding/removing of namespaces, paths, and dlls.


Constructor & Destructor Documentation

DllAndNamespaceHandling::DllAndNamespaceHandling bool  useDefault  )  [inline]
 


Member Function Documentation

void DllAndNamespaceHandling::AddDll string  dll  )  [inline]
 

Adds a dll. This will be linked with the user programs when compiled.

Exceptions:
ItemNotAvailableException If the dll cannot be found.
ItemAlreadyAddedException If the dll has already been added.
ItemLockedException If the this object has been locked. See Lock(...) and Unlock(...).

void DllAndNamespaceHandling::AddNamespace string  name  )  [inline]
 

Adds a namespace. The namespace will be added to the user programs when compiled (using directive).

Exceptions:
ItemNotAvailableException If the namespace is not available.
ItemAlreadyAddedException If the namespace has already been added.
ItemLockedException If the this object has been locked. See Lock(...) and Unlock(...).

void DllAndNamespaceHandling::AddPath string  path  )  [inline]
 

Adds a path to search for dlls in.

Exceptions:
PathDoNotExistsException If no file or directory has this name.
NotADirectoryException If the path exsists, but is not a directory.
ItemAlreadyAddedException If the path has already been added.
ItemLockedException If the this object has been locked. See Lock(...) and Unlock(...).

bool DllAndNamespaceHandling::AreSimilar DllAndNamespaceHandling  to  )  [inline]
 

According to http://weblogs.asp.net/bleroy/archive/2004/12/15/316601.aspx Equals should only be used on immutable objects. Therefore we make our own 'Equals' method for mutable objects.

ArrayList DllAndNamespaceHandling::AvailableDllsInDirectory string  path  )  [inline, private]
 

Returns the available DLL's in a directory.

delegate void DllAndNamespaceHandling::ChangeHandler  ) 
 

void DllAndNamespaceHandling::ChangeNotifyAll  )  [inline, private]
 

void DllAndNamespaceHandling::Clone DllAndNamespaceHandling  from  )  [inline]
 

Makes this object equal to the 'from object' (deep copy). However, the locked status of this object is left untouched.

object DllAndNamespaceHandling::Clone  )  [inline]
 

Makes a clone (deep copy) from this object and returns it. However, the locked status of this object is left untouched.

Set DllAndNamespaceHandling::FindPathsToAdd  )  [inline, private]
 

Uses _packagesToFindPaths and _defaultPaths to make a set of paths. This set is used as default paths.

Assembly DllAndNamespaceHandling::GetAssembly string  dllname  )  [inline, private]
 

Returns an assembly, given a dllname.

ArrayList DllAndNamespaceHandling::GetAvailableDlls  )  [inline]
 

Returns the available dlls.

That is, the dlls which can be found though the added paths.

Set DllAndNamespaceHandling::GetAvailableNamespaces string  dll  )  [inline, private]
 

Returns the available namespaces in a DLL.

ArrayList DllAndNamespaceHandling::GetAvailableNamespaces  )  [inline]
 

Returns the available namespaces.

That is, the namespaces which can be found from the added dlls and the auto-included dlls, such as System.

Set DllAndNamespaceHandling::GetAvailableTypes string  dll  )  [inline, private]
 

Returns the available types in a DLL.

ArrayList DllAndNamespaceHandling::GetAvailableTypes  )  [inline]
 

Returns the available types.

That is, the types which can be found from the added dlls and the auto-included dlls, such as System.

string DllAndNamespaceHandling::GetDllPath string  dll  )  [inline, private]
 

Locates the path where the dll can be found.

Parameters:
dll A string with the name of the dll.
Returns:
The path where the dll can be found. If it is part of the 'standard' dlls, the empty path will be returned. By 'standard' is meant the dlls which can be included (-r), when compiling, without specifying where they are located (for example the System dll). Null is returned if the path cannot be found anywhere.

ArrayList DllAndNamespaceHandling::GetDlls  )  [inline]
 

Returns the currently added dlls.

ArrayList DllAndNamespaceHandling::GetNamespaces  )  [inline]
 

Returns the currently added namespaces.

ArrayList DllAndNamespaceHandling::GetPaths  )  [inline]
 

Returns the currently added paths.

Type DllAndNamespaceHandling::GetType string  name  )  [inline]
 

Returns a type from a qualified typename,.

Returns:
The type if it can be found, null otherwise.

void DllAndNamespaceHandling::Load FileStream  fileStream,
BinaryFormatter  formatter
[inline]
 

Implements IReferenceSaveSerializable.

void DllAndNamespaceHandling::Lock string  message  )  [inline]
 

Locks this object. This means that the calls to add/remove paths, dlls, and namespaces will return an ItemLockedExceptions. Calls to Clone are still allowed.

void DllAndNamespaceHandling::RemoveDll string  dll  )  [inline]
 

Exceptions:
ItemDoNotExsistsException If the dll has not been added previously.
ItemInUseException If some added namespaces uses this dll.
ItemLockedException If the this object has been locked. See Lock(...) and Unlock(...).

void DllAndNamespaceHandling::RemoveNamespace string  name  )  [inline]
 

Exceptions:
ItemDoNotExsistsException If the namespace has not been added previously.
ItemLockedException If the this object has been locked. See Lock(...) and Unlock(...).

void DllAndNamespaceHandling::RemovePath string  path  )  [inline]
 

Exceptions:
ItemInUseException If some added dll uses this path.
ItemDoNotExsistsException If the path has not been added previously.
ItemLockedException If the this object has been locked. See Lock(...) and Unlock(...).

void DllAndNamespaceHandling::Save FileStream  fileStream,
BinaryFormatter  formatter
[inline]
 

Implements IReferenceSaveSerializable.

void DllAndNamespaceHandling::UnLock  )  [inline]
 

Unlocks the object.

See also:
DllAndNamespaceHandling::Lock


Member Data Documentation

string [] DllAndNamespaceHandling::_defaultDlls [static, private]
 

Initial value:

 {
                "System.dll",
                "System.Xml.dll",
                "mscorlib.dll"
                
                
                
                
                
        }
Standard dlls. These are allways included by mcs.

Also see _standardDlls member variable.

Todo:
Should read some mono config file instead of hardcoding them.

string [] DllAndNamespaceHandling::_defaultPaths [static, private]
 

Initial value:

 {
                "/usr/lib/mono/2.0",
                "/usr/lib/mono/gtk-sharp"
        }

ArrayList DllAndNamespaceHandling::_dlls = new ArrayList() [private]
 

string DllAndNamespaceHandling::_locked [private]
 

ArrayList DllAndNamespaceHandling::_namespaces = new ArrayList() [private]
 

string [] DllAndNamespaceHandling::_packagesToFindPaths [static, private]
 

Initial value:

 {
                "gtk-sharp",
                "gnome-sharp",
                "gecko-sharp"
        }

ArrayList DllAndNamespaceHandling::_paths = new ArrayList() [private]
 

event ChangeHandler DllAndNamespaceHandling::OnChange
 

An event is fired whenever paths, dlls, or namespaces are changed.


The documentation for this class was generated from the following file: SourceForge.net Logo