Author Topic: why isn't showed in Intellegence list?  (Read 6704 times)

Offline cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
why isn't showed in Intellegence list?
« on: October 07, 2014, 09:31:31 pm »
i did the property class. i create variables from it, in a new class. why that new class variables, the properties, aren't showed in Intellegence list?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: why isn't showed in Intellegence list?
« Reply #1 on: October 08, 2014, 02:02:56 am »
If you don't post minimal example which shows that the problem can be reproduced with the latest night build then we can hardly do something about it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
Re: why isn't showed in Intellegence list?
« Reply #2 on: October 08, 2014, 09:21:49 am »
i have these property class:
Code
/*properties

- how use create 1 property with macro:

      PROPERTY(TypeName,PropertyName,getfunction, setfunction)

- never forget to do 1 Copy Constructor inside of class's, that uses the property,
         for avoid copy the 'this' value\adress and use a diferent memory adress
*/
template <typename T>
class property
{
private:
    T PropertyValue;
    std::function<T(void)> getf;
    std::function<void(T)> setf;
public:

    property(const T value)
    {
        getf=nullptr;
        setf=nullptr;
        PropertyValue=value;
    };

    property(const property &value)  :  PropertyValue(value.PropertyValue) , getf(value.getf)
    {
    }

    property(std::function<T(void)> GetFunction=nullptr,std::function<void(T)> SetFunction=nullptr)
    {
        setf=SetFunction;
        getf=GetFunction;
    }

    property& operator=(const T &value)
    {
        PropertyValue=value;
        if (setf!=nullptr)
            setf(value);
        return *this;
    }

    property& operator=(const property &value)
    {
        PropertyValue = value.PropertyValue;
        if (setf!=nullptr)
            setf(PropertyValue);
        return *this;
    }

    operator T()
    {
        if (getf!=nullptr)
            return getf();
        else
            return PropertyValue;
    }

    friend ostream& operator<<(ostream& os, property& dt)
    {
        if(dt.getf==nullptr && dt.setf==nullptr)
            os << dt.PropertyValue;
        else if (dt.getf!=nullptr)
            os << dt.getf();
        return os;
    }

    friend istream& operator>>(istream &input, property &dt)
    {
        input >> dt.PropertyValue;
        if (dt.setf!=nullptr)
            dt.setf(dt.PropertyValue);
        return input;
    }

    friend istream &getline(istream &in, property &dt)
    {
        getline(in, dt.PropertyValue);
        if (dt.setf!=nullptr)
            dt.setf(dt.PropertyValue);
        return in;
    }
};

/*template<typename T, typename Fnc1_t, typename Fnc2_t, typename classthis>
property<T> GetProperty(Fnc1_t Getter, Fnc2_t Setter, classthis clsthis)
{
    return property<T>(std::bind(Getter, clsthis), std::bind(Setter, clsthis, std::placeholders::_1));
}

#define PROPERTY(TypeName,PropertyName,getfunction, setfunction) \
property<TypeName> PropertyName{std::bind(&getfunction, *this),std::bind(&setfunction, *this, std::placeholders::_1)}*/
#define Get(x) [this]()->x
#define Set(...) [this](__VA_ARGS__)->void
now i'm add some members on a new class:
Code
class form
{
public:
property <boolean> TabStop
        {
            Get(boolean)
            {
                return blnTabStop;
            },
            Set(boolean tabstop)
            {
                if (blnTabStop != tabstop)
                {
                    blnTabStop = tabstop;
                    long s;
                    if (tabstop == false)
                    {
                        s = GetWindowLongPtr(hwnd, GWL_STYLE);
                        s = s & ~(WS_TABSTOP);
                    }
                    else
                    {
                        s = GetWindowLongPtr(hwnd, GWL_STYLE);
                        s = s | (WS_TABSTOP);
                    }
                    SetWindowLongPtr(hwnd, GWL_STYLE, (LONG_PTR)s);
                }
            }
        };

        property <int> Mousehover
        {
            Get(int)
            {
               return intMouseHover;
            },
            Set(int mousehover)
            {
                intMouseHover = mousehover;
            }
        };
};
when i do:
Code
form a;
a.
why the Mousehover and TabStop aren't showed in Intelligence List?(when we write the dot, a list is showed)

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: why isn't showed in Intellegence list?
« Reply #3 on: October 08, 2014, 03:07:44 pm »
why the Mousehover and TabStop aren't showed in Intelligence List?(when we write the dot, a list is showed)

Is your comma-notation and functions without retyrn type proper C++ syntax? I am guessing this would confuse C::B

you have
       property <int> Mousehover
        {
            Get(int)
            {
               return intMouseHover;
            },
            Set(int mousehover)
            {
                intMouseHover = mousehover;
            }
        };


I would guess you need something like (observe comma removed, return types added)
       property <int> Mousehover
        {
            int Get()
            {
               return intMouseHover;
            }
            void Set(int mousehover)
            {
                intMouseHover = mousehover;
            }
        };

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: why isn't showed in Intellegence list?
« Reply #4 on: October 08, 2014, 03:28:37 pm »
i have these property class:
**snip**
**snip**
why the Mousehover and TabStop aren't showed in Intelligence List?(when we write the dot, a list is showed)
Hi, cambalinho.
Our CodeCompletion's parser currently doesn't have the ability to parse the new C++ grammar like "[this]()->x". (I don't understand those grammar too :)), so you code are not parsed correctly. Two solutions:
1, help us to improve, if you have ability to read the CodeCompletion's source code, you will see that we have very limited C++ semantic check when parsing, in-fact, C++ language is very hard to parse, see: Why is C++ grammar so hard to parse? - Quora or many other related discussions.

2, you can use some external tools currently like Clang codecompletion, our developer Alpha have implement such plugin, see: Clang based CC, new CC interface. Note Clang is a full compiler suite, so it has the ability to parse very complex C++ source code and give your very precise code suggestion. I'm not use Clang quite often, maybe, its speed is not very good, you can follow that thread for more informations.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
Re: why isn't showed in Intellegence list?
« Reply #5 on: October 08, 2014, 05:03:48 pm »
why the Mousehover and TabStop aren't showed in Intelligence List?(when we write the dot, a list is showed)

Is your comma-notation and functions without retyrn type proper C++ syntax? I am guessing this would confuse C::B

you have
       property <int> Mousehover
        {
            Get(int)
            {
               return intMouseHover;
            },
            Set(int mousehover)
            {
                intMouseHover = mousehover;
            }
        };


I would guess you need something like (observe comma removed, return types added)
       property <int> Mousehover
        {
            int Get()
            {
               return intMouseHover;
            }
            void Set(int mousehover)
            {
                intMouseHover = mousehover;
            }
        };

if you can give me the right macro.. i accept ;)
heres the Get and Set macros:
Code
#define Get(x) [this]()->x
#define Set(...) [this](__VA_ARGS__)->void

Offline cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
Re: why isn't showed in Intellegence list?
« Reply #6 on: October 08, 2014, 05:05:00 pm »
i have these property class:
**snip**
**snip**
why the Mousehover and TabStop aren't showed in Intelligence List?(when we write the dot, a list is showed)
Hi, cambalinho.
Our CodeCompletion's parser currently doesn't have the ability to parse the new C++ grammar like "[this]()->x". (I don't understand those grammar too :)), so you code are not parsed correctly. Two solutions:
1, help us to improve, if you have ability to read the CodeCompletion's source code, you will see that we have very limited C++ semantic check when parsing, in-fact, C++ language is very hard to parse, see: Why is C++ grammar so hard to parse? - Quora or many other related discussions.

2, you can use some external tools currently like Clang codecompletion, our developer Alpha have implement such plugin, see: Clang based CC, new CC interface. Note Clang is a full compiler suite, so it has the ability to parse very complex C++ source code and give your very precise code suggestion. I'm not use Clang quite often, maybe, its speed is not very good, you can follow that thread for more informations.
sorry i don't know how CodeCompletion works...

Offline edison

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: why isn't showed in Intellegence list?
« Reply #7 on: October 09, 2014, 02:44:58 pm »
The parsing speed of Clang CC plug-in is very very slow, but it works.
The build-in  CC of CB sometimes need to re-open the file and sometimes can not provide correct hint when enabled the std=c++11 switch with MinGW (http://forums.codeblocks.org/index.php/topic,19611.0.html).

Offline cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
Re: why isn't showed in Intellegence list?
« Reply #8 on: October 09, 2014, 03:42:41 pm »
edison: how can i found it and download it?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: why isn't showed in Intellegence list?
« Reply #9 on: October 09, 2014, 04:29:02 pm »
« Last Edit: October 09, 2014, 04:31:23 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
Re: why isn't showed in Intellegence list?
« Reply #10 on: October 09, 2014, 04:38:32 pm »

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: why isn't showed in Intellegence list?
« Reply #11 on: October 09, 2014, 07:09:16 pm »
e see h files and more.. but how install it?
https://github.com/alpha0010/ClangLib
What OS you are using?

Offline cambalinho

  • Multiple posting newcomer
  • *
  • Posts: 93
Re: why isn't showed in Intellegence list?
« Reply #12 on: October 09, 2014, 07:55:51 pm »

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: why isn't showed in Intellegence list?
« Reply #13 on: October 09, 2014, 08:11:54 pm »
Okay.  Then the easiest method would be to get nightly 9765 and extract precompiled ClangLib on top of it.

I have not updated that build recently, so compiling it yourself from source is always preferable and ensures you have the latest fixes, but that should be enough to provide you with a taste of how it currently functions.
Note: when using this plugin save often, it is still in its early stages, and can be slow and unstable.