Isolator

What is Isolator?

Isolator tool isolates the whole code from a given function or class inside destination code and replaces the isolated function or class from source code inside destination code. It consists of two parts, IsolateFunction and IsolateClass.

Commands:

Isolate Function

isolate f source.cpp destination.cpp "function prototype"

Isolate Class

isolate c source.cpp destination.cpp "class class-name"

By default, it only isolates the class with its member functions' implementation. Adding the option '-all' gives more options:

How does it work?

Isolator will search for the desired function\class inside source.cpp and take a copy of it, after that it will search for the desired function\class inside destination.cpp and inserts it in the appropriate place as described below. Searching for a function or class depends on signature matching.

Where it will be inserted?

Isolate fucntion:

Non-member function:

Function's prototype will be inserted in the beginnig of the code, and function's implementation will be inserted at the end of the code.

Member function:

Isolate Class:

Class found in destination code:

Original class will be commented and the copied class from source.cpp will be pasted in the exact place of the original class in detination.cpp

Class not found in destination.cpp:

The copied class from source.cpp will be pasted at the end of detination.cpp

Error Scenarios:

The following cases outputs an error message

Isolate Function:

Non-member Functions:

Member Functions:

Isolate Class:

Class:

Struct:

Note

While isolating a member function, writing the class on one lines results with errors. Please write the class on at least 2 lines. Write the class on 2 lines or more inside your .cpp file
DON'T:
class x{}
DO:
class x{
}

For reference on how to write functions' parameters, please check the reference page