home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / include / k3d / k3dsdk / ipath_property.h < prev    next >
C/C++ Source or Header  |  2009-02-06  |  3KB  |  107 lines

  1. #ifndef K3DSDK_IPATH_PROPERTY_H
  2. #define K3DSDK_IPATH_PROPERTY_H
  3.  
  4. // K-3D
  5. // Copyright (c) 1995-2005, Timothy M. Shead
  6. //
  7. // Contact: tshead@k-3d.com
  8. //
  9. // This program is free software; you can redistribute it and/or
  10. // modify it under the terms of the GNU General Public
  11. // License as published by the Free Software Foundation; either
  12. // version 2 of the License, or (at your option) any later version.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. // General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public
  20. // License along with this program; if not, write to the Free Software
  21. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  22.  
  23. /** \file
  24.         \brief Declares ipath_property, an abstract interface for discovering information about a property that stores filesystem paths
  25.         \author Tim Shead (tshead@k-3d.com)
  26. */
  27.  
  28. #include "iunknown.h"
  29. #include "signal_system.h"
  30.  
  31. #include <string>
  32. #include <vector>
  33.  
  34. namespace k3d
  35. {
  36.  
  37. /// Abstract interface for properties that represent external filesystem resources (typically used to alter presentation)
  38. class ipath_property :
  39.     public virtual iunknown
  40. {
  41. public:
  42.     /// Enumerates the mode of the underlying file
  43.     typedef enum
  44.     {
  45.         READ,
  46.         WRITE,
  47.     } mode_t;
  48.  
  49.     /// Enumerates how the external resource should be referenced - by absolute path, relative path, or inline
  50.     typedef enum
  51.     {
  52.         ABSOLUTE_REFERENCE,
  53.         RELATIVE_REFERENCE,
  54.         INLINE_REFERENCE
  55.     } reference_t;
  56.  
  57.     /// Defines a "pattern filter" that the UI layer can use to filter files using GLOB style syntax
  58.     struct pattern_filter
  59.     {
  60.         pattern_filter()
  61.         {
  62.         }
  63.  
  64.         pattern_filter(const std::string& Name, const std::string& Pattern) :
  65.             name(Name),
  66.             pattern(Pattern)
  67.         {
  68.         }
  69.  
  70.         /// Stores a human-readable name for the pattern
  71.         std::string name;
  72.         /// Stores s pattern using GLOB syntax
  73.         std::string pattern;
  74.     };
  75.  
  76.     typedef std::vector<pattern_filter> pattern_filters_t;
  77.     
  78.     /// Returns the path "mode", which indicates whether the path will be used for an input or an output file
  79.     virtual const mode_t property_path_mode() = 0;
  80.     /// Returns the path "type", used to categorize the purpose of the path and store most-recent-used paths
  81.     virtual const std::string property_path_type() = 0;
  82.  
  83.     /// Returns the path "reference", which indicates how the external resource will be referenced - by absolute path, relative path, or inline
  84.     virtual const reference_t property_path_reference() = 0;
  85.     virtual void set_property_path_reference(const reference_t) = 0;
  86.     /// Defines a signal that will be emitted anytime the path reference is modified
  87.     typedef sigc::signal<void> path_reference_changed_signal_t;
  88.     virtual path_reference_changed_signal_t& property_path_reference_changed_signal() = 0;
  89.  
  90.     /// Returns a collection of pattern filters to be (optionally) used by the UI when prompting the user for a file
  91.     virtual const pattern_filters_t pattern_filters() = 0;
  92.     
  93. protected:
  94.     ipath_property() {}
  95.     ipath_property(const ipath_property&) {}
  96.     ipath_property& operator=(const ipath_property&) { return *this; }
  97.     virtual ~ipath_property() {}
  98. };
  99.  
  100. std::ostream& operator<<(std::ostream&, const ipath_property::reference_t&);
  101. std::istream& operator>>(std::istream&, ipath_property::reference_t&);
  102.  
  103. } // namespace k3d
  104.  
  105. #endif // !K3DSDK_IPATH_PROPERTY_H
  106.  
  107.