OSDN Git Service

Refactor API to facilitate implementation of GUI ListView hooks.
[mingw/mingw-get.git] / src / pkgbase.h
index 6c2ff1d..833a9cc 100644 (file)
@@ -5,7 +5,7 @@
  * $Id$
  *
  * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2009, 2010, 2011, MinGW Project
+ * Copyright (C) 2009, 2010, 2011, 2012, MinGW Project
  *
  *
  * Public interface for the package directory management routines;
 # endif
 #endif
 
+/* Define an API for registering environment variables.
+ */
+EXTERN_C int pkgPutEnv( int, char* );
+
+#define PKG_PUTENV_DIRSEP_MSW          (0x01)
+#define PKG_PUTENV_DIRSEP_POSIX        (0x02)
+#define PKG_PUTENV_SCAN_VARNAME        (0x04)
+#define PKG_PUTENV_NAME_TOUPPER        (0x08)
+
+#define PKG_PUTENV_FLAGS_MASK          (0x0F)
+
+/* Begin class declarations.
+ */
 class pkgSpecs;
+class pkgDirectory;
 
 class pkgXmlNode : public TiXmlElement
 {
@@ -190,6 +204,23 @@ class pkgXmlNode : public TiXmlElement
      * be associated with a release.
      */
     const char *GetContainerAttribute( const char*, const char* = NULL );
+
+    /* Any package may have associated scripts; the following
+     * method invokes them on demand.
+     */
+    inline int InvokeScript( const char *context )
+    {
+      /* The actual implementation is delegated to the following
+       * (private) overloaded method.
+       */
+      return InvokeScript( 0, context );
+    }
+
+  private:
+    /* Helpers used to implement the preceding InvokeScript() method.
+     */
+    int InvokeScript( int, const char* );
+    int DispatchScript( int, const char*, const char*, pkgXmlNode* );
 };
 
 enum { to_remove = 0, to_install, selection_types };
@@ -256,6 +287,7 @@ class pkgActionItem
     /* Methods for defining the selection criteria for
      * packages to be processed.
      */
+    void ApplyBounds( pkgXmlNode *, const char * );
     pkgXmlNode* SelectIfMostRecentFit( pkgXmlNode* );
     const char* SetRequirements( pkgXmlNode*, pkgSpecs* );
     inline void SelectPackage( pkgXmlNode *pkg, int opt = to_install )
@@ -357,6 +389,12 @@ class pkgXmlDocument : public TiXmlDocument
     pkgActionItem* actions;
 
   public:
+    /* Method to interpret user preferences for mingw-get processing
+     * options, which are specified within profile.xml rather than on
+     * the command line.
+     */
+    void EstablishPreferences();
+
     /* Method to synchronise the state of the local package manifest
      * with the master copy held on the distribution server.
      */
@@ -381,8 +419,9 @@ class pkgXmlDocument : public TiXmlDocument
      */
     pkgXmlNode* FindPackageByName( const char*, const char* = NULL );
 
-    /* Method to display information about packages.
+    /* Methods to retrieve and display information about packages.
      */
+    pkgDirectory *CatalogueAllPackages();
     void DisplayPackageInfo( int, char** );
 
     /* Method to resolve the dependencies of a specified package,