Go to Codase Home
 Codase Source Code Search Engine Help
Home  
  1. Basic Concepts
  2. Search with Smart Query
  3. Search Method Call
  4. Search Method Definition
  5. Search Class Definition
  6. Search Class Field
  7. Search Variable
  8. Search Field Reference
  9. Search Free Text
  10. Search Inside Specific Project

1. Basic Concepts

Codase offers much more than simple text search, in order to take full advantage of its powerful features, you should be familiar with certain programming language concepts. Basically, codase breaks a stream of codes into meaningful programming language constructs, consisting of classes, methods, fields, constants and variables, each of which in turn has definitions and references.

Take the following HelloWorld.cpp sample,

1   #include "stdio.h"
2							
3   #define ONE 1                        <-- macro definition
4
5   class HelloWorld {                   <-- class definition
6   public:
7   void SetData(int d);
8
9   private:
10     int data;                         <-- field definition
11  };
12
13  void HelloWorld::SetData(int d) {    <-- method definition  
14     data = d;                         <-- field reference
15  }
16
17  int main(int argc, char* argv[]) {   <-- method definition
18     printf("Hello World.\n");         <-- method call, string
19     HelloWorld *h = new HelloWorld(); <-- variable
20     h->SetData(ONE);                  <-- method call, constant
21     return 0;
22  }

There are definitions, as shown in red,

  • class definition: HelloWorld , line 5 to 11,
  • method definition: SetData , line 13 to 15; main , line 17 to 22
  • field definition: data , line 10

    Inside the method definition of main, there are method calls, strings and constants:

  • method calls (shown in green), printf, line 18; new, line 19; SetData , line 20
  • strings, "Hello World.\n ", line 18
  • constant, ONE , line 20

    In general, we don't distinguish between methods and functions; all of them are referred as methods. Definition means where an element is first defined, whereas references mean the usages of the element. We use the word class in a loose manner, and it refers to classes, structs, enums, unions and interfaces.

    All of these language constructs can be searched with the corresponding search form. The tab on the top controls the type of element to search. When a + is present, it indicates more options are available, and you can enter more values to further constrain the search. On the right side is a drop down list for selecting the programming language to search. After at least one field is filled, you can then click the Search button or press the Enter key to start the search.

    Search Form

    When search is finished, code snippets are displayed, where you can examine results and browse through whole source files. Source codes are displayed using a smart code browsing system with highlights and syntax sensitive colors. Class, method and comment regions can be expanded and collapsed for you to easily focus on the most important portion of code.

    2. Search with Smart Query     Click here for complete documentation

    Smart query provides a powerful way for you to freely type queries to perform different kinds of searches. Our query parser processes the input and redirects to different types of searches, such as method calls, method definitions, class definitions, field definitions, field references, and variables. You can pretty much use this form to perform most of the searches as described in the following sections.

    Smart Query Search Form

    The above examples find any main method with arg type of string[] that contains a variable x and a method call println.

    Sample Searches

    These are a few sample queries. The

    1. Search the main function def, you can type: int main(int argc, char** argv) {}     click here
    2. Search fopen and fseek function calls, you can type: fopen; fseek;     click here
    3. Search code invokes any methods of javax.swing.JPanel, you can type: javax.swing.JPanel::?     click here

    The query need to conform to our syntax format, which is very similar to java/c++/c# programming languages. For a complete description on smart query, please read this document.

    3. Search Method Call

    You can use this form to search the invocation of an API, a function, a method defined in a class, or an operator. You can simply enter a name, or press the + to expand the form to enter more info on parameters, enclosing class, object instance, constants and number of parameters.

    Method Call Search Form

    Fields are described as below:

    Field Name Description Examples
    Method Name The name of the method call to search, including operators printf, socket, ToString, CreateWindow, <<, new
    Class/Namespace The enclosing class or namespace where the method is defined qstring, java.lang.Thread, std
    Return Type The return type of the method call void, char*, float, Thread
    Parameter Types The parameter types of the method call, using space as separator int char*, Thread int String
    Object Name The object or instance name the method call is exerted on. myobj, System.out
    Constants The constant names, usually enum or macro names, used inside the method. Multiple constants can be entered with space as separator SEEK_SET
    Number of Params Drop down list to select the number of parameters 3
    Sample Searches

    Note all fields are optional, the only requirement is that at least one field is filled with a value.

    1. Find code that invokes any methods defined in java.lang.String class, you only need to specify the Class/Namespace name, click here
    2. Find code that contains invocation of the << operator, click here
    3. Find code that invokes any method that takes 2 parameters of int types and returns int type, click here
    4. Find code that contains java.lang.Thread.Start method call, click here
    5. Find code that contains System.out.println method call, System.out needs to be entered into the Object Name field, click here
    6. Find code that contains fopen function call and macro constant SEEK_SET, click here

    4. Search Method Definition

    You can use this form to search the definition of a function, a method defined in a class, or an operator. You can simply enter a name, or press the + to expand the form to enter more info on parameters, enclosing class, and number of parameters.

    Method Call Search Form

    Fields are described as below:

    Field Name Description Examples
    Method Name The name of the method to search, including operators printf, socket, ToString, CreateWindow, <<
    Class/Namespace The enclosing class or namespace where the method is defined qstring, java.lang.Thread, std
    Return Type The return type of the method void, char*, float, Thread
    Parameter Types The parameter types of the method, using space as separator int char*, Thread int String
    Number of Params Drop down list to select the number of parameters 3
    Sample Searches

    Note all fields are optional, the only requirement is that at least one field is filled with a value.

    1. Find the CreateWindowExA method, click here
    2. Find any operators named as "<< ", click here
    3. Find any method that takes 2 parameters of int types and returns int type, click here
    4. Find any method that takes 10 parameters, click here

    5. Search Class Definition

    You can use this form to search the definition of a struct, a union, an enum, an interface, or a class. You can simply enter a name, or press the + to expand the form to enter more info on its parent class and its implementing interfaces. The HelloWorld class in our example can be found using this form.

    Class Definition Search Form

    Fields are described as below:

    Field Name Description Examples
    Class Name The name of the class to search HelloWorld, Thread, CString, Rect, color
    Inherit From The parent class name object, Window
    Interface(s) One or more interface names that the class implements Runnable, ICloneable, System.IServiceProvider
    Sample Searches

    Note all fields are optional, the only requirement is that at least one field is filled with a value.

    1. Find the SimpleTest class, click here
    2. Find all classes that inherits from object , click here
    3. Find all classed that implements the Runnable interface, click here  

    6. Search Class Field

    You can use this form to search the definition of a field defined in a class, an interface, a struct, a union or an enum. You can simply enter a name, or press the + to expand the form to enter more info on its type and its enclosing class. The data field defined in the HelloWorld class in our example can be found using this form.

    Class Field Search Form

    Fields are described as below:

    Field Name Description Examples
    Field Name(s) The name(s) of the field(s) to search data, width, height, x, red
    Type The type for the field int, String, single, double, char*
    Class/Namespace The enclosing class where the field is defined HelloWorld, Rect, color
    Sample Searches

    Note all fields are optional, the only requirement is that at least one field is filled with a value.

    1. Find the data field defined in any classes, click here
    2. Find all fields that has a type of float , click here
    3. Find all fields defined in  Rectangle struct, click here

    7. Search Variable

    You can use this form to search local variables used inside a method. You can simply enter a name, or press the + to expand the form to enter more info on the type of the variable and the method name where the variable is used. The h variable defined in the main method in our example can be found using this form.

    Variable Search Form

    Fields are described as below:

    Field Name Description Examples
    Variable Name(s) The name(s) of the variable(s) to search h, var1, o, tmp
    Type The type for the variable int, String, single, double, char*
    Method Name The name of the method where the variable is used main, <<, start, run
    Sample Searches

    Note all fields are optional, the only requirement is that at least one field is filled with a value.

    1. Find all variables named as var1  used in any methods, click here
    2. Find all variables that has a type of float , click here
    3. Find all variables of type string used in  main method, click here
    4. Find all usages of the variable  cout, cick here

    8. Search Field Reference

    Field reference is the invocation of a field, e.g, o->width = 20, width is a field reference. You can use this form to search field references. You can simply enter a name, or press the + to expand the form to enter more info on type, enclosing class, object instance, and method name.

    Field Reference Search Form

    Fields are described as below:

    Field Name Description Examples
    Field Name(s) The name(s) of the field(s) to search data, width, height, x, red
    Type The type of the field void, char*, float, Thread
    Class/Namespace The enclosing class or namespace where the field is defined qstring, java.lang.Thread, std
    Object Name The object or instance name the field reference is exerted on. myobj, System.out
    Method Name The name of the method where the field is used main, <<, start, run
    Sample Searches

    Note all fields are optional, the only requirement is that at least one field is filled with a value.

    1. Find all references of the data field defined in any classes, click here
    2. Find all references of any fields that has a type of float , click here
    3. Find all references of any fields defined in  Rectangle struct, click here
    4. Find all references of the data field defined in any classes that is used inside the main method, click here

    9. Search Free Text

    When you are not sure about which search form to use, you can always resort to the free text search, where you can type and find aything. You simply enter texts, in the same way as you use other general search engines.

    Free Text Search Form

    The drop down box in the middle lists the types of info you can search, and you can choose All to search all texts, or choose one category to refine the search. The following table describes these options:

    Category Description Examples
    All search all texts
    Project Name match project name wine
    File Name match source file names simpletest.cpp
    Literal
    Constant(s) enum constants or macro defines SEEK_SET
    Literal String literal strings, usually double quoted "hello world.\n"
    Keywords reserved words of programming languages typeof, while, for, try, throw, const
    Comments
    Comments all comments /* implementation of main */
    Comments for Class documentation comments for classes /** the String class */
    Comments for Method documentation comments for methods /// the Start method, /** the start method */ 
    Comments for Class Field documentation comments for fields /** the data field */, /// the data field in C#
    Class
    Class Name match class names Thread, CString, object
    Class Field Name match field names data, width, height, x
    Inside Class Field match any texts inside field definitions
    Method
    Method Name match method or operator names main, <<, start, Run
    Method Call Name match method call names printf, start, run, getName
    Macro
    Macro Definition macro define names in c/c++ #define ONE1
    Macro Reference macro names used as reference i = ONE + 1
    Variable & Field
    Variable Name match variable names tmp, var1, o, x, i
    Inside Variable match any texts inside variable names
    Field Reference Name match field names used as references o->width
    Inside Field Reference match any texts inside field references  

    For literal strings, keywords, comments and macro definitions, free text search is the only form to use. Free text search is easy to use, but comes with a price, namely, the returned code snippets may come in random portion of code, rather than in unit of method. In addition, it usually returns more entries compared to other type of searches. If you want to search class, method and field names, it's better to use other tabs to search.

    Sample Searches 
    1. Find macro definition of SEEK_SET, click here
    2. Find macro reference of SEEK_SET, click here
    3. Find keyword throw , click here
    4. Find literal string Hello World, click here
    5. Find constant red, click here
    6. Find make within any contexts, click here

    10. Search Inside Specific Project

    Codase provides an easy mechanism for you to constrain your search to a specific project. When search results are displayed, project info is included with each entry, and also on the right side a list of projects is displayed. There are two ways to constrain to a project,

    1. From the project list on right side, select and click a project, results will be filtered to display those entries that come from the selected project.

    2. From the displayed result entry, click a project name after Project:, you will come to the project info page, where Search In This Project can be clicked to search inside a specific project. Search forms are exactly same except the Search button is replaced with Search This Project button. When this is enabled, only results found from the specific project will be displayed.

      Free Text Search Form


  • What's New  |  Add Projects  |  Feedback  |  Tell a Friend  |  About Codase

    Copyright © 2006 Codase Inc.