Open Search
    TextToolsInterface Class Reference

    #include <texttools.h>

    Detailed Description

    An interface that provides multiple functions to load text, dox pages and code snippets.

    Static Public Member Functions

    static MAXON_METHOD Result< void > GetAllFiles (const Url &folder, BaseArray< Url > &files)
     
    static MAXON_METHOD Result< void > GetFileContent (const Url &file, BaseArray< String > &content)
     
    static MAXON_METHOD Result< void > LoadDoxPages (const BaseArray< Url > &files, BaseArray< DoxPage > &doxPages, BaseArray< Issue > &issues)
     
    static MAXON_METHOD Result< BoolGetIDAndTitle (const String &line, const String &symbol, String &id, String &title, BaseArray< Issue > &issues)
     
    static MAXON_METHOD Result< void > LoadCodeSnippets (const BaseArray< Url > &files, BaseArray< CodeSnippet > &snippets, BaseArray< Issue > &issues)
     
    static MAXON_METHOD Result< void > LoadPathsFromFile (const Url &configFile, BaseArray< Url > &doxFiles, BaseArray< Url > &sourceFiles)
     
    static MAXON_METHOD Result< BoolCheckDoubleSpaces (const String &text)
     
    static MAXON_METHOD Result< BoolCheckDoubleWords (const String &text, String &doubleWord)
     
    static MAXON_METHOD Result< BoolCheckSpaceAtEnd (const String &text)
     
    static MAXON_METHOD Result< IntGetLineNesting (const String &text)
     
    static MAXON_METHOD Result< void > GetMaxCodeNesting (const String &text, Int &nesting, Int &maxNesting)
     
    static MAXON_METHOD Result< void > GetCyclomaticComplexity (const String &text, Int &complexity)
     
    static MAXON_METHOD Result< IntGetIfStatementComplexity (const String &text)
     
    static MAXON_METHOD Result< IntGetMaxPointerNesting (const String &text)
     

    Private Member Functions

     MAXON_INTERFACE_NONVIRTUAL (TextToolsInterface, MAXON_REFERENCE_NONE, "net.sdktools.interfaces.texttools")
     

    Member Function Documentation

    ◆ MAXON_INTERFACE_NONVIRTUAL()

    MAXON_INTERFACE_NONVIRTUAL ( TextToolsInterface  ,
    MAXON_REFERENCE_NONE  ,
    "net.sdktools.interfaces.texttools"   
    )
    private

    ◆ GetAllFiles()

    static MAXON_METHOD Result<void> GetAllFiles ( const Url folder,
    BaseArray< Url > &  files 
    )
    static

    Fills the given array with the absolute path of all files found in the folder and its sub-folders.

    Parameters
    [in]folderA folder to parse.
    [out]filesA BaseArray filled with the paths to all files in the folder and sub-folders.
    Returns
    OK on success.

    ◆ GetFileContent()

    static MAXON_METHOD Result<void> GetFileContent ( const Url file,
    BaseArray< String > &  content 
    )
    static

    Reads the content of the given file.

    Parameters
    [in]fileThe absolute path of the file to load.
    [out]contentThe content of the file. Each line is loaded as an element of the array.
    Returns
    OK on success.

    ◆ LoadDoxPages()

    static MAXON_METHOD Result<void> LoadDoxPages ( const BaseArray< Url > &  files,
    BaseArray< DoxPage > &  doxPages,
    BaseArray< Issue > &  issues 
    )
    static

    Loads the Dox pages from the given files.

    Parameters
    [in]filesThe files to check for Dox pages.
    [out]doxPagesThe array of found DoxPages
    [out]issuesThe array of issues found while searching for Dox pages.
    Returns
    OK on success.

    ◆ GetIDAndTitle()

    static MAXON_METHOD Result<Bool> GetIDAndTitle ( const String line,
    const String symbol,
    String id,
    String title,
    BaseArray< Issue > &  issues 
    )
    static

    Searches for the given symbol in the given file. E.g. "@section" to get the section ID and title.

    Parameters
    [in]lineThe line of text or code.
    [in]symbolThe symbol to search for.
    [out]idThe id of the symbol.
    [out]titleThe title of the symbol.
    [out]issuesIssues found while looking for the symbol.
    Returns
    True if the symbol was found in the line.

    ◆ LoadCodeSnippets()

    static MAXON_METHOD Result<void> LoadCodeSnippets ( const BaseArray< Url > &  files,
    BaseArray< CodeSnippet > &  snippets,
    BaseArray< Issue > &  issues 
    )
    static

    Loads the code snippets in the given source code files.

    Parameters
    [in]filesAn array of source code file paths.
    [out]snippetsAn array to store all found code snippets.
    [out]issuesAn array to store all issues found while searching for code snippets.
    Returns
    OK on success.

    ◆ LoadPathsFromFile()

    static MAXON_METHOD Result<void> LoadPathsFromFile ( const Url configFile,
    BaseArray< Url > &  doxFiles,
    BaseArray< Url > &  sourceFiles 
    )
    static

    Loads all files from the paths defined in the given config file. Accepts: "DOX:c:\something" for Dox files. "SOURCE:c:\something" for source code files.

    Parameters
    [in]configFileThe text file containing absolute folder paths
    [out]doxFilesAn array to store all files found in the "DOX" folder paths.
    [out]sourceFilesAn array to store all files found in the "SOURCE" folder paths.
    Returns
    OK on success.

    ◆ CheckDoubleSpaces()

    static MAXON_METHOD Result<Bool> CheckDoubleSpaces ( const String text)
    static

    Checks for double spaces " " in the given line. Will not check for spaces at the beginning or end (applies Trim()).

    Parameters
    [in]textThe line to analyse.
    Returns
    True if double spaces have been found.

    ◆ CheckDoubleWords()

    static MAXON_METHOD Result<Bool> CheckDoubleWords ( const String text,
    String doubleWord 
    )
    static

    Checks for double words like "This is the the source code."

    Parameters
    [in]textThe line to analyse.
    [out]doubleWordThe first found double word.
    Returns
    True if double words have been found.

    ◆ CheckSpaceAtEnd()

    static MAXON_METHOD Result<Bool> CheckSpaceAtEnd ( const String text)
    static

    Checks for a space " " at the end of the line.

    Parameters
    [in]textThe line to analyse.
    Returns
    True if there is space at the end of the line.

    ◆ GetLineNesting()

    static MAXON_METHOD Result<Int> GetLineNesting ( const String text)
    static

    Returns the deepest line-nesting. E.g. "X = A(B(C()), D())" returns 3.

    Parameters
    [in]textThe line to analyse.
    Returns
    The deepest line-nesting.

    ◆ GetMaxCodeNesting()

    static MAXON_METHOD Result<void> GetMaxCodeNesting ( const String text,
    Int nesting,
    Int maxNesting 
    )
    static

    Calculates the code nesting for the given line. Must be applied to every line of a code snippet.

    Parameters
    [in]textThe current line of code.
    [in,out]nestingThe current nesting level.
    [in,out]maxNestingCurrent max. nesting level. If the current level is deeper, it is overwritten.
    Returns
    OK on success.

    ◆ GetCyclomaticComplexity()

    static MAXON_METHOD Result<void> GetCyclomaticComplexity ( const String text,
    Int complexity 
    )
    static

    Calculates the cyclomatic complexity. Must be applied to every line of a code snippet.

    Parameters
    [in]textThe current line of code.
    [in,out]complexityThe incremental complexity value.
    Returns
    OK on success.

    ◆ GetIfStatementComplexity()

    static MAXON_METHOD Result<Int> GetIfStatementComplexity ( const String text)
    static

    Returns the complexity of an "if (" statement. Checks for ||, ==, !=, <=, >=

    Parameters
    [in]textThe current line of code.
    Returns
    The complexity of the "if (" statement. 0 of no "if (" statement.

    ◆ GetMaxPointerNesting()

    static MAXON_METHOD Result<Int> GetMaxPointerNesting ( const String text)
    static

    Calculates the pointer nesting for the given line. E.g. A()->B()->C();

    Parameters
    [in]textThe current line of code.
    Returns
    The pointer nesting or 0 if no code.