From d02c2ebbdb48b65a45c10293e97be2aa747eb913 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 24 Aug 2012 10:43:25 +0300 Subject: [PATCH] Use typedefs in Program --- source/program.cpp | 8 ++++---- source/program.h | 11 +++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source/program.cpp b/source/program.cpp index 7598bf15..f07b2015 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -137,7 +137,7 @@ void Program::init() Program::~Program() { - for(list::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::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::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::const_iterator i = uniforms.find(n); + UniformMap::const_iterator i = uniforms.find(n); if(i==uniforms.end()) { if(n[n.size()-1]==']') diff --git a/source/program.h b/source/program.h index a1f454e9..ddfc828c 100644 --- a/source/program.h +++ b/source/program.h @@ -59,12 +59,15 @@ public: GLenum type; }; + typedef std::list ShaderList; + typedef std::map UniformMap; + private: unsigned id; - std::list shaders; - std::list owned_data; + ShaderList shaders; + ShaderList owned_data; bool linked; - std::map 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 &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; } -- 2.45.2