ResourceGroupManager::ResourceGroup impedence mismatch

Minor issues with the Ogre API that can be trivial to fix
Post Reply
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France

ResourceGroupManager::ResourceGroup impedence mismatch

Post by Mikachu » Thu Apr 18, 2013 9:05 pm

Hi,

2 public methods in ResourceGroupManager use protected struct ResourceGroupManager::ResourceGroup in their arguments :

Code: Select all

   /** Find out if the named file exists in a group. 
        @param group Pointer to the resource group
        @param filename Fully qualified name of the file to test for
        */
        bool resourceExists(ResourceGroup* group, const String& filename);

....

	/** Retrieve the modification time of a given file */
		time_t resourceModifiedTime(ResourceGroup* group, const String& filename); 
Those 2 methods should be made protected as well, or ResourceGroupManager::ResourceGroup should be public...

Actually, I don't know why the compiler is letting this happen :wink:
0 x
OgreProcedural - Procedural Geometry for Ogre3D

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

Re: ResourceGroupManager::ResourceGroup impedence mismatch

Post by masterfalcon » Fri Apr 19, 2013 12:07 am

I don't believe that it matters because it's not an instance but rather the definition of the type. The definition is within the class scope and so class methods have access to those types. I could be wrong and this is just something that compilers just allow. I haven't checked in the C++ spec to verify.
0 x

User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France

Re: ResourceGroupManager::ResourceGroup impedence mismatch

Post by Mikachu » Fri Apr 19, 2013 10:40 am

I've setup a test case here : http://ideone.com/KHkTGT

I think the compiler doesn't throw an error because:
  • the pointer can be null, in which case the caller doesn't need pointer type
  • a pointer to the type can be used by callee if it doesn't explicitely name it, as in the above example
None of the above cases is useful for Ogre, so the fact that the 2 functions are public is misleading.
IMHO, the struct ResourceGroupManager::ResourceGroup should be made public...

Shall I file an issue for this?
0 x
OgreProcedural - Procedural Geometry for Ogre3D

Post Reply