Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

small addition to editormanager - for convenience only

(1/3) > >>

frithjofh:
hi everybody,

i just added a convenience function to EditorManager class. it is purely thought to unclutter so many for loops where one first gets the count of editors, loop over them with an index, then tests if they are built in editors or null for some other reason, then finally use them. with this function, one can use the new for ( x : container ) loop syntax, and directly use the editor* and save many lines of code.

the other thing was changing the signiture of:

int GetEditorsCount()

to

size_t GetEditorsCount() const

as the underlying function returns this type anyways, and making the function const. doesn't break anything. as always for the devs to kindly consider

regards

frithjofh

oBFusCATed:
Please don't use size_t or any other unsigned type for such things.
They cause more problems than they fix!
Also this patch probably breaks the API and the ABI, so your statement at the end is incorrect. :)

frithjofh:
thx for the reply.

i can't see how this patch could break the API and ABI. the original function goes like this:


--- Code: ---int EditorManager::GetEditorsCount()
{
    return m_pNotebook->GetPageCount();
}

--- End code ---

where the underlying function is defined as so:


--- Code: ---    size_t wxAuiNotebook::GetPageCount() const;

--- End code ---

so in its present state the function already returns a size_t.

or do you refer to the const breaking any existing code?  ???

it does compile without any errors, warnings or misbehavior on my machine...




and the other change? adding the function returning a vector of the built in editors?

oBFusCATed:
I have not looked at the patch, but changing the signature of a function affects both the API and the ABI!
We don't care too much about both, but I wanted to mention it, so you are aware.

frithjofh:
ok. i really am aware, but thx anyways. as i am autodidact, i really appreciate any advice or tip  :)

and yes, the change made led to the recompilation of the core and a number of plugins, took about 4 min on my machine to finish without extra warnings or even errors

Navigation

[0] Message Index

[#] Next page

Go to full version