winIDEA SDK
isys::CLineDescription Class Reference

Description

This adapter class contains line description based on file/line contents not on line number.

It is used to to define source code line, which location may change when source file is modified.

#include <CAddressController.h>

Public Types

enum  EResourceType {
  E_RESOURCE_FUNCTION , E_RESOURCE_FILE ,
  E_RESOURCE_ADDRESS
}
 Type of resource, where test point is located. More...
 
enum  ESearchContext {
  E_SEARCH_ANY , E_SEARCH_CODE ,
  E_SEARCH_COMMENT
}
 Defines which part of source file is searched for pattern. More...
 
enum  EMatchingType { E_MATCH_PLAIN , E_MATCH_REG_EX , E_MATCH_TEST_POINT_ID }
 Defines type of pattern matching. More...
 
enum  EFileLocation { ELocalHost , EWinIDEAHost }
 Defines where to get source code from. More...
 

Public Member Functions

 CLineDescription (EResourceType resourceType, std::string resourceName, int line, bool isSearch, int linesRange, ESearchContext searchContext, EMatchingType matchingType, std::string searchPattern, int lineOffset, EFileLocation fileLocation=ELocalHost)
 Instantiates this class. More...
 
EResourceType getResourceType ()
 Returns type of resource for which location is given.
 
std::string getResourceName ()
 Returns name of resource where test point is located.
 
int getLine ()
 Returns line number, where test point is set, or where search range starts (if pattern is defined). More...
 
bool isSearch ()
 Returns true, if search is to be performed. More...
 
int getLinesRange ()
 Returns the number of lines, which are searched for pattern. More...
 
ESearchContext getSearchContext ()
 Returns search context for pattern.
 
EMatchingType getMatchingType ()
 Returns matching type for pattern.
 
std::string getSearchPattern ()
 Returns search pattern. More...
 
int getLineOffset ()
 Returns the number of lines, which are added to line found by search pattern above.
 
EFileLocation getFileLocation ()
 Returns source location.
 
std::string toString ()
 Returns contents of object as string. More...
 

Member Enumeration Documentation

◆ EFileLocation

Defines where to get source code from.

If winIDEA is running on the same host as testIDEA or script, then this setting has no effect.

Enumerator
ELocalHost 

get source code from host, where testIDEA or script using SDK is running

EWinIDEAHost 

get source code from host, where winIDEA is running

◆ EMatchingType

Defines type of pattern matching.

Enumerator
E_MATCH_PLAIN 

plain string matching is done anywhere in the line

E_MATCH_REG_EX 

pattern is regular expression

◆ EResourceType

Type of resource, where test point is located.

Enumerator
E_RESOURCE_FUNCTION 

lines are given relative to function

E_RESOURCE_FILE 

lines are given relative to file

E_RESOURCE_ADDRESS 

location is defined by address as string in resource name.

◆ ESearchContext

Defines which part of source file is searched for pattern.

Enumerator
E_SEARCH_ANY 

all text is searched

E_SEARCH_CODE 

only source code is searched

E_SEARCH_COMMENT 

only single line comment is searched

Constructor & Destructor Documentation

◆ CLineDescription()

isys::CLineDescription::CLineDescription ( EResourceType  resourceType,
std::string  resourceName,
int  line,
bool  isSearch,
int  linesRange,
ESearchContext  searchContext,
EMatchingType  matchingType,
std::string  searchPattern,
int  lineOffset,
EFileLocation  fileLocation = ELocalHost 
)
inline

Instantiates this class.

Parameters
resourceTypedefines where to look for location
resourceNamename of file or function, depending on the first parameter
lineline in file or function, 0-based. If isSearch is true, this is line where search is started
isSearchif true, line with the specified pattern is searched
linesRangehow many lines to search. Set it to 0 for no limit (till the end of file)
searchContextsee CLineDescription::ESearchContext
matchingTypesee CLineDescription::EMatchingType
searchPatterntext pattern to search in lines, format depends on matchingType
lineOffsetthe number of lines to add to the found line
fileLocationdefines where to look for source files - on local host running the script, or on remote host running winIDEA. If winIDEA is running on the same host as script, use the default value.

Member Function Documentation

◆ getLine()

int isys::CLineDescription::getLine ( )
inline

Returns line number, where test point is set, or where search range starts (if pattern is defined).

Lines for file are 1-based, while lines for function are 0 based and can also be negative.

◆ getLinesRange()

int isys::CLineDescription::getLinesRange ( )
inline

Returns the number of lines, which are searched for pattern.

Value 0 means till the end of file.

◆ getSearchPattern()

std::string isys::CLineDescription::getSearchPattern ( )
inline

Returns search pattern.

If this item is not defined (empty string is returned), then test point is located in line returned by getLine(). No search is performed. Num lines, search context, and matching type are ignored.

◆ isSearch()

bool isys::CLineDescription::isSearch ( )
inline

Returns true, if search is to be performed.

Otherwise the line number returned by getLine() is used to set a test point.

◆ toString()

std::string isys::CLineDescription::toString ( )
inline

Returns contents of object as string.

Use this for logging/debugging purposes only.