]> Dogcows Code - chaz/yoink/blobdiff - src/moof/resource.hh
remove some unused stlplus modules
[chaz/yoink] / src / moof / resource.hh
index 094791c30f383b34538f6713227a190f69452ba3..41dfd61ac11d5ab3bbd94262fcf58c543183181f 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_RESOURCE_HH_
 #define _MOOF_RESOURCE_HH_
@@ -34,7 +32,6 @@ namespace moof {
 class resource;
 typedef boost::shared_ptr<resource> resource_ptr;
 
-
 /**
  * Generic resource class capable of containing any type of resource,
  * providing a type-safe interface.
@@ -49,7 +46,6 @@ public:
         */
        static void set_search_paths(const std::string& paths);
 
-
        /**
         * Get the path to a resource of a given name.  This uses the search
         * path(s) and resources prefixes to locate resource files.
@@ -67,8 +63,8 @@ public:
         * extension is not already a part of name.
         * \return The full path of the resource.
         */
-       static std::string find_file(const std::string& name,
-                                                                const std::string& ext);
+       static std::string
+       find_file(const std::string& name, const std::string& ext);
 
        /**
         * Register a type with the extension of files which this type can
@@ -78,7 +74,7 @@ public:
         */
        template <class T>
        static void register_type(const std::string& extension,
-                                                         const std::string& prefix = "")
+                       const std::string& prefix = "")
        {
                loader_ptr loader(new specific_loader<T>(prefix));
                call_registry(extension, loader, set);
@@ -96,7 +92,6 @@ public:
                call_registry(extension, loader, set);
        }
 
-
        /**
         * Find and load a resource by name or path.
         * \param name The name or partial path of the resource.  This should
@@ -112,9 +107,8 @@ public:
         * \param 
         * \return The resource.
         */
-       static resource_ptr load(const std::string& name,
-                                                        const std::string& ext);
-
+       static resource_ptr
+       load(const std::string& name, const std::string& ext);
 
        /**
         * Reload the resource data.  This will cause the resource file to be
@@ -138,7 +132,6 @@ public:
         */
        static int reload_as_needed();
 
-
        /**
         * Get whether or not the type of the underlying resource data matches
         * an expected type.
@@ -162,13 +155,11 @@ public:
                return 0;
        }
 
-
        /**
         * Deconstruct a resource container.
         */
        virtual ~resource();
 
-
 private:
 
        template <class T>
@@ -178,9 +169,8 @@ private:
                unloader_(new specific_unloader<T>(ptr)),
                wd_(-1) {}
 
-       static resource_ptr load_with_path(const std::string& path,
-                                                                          const std::string& extension);
-
+       static resource_ptr
+       load_with_path(const std::string& path, const std::string& extension);
 
        class loader
        {
@@ -201,7 +191,6 @@ private:
                        return prefix_;
                }
 
-
        private:
 
                std::string prefix_;
@@ -223,7 +212,6 @@ private:
                }
        };
 
-
        class unloader
        {
        public:
@@ -246,13 +234,11 @@ private:
                        delete object_;
                }
 
-
        private:
 
                T* object_;
        };
 
-
        enum registry_action
        {
                lookup,
@@ -260,16 +246,14 @@ private:
        };
 
        static bool call_registry(const std::string& extension,
-                                                         loader_ptr& loader,
-                                                         registry_action action);
+                       loader_ptr& loader, registry_action action);
 
-
-       void*                   resource_;
+       void*           resource_;
        std::type_info* typeinfo_;
        unloader_ptr    unloader_;
-       int                             wd_;
-       std::string             path_;
-       std::string             type_;
+       int             wd_;
+       std::string     path_;
+       std::string     type_;
 };
 
 
@@ -301,7 +285,6 @@ public:
        resource_handle(const std::string& name, const std::string& ext) :
                resource_(resource::load(name, ext)) {}
 
-
        /**
         * Get whether or not the handle is dereferenceable to the type of this
         * handle.  A resource handle is dereferenceable if it is not a null
@@ -315,7 +298,6 @@ public:
                return resource_->check<T>();
        }
 
-
        /**
         * Get a pointer to the underlying resource.
         * \return The pointer, or null if this handle is not dereferenceable.
@@ -337,7 +319,6 @@ public:
                return *(resource_->get<T>());
        }
 
-
        /**
         * Same as get() for getting a pointer to the underlying resources.
         * \return The pointer, or null if this handle is not dereferenceable.
@@ -357,7 +338,6 @@ public:
                return get_reference();
        }
 
-
        /**
         * Unload the resource associated with this handle.
         */
@@ -366,13 +346,11 @@ public:
                resource_ = resource_ptr();
        }
 
-
 private:
 
        resource_ptr resource_;
 };
 
-
 /**
  * This macro easily registers types to act as resources.  It should be
  * used in a module file in global scope.
This page took 0.028864 seconds and 4 git commands to generate.