Author |
Topic  |
|
Dusan
Whole Tomato Software
    
Slovakia
177 Posts |
Posted - Oct 10 2013 : 3:47:52 PM
|
Hello, I would find handy if there would be a way to temporarily (I mean without need to use settings dialog) disable . to -> behaviour. For example it is annoying in cases when we use smart pointers such as:
shared_ptr<MyClass> mcP(MyClass::Create(...));
if (!mcP.empty())
{
...
}
When I write "if (!mcP.", VA X replaces "." by "->" because -> operator is overloaded, but in this case it is not wanted, so it would be fine, if for example CTRL or ALT key could disable this behaviour, so that if I press [CTRL + .], or [ALT + .], it places "." without replacing it by "->".
Is this now possible? |
Edited by - Dusan on Oct 10 2013 3:48:43 PM |
|
feline
Whole Tomato Software
    
United Kingdom
19113 Posts |
Posted - Oct 10 2013 : 6:45:18 PM
|
Not currently. If you press Backspace the conversion will be undone, leaving you with the dot you first typed.
We are considering a feature to allow the dot to be recreated by typing a second dot:
case=1983
which would be a second method, if and when this is done.
If you only want to stop the conversion occasionally you could try disabling VA, then enabling VA again afterwards. This can be done via the VAssistX IDE menu, or mapping a keyboard shortcut to the command VAssistX.EnableDisable
If you never want VA to do this conversion for this class, then it should be easy enough to hide the overloaded operator function from VA. This simple example shows one method of doing so:
template <class T>
class SmartPtrTestHideOperator
{
public:
#ifdef VA_HELPER_CODE
#define VA_HIDE_HIDE_OPERATOR_FUNCTION SmartPtrTestHideOperator()
#else
#define VA_HIDE_HIDE_OPERATOR_FUNCTION T *operator->()
#endif
VA_HIDE_HIDE_OPERATOR_FUNCTION
{
return ptr;
}
private:
T *ptr;
};
|
zen is the art of being at one with the two'ness |
 |
|
eduard
Junior Member
 
19 Posts |
Posted - Oct 16 2013 : 03:18:19 AM
|
i really like the second-dot idea. |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19113 Posts |
Posted - Oct 16 2013 : 11:33:30 AM
|
The second dot is an idea we are considering, but I don't currently have an estimate for when, or if this will be done. |
zen is the art of being at one with the two'ness |
 |
|
foxmuldr
Tomato Guru
    
USA
427 Posts |
Posted - Oct 17 2013 : 12:14:37 PM
|
I third the second-dot idea. :-) |
 |
|
mwb1100
Ketchup Master
   
82 Posts |
Posted - Oct 18 2013 : 12:13:57 AM
|
+1 from me as well - and you might want to consider collapsing ".." to a single "." even when the variable's type doesn't support an overloaded "->". That way you can simply get used to typing ".." in all cases.
|
 |
|
feline
Whole Tomato Software
    
United Kingdom
19113 Posts |
Posted - Oct 18 2013 : 11:31:08 AM
|
mwb1100 just turn off one or both of:
VA Options -> Advanced -> Correction -> Convert dot to -> (only in C/C++ files) VA Options -> Advanced -> Correction -> Convert dot to -> if operator -> is overloaded
then you only have to type a single dot in all cases 
Plus we would have to be a little careful handling .. in general cases, since there are times and places where you need to type "..." Not often, I know, but it does happen. |
zen is the art of being at one with the two'ness |
 |
|
|
Topic  |
|