Kdevelop4/Manual/Meet KDevelop/ru: Difference between revisions

From KDE UserBase Wiki
(Created page with "{{Input|<syntaxhighlight lang="cpp"> Car my_ride; // ...делаем что-нибудь с этой переменной... std::string color = my_ride.ge </syntaxhighlight>}}")
(Created page with "'''KDevelop''' запомнит что <code>my_ride</code> в последней строке является переменной типа <code>Car</code> и предложи...")
Line 23: Line 23:
</syntaxhighlight>}}
</syntaxhighlight>}}


it will have remembered that <code>my_ride</code> in the last line is a variable of type <code>Car</code> and offer you to complete <code>ge</code> as <code>get_color()</code> since this is the only member function of the <code>Car</code> class that starts like this. Instead of continuing to type you just hit <keycap>Enter</keycap> to get the full word; this saves typing, avoids typos, and doesn't require you to remember the exact names of the hundreds or thousands of functions and classes that make up large projects.  
'''KDevelop''' запомнит что <code>my_ride</code> в последней строке является переменной типа <code>Car</code> и предложит завершить <code>ge</code> на <code>get_color()</code>, так как это единственный метод класса <code>Car</code>, который начинается с введённых символов. Вместо набора всего имени функции Вам достаточно нажать <keycap>Enter</keycap> и подставится её полное имя. Это экономит Ваше время, позволяет избежать опечаток и избавляет от необходимости помнить сотни и тысячи функций и классов, которые содержатся в больших проектах.  


As a second example, assume you have code like this:
As a second example, assume you have code like this:

Revision as of 05:12, 17 September 2011

Что такое KDevelop?

KDevelop — это современная интегрированная среда разработки (IDE) для C++ (и иных языков программирования) входящая во множество приложений KDE. Она используется в основном для Linux (работает даже если Вы используете другие окружения рабочего стола, например GNOME) доступна и для множества иных вариантов Unix систем, а так же Windows.

KDevelop предлагает все удобства современного IDE. Для больших проектов и приложений самой важной особенностью является то, что KDevelop понимат C++: он анализирует весь исходный код и запоминает какие функции (методы) в каких классах определены, где были определены переменные, какие у них типы и многие другие особенности Вашего исходного кода. Например предположим что один из заголовочных файлов вашего проекта определяет класс:

class Car {
  // ...
  public:
    std::string get_color () const;
};

и далее в Вашей программе Вы написали

Car my_ride;
// ...делаем что-нибудь с этой переменной...
std::string color = my_ride.ge

KDevelop запомнит что my_ride в последней строке является переменной типа Car и предложит завершить ge на get_color(), так как это единственный метод класса Car, который начинается с введённых символов. Вместо набора всего имени функции Вам достаточно нажать Enter и подставится её полное имя. Это экономит Ваше время, позволяет избежать опечаток и избавляет от необходимости помнить сотни и тысячи функций и классов, которые содержатся в больших проектах.

As a second example, assume you have code like this:

double foo ()
{
  double var = my_func();
  return var * var;
}

double bar ()
{
  double var = my_func();
  return var * var * var;
}

If you hover the mouse over the symbol var in function bar you get the option to see all uses of this symbol. Clicking on it will only show you the uses of this variable in function bar because KDevelop understands that the variable var in function foo has nothing to do with it. Similarly, right clicking on the variable name allows you to rename the variable; doing so will only touch the variable in bar but not the one with the same name in foo.

But KDevelop is not just an intelligent code editor; there are other things KDevelop does well. Obviously, it highlights the source code in different colors; it has a customizable indenter; it has an integrated interface to the GNU debugger gdb; it can show you the documentation for a function if you hover the mouse over a use of this function; it can deal with different kinds of build environments and compilers (e.g. with make and cmake-based project), and many other neat things that are discussed in this manual.