]> git.tdb.fi Git - libs/gl.git/commitdiff
Use typedefs in Program
authorMikko Rasa <tdb@tdb.fi>
Fri, 24 Aug 2012 07:43:25 +0000 (10:43 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 24 Aug 2012 07:43:25 +0000 (10:43 +0300)
source/program.cpp
source/program.h

index 7598bf1572adc036f7777fa8e9741c6086102689..f07b2015c8c459bd36d480d9cc655d7da15d7c01 100644 (file)
@@ -137,7 +137,7 @@ void Program::init()
 
 Program::~Program()
 {
-       for(list<Shader *>::iterator i=owned_data.begin(); i!=owned_data.end(); ++i)
+       for(ShaderList::iterator i=owned_data.begin(); i!=owned_data.end(); ++i)
                delete *i;
        glDeleteObjectARB(id);
 }
@@ -160,7 +160,7 @@ void Program::attach_shader_owned(Shader *shader)
 
 void Program::detach_shader(Shader &shader)
 {
-       list<Shader *>::iterator i = remove(shaders.begin(), shaders.end(), &shader);
+       ShaderList::iterator i = remove(shaders.begin(), shaders.end(), &shader);
        if(i!=shaders.end())
        {
                shaders.erase(i, shaders.end());
@@ -222,7 +222,7 @@ void Program::bind_attribute(unsigned index, const string &name)
 
 void Program::link()
 {
-       for(list<Shader *>::iterator i=shaders.begin(); i!=shaders.end(); ++i)
+       for(ShaderList::iterator i=shaders.begin(); i!=shaders.end(); ++i)
                if(!(*i)->is_compiled())
                        (*i)->compile();
 
@@ -284,7 +284,7 @@ void Program::bind() const
 
 int Program::get_uniform_location(const string &n) const
 {
-       map<string, UniformInfo>::const_iterator i = uniforms.find(n);
+       UniformMap::const_iterator i = uniforms.find(n);
        if(i==uniforms.end())
        {
                if(n[n.size()-1]==']')
index a1f454e9453272cf14b84a29ce60bc8c6a765b60..ddfc828c5ceddcbbc6e2758318ca78ec0e3512be 100644 (file)
@@ -59,12 +59,15 @@ public:
                GLenum type;
        };
 
+       typedef std::list<Shader *> ShaderList;
+       typedef std::map<std::string, UniformInfo> UniformMap;
+
 private:
        unsigned id;
-       std::list<Shader *> shaders;
-       std::list<Shader *> owned_data;
+       ShaderList shaders;
+       ShaderList owned_data;
        bool linked;
-       std::map<std::string, UniformInfo> uniforms;
+       UniformMap uniforms;
        unsigned uniform_layout_hash;
 
 public:
@@ -83,7 +86,7 @@ public:
 private:
        static std::string process_standard_source(const char **, const std::string &);
 public:
-       const std::list<Shader *> &get_shaders() const { return shaders; }
+       const ShaderList &get_shaders() const { return shaders; }
        void bind_attribute(unsigned, const std::string &);
        void link();
        bool is_linked() const { return linked; }