1. 09 May, 2021 4 commits
    • Oliver Kellogg's avatar
    • Oliver Kellogg's avatar
      Fix crash reported in https://bugs.kde.org/show_bug.cgi?id=338649#c20 · 7d3eb053
      Oliver Kellogg authored
      related to multiple calls of m_source.unicode() where the calls return
      different address values.
      The solution is to call m_source.unicode() only once:
      - In class Lexer add private member m_src of type const QChar*.
      - In function Lexer::setSource,
        - assign m_source.unicode() to m_src;
        - if m_source.isEmpty() returns true then return without calling
      - In function Lexer::reset initialize m_src to null pointer.
      - In function Lexer::offset return m_src + offset.
      - In function Lexer::getOffset use m_src in lieu of src.
        This avoids the second call to m_source.unicode() which on newer Qt5
        versions may return a different buffer.
      CCBUG: 338649
    • Oliver Kellogg's avatar
      lib/cppparser/lexer.{h,cpp} cosmetics and error detection improvement: · 4cea2f59
      Oliver Kellogg authored
      - Move function bodies from header file to implementation file.
        - Token::Token(const QString & text)
        - Token::Token(int type, int position, int length, const QString& txt)
        - Token::Token(const Token& source)
        - Token& Token::operator = (const Token& source)
        - Token::operator int () const
        - bool Token::operator == (const Token& token) const
        - bool Token::isNull() const
        - int Token::type() const
        - void Token::setType(int type)
        - int Token::position() const
        - QString Token::text() const
        - void Token::setStartPosition(int line, int column)
        - void Token::setEndPosition(int line, int column)
        - void Token::getStartPosition(int* line, int* column) const
        - void Token::getEndPosition(int* line, int* column) const
        - void Token::setPosition(int position)
        - unsigned int Token::length() const
        - void Token::setLength(unsigned int length)
        - const CHARTYPE* Lexer::offset(int offset) const
        - int Lexer::getOffset(const QChar* p) const
        - Lexer::readWhiteSpaces(bool skipNewLine, bool skipOnlyOnce)
        - bool Lexer::recordComments() const
        - void Lexer::setRecordComments(bool record)
        - bool Lexer::recordWhiteSpaces() const
        - void Lexer::setRecordWhiteSpaces(bool record)
        - QString Lexer::source() const
        - int Lexer::index() const
        - void Lexer::setIndex(int index)
        - const Token& Lexer::nextToken()
        - const Token& Lexer::tokenAt(int n) const
        - const Token& Lexer::lookAhead(int n) const
        - int Lexer::tokenPosition(const Token& token) const
        - void Lexer::nextChar()
        - void Lexer::nextChar(int n)
        - void Lexer::readIdentifier()
        - bool isTodo(const QString& txt, int position); static in cpp file
        - bool isFixme(const QString& txt, int position); static in cpp file
        - void Lexer::readLineComment()
        - void Lexer::readMultiLineComment()
        - void Lexer::readCharLiteral()
        - void Lexer::readStringLiteral()
        - void Lexer::readNumberLiteral()
        - int Lexer::findOperator3() const
        - int Lexer::findOperator2() const
        - bool Lexer::skipWordsEnabled() const
        - void Lexer::setSkipWordsEnabled(bool enabled)
        - bool Lexer::preprocessorEnabled() const
        - void Lexer::setPreprocessorEnabled(bool enabled)
        - int Lexer::currentPosition() const
        - const QChar Lexer::currentChar() const
        - QChar Lexer::peekChar(int n) const
        - bool Lexer::eof() const
        - bool Lexer::reportWarnings() const
        - void Lexer::setReportWarnings(bool enable)
        - bool Lexer::reportMessages() const
        - void Lexer::setReportMessages(bool enable)
        - void Lexer::insertCurrent(const QString& str)
      - At Lexer function
          readWhiteSpaces(bool skipNewLine=true, bool skipOnlyOnce=false)
        change return type from void to bool, return false on EOF.
      - In Lexer::nextChar functions return immediately if m_ptr is beyond
      - In Lexer::readLineComment() break out of while-loop if
        currentPosition() returns error.
      - In Lexer::readMultiLineComment() break out of while-loop if
        currentPosition() returns error.
      - In Lexer::readCharLiteral() while-loop add safety check that
        currentPosition() returns valid position.
      - In Lexer::readStringLiteral() while-loop add safety check that
        currentPosition() returns valid position.
      - In Lexer functions findOperator3, findOperator2, insertCurrent add
        initial check that currentPosition() returns valid position.
      - In Lexer function getOffset return -1 for error (argument `p' out of
        range of `src').
      - In Lexer function nextToken,
        - return immediately if readWhiteSpaces() returns error;
        - return immediately if currentPosition() returns error.
      - In Lexer::tokenize() replace "for (;;)" loop by
        "while (currentPosition() >= 0)".
      - In Lexer::readArgument() return empty string if readWhiteSpaces()
        returns error.
      - In Lexer functions macroDefined, processDefine, processInclude,
        - return 0 if readWhiteSpaces() returns error;
        - return 0 if currentPosition() returns error.
      - In Lexer::macroMultiplyDivide() replace "for (;;)" loop by
        "while (readWhiteSpaces(false))".
      - In Lexer functions macroAddSubtract, macroRelational, macroEquality,
        macroBoolAnd, macroBoolXor, macroBoolOr, macroLogicalAnd,
        macroLogicalOr return result immediately if readWhiteSpaces() returns
      - In Lexer::macroExpression() return 0 if readWhiteSpaces() returns
    • Oliver Kellogg's avatar
      lib/cppparser/driver.cpp cosmetics in class Driver::ParseHelper : · af296cce
      Oliver Kellogg authored
      - At constructor insert linebreaks in member initializer list to avoid
        overlong line.
      - Factor constructor body into separate function init().
        Reason: Constructors shall be light weight to remove risk of
        calls before end of construction not acting as expected
        (dynamic dispatch will only work on fully constructed objects).
      - In order to do this, add member variables for use in the init
        - bool m_reportMessages  (assigned from ctor arg reportMessages);
        - QString m_includedFrom (assigned from ctor arg includedFrom).
      - Add member QString m_fileContent to capture return value from
        to remove risk of temporary QString object premature deconstruction
        at call to m_lex.setSource().
      - In Driver functions addDependence and parseFile call init() on
        local variable of type ParseHelper.
  2. 07 May, 2021 1 commit
  3. 30 Apr, 2021 2 commits
    • Oliver Kellogg's avatar
    • Oliver Kellogg's avatar
      Support C++11 "enum class" in C++ Import: · 464c7132
      Oliver Kellogg authored
      lib/cppparser/ast.{h,cpp} class EnumSpecifierAST
      - Add functions setClass, isClass accessing new member m_isClass of type
      - Add functions setEnumBase, enumBase accessing new member m_enumBase
        of type TypeSpecifierAST::Node.
      lib/cppparser/parser.cpp function parseEnumSpecifier
      - Add bool isClass initialized to false.
      - After consuming Token_enum add int tk initialized to
      - If tk is Token_class or Token_struct then set isClass true and call
      - After call to parseName(name) add variable enumBase of type
      - If m_lexer->lookAhead(0) is ':' then call nextToken() followed by
      - Reassign tk from m_lexer->lookAhead(0) and permit only ';' or '{' as
        its value.
      - Remove call to nextToken(), it is postponed to after the assignments
        to `ast'.
      - At assignments to `ast' call ast->setClass(isClass) and
  4. 28 Apr, 2021 2 commits
  5. 27 Apr, 2021 4 commits
  6. 25 Apr, 2021 1 commit
  7. 20 Apr, 2021 2 commits
  8. 14 Apr, 2021 1 commit
  9. 09 Apr, 2021 1 commit
  10. 05 Apr, 2021 2 commits
  11. 13 Mar, 2021 2 commits
  12. 03 Mar, 2021 2 commits
  13. 02 Mar, 2021 2 commits
  14. 09 Feb, 2021 2 commits
  15. 07 Feb, 2021 1 commit
  16. 17 Jan, 2021 2 commits
    • Oliver Kellogg's avatar
      In IDLWriter flesh out code generation for IDL union: · 1b35365e
      Oliver Kellogg authored
      - In function writeClass, if `stype' contains "Union" then
        - retrieve the classifier's attributes into local `atl';
        - pop first attribute off front of `atl' into local `discrim' and
          generate the "switch" type using discrim;
        - iterate over the remaining elements of `atl' and handle tags on
          each element (the tags are used for storing the union case labels
          or the "default" label) before printing each attribute.
      - Additional change in function writeClass: On handling Typedef fix
        crash when superclass is not set.
      CCBUG: 81301
    • Oliver Kellogg's avatar
      Small fixes for IDLImport: · 129ebb73
      Oliver Kellogg authored
      - In function createGeneralization(UMLClassifier*, UMLClassifier*), if
        child->umlPackage() is non null then
        - set UMLPackage of assoc to child->umlPackage();
        - add association at child instead of at Logical View.
      - In function skipStructure remove call to skipStmt().
        Reason: This is done by NativeImportBase::parseFile().
      - In function parseStmt handling of alias-typedef of non template type
        flesh out conveying of the existing type:
        - If oldType is found by m_doc->findUMLObject then use the returned
          UMLObject instead of creating a new one;
        - Create generalization from new classifier to existing classifier.
          Note that in case of alias-typedef of datatypes this does not show
          up yet in diagrams etc. because associations are not saved in class
          UMLDatatype. This is a TODO for future change.
               return true;
      - In function parseStmt handling of valuetype set the stereotype
        "idlValue" on m_klass.
  17. 16 Jan, 2021 3 commits
  18. 15 Jan, 2021 1 commit
  19. 14 Jan, 2021 4 commits
    • Oliver Kellogg's avatar
      Flesh out bounded string / bounded sequence handling in IDL import: · 54e6c2d9
      Oliver Kellogg authored
      - Add member m_doc of type UMLDoc* for conventiently accessing
      - In constructor initialize m_doc.
      - In function parseStmt keyword "typedef" handling of template types :
        - In case of «idlSequence» create newType as Class instead of as
          Datatype.  Reason: Umbrello does not currently support the menus and
          dialogs for adding/manipulating attributes of UMLDatatype.
        - Implement «idlSequence» / «idlString» stereotype attribute "bound"
          of type Uml::PrimitiveTypes::UnlimitedNatural.
          When applying «idlSequence», if the concrete tag value provided in
          UMLObject::tags() is empty then this means it is an unbounded
        - In case of «idlSequence» create an attribute "members" on newType.
          The type of the attribute is the origin type of the typedef (i.e.
        - Set the calculated stereotype on the newType object.
        - Append the extracted bound onto the tags() of the new type object.
      CCBUG: 81301
    • Oliver Kellogg's avatar
      - Merge release/20.12 @ d5b467cb to master for crash fix in umlscene.cpp · 4c2586ff
      Oliver Kellogg authored
      - In CMakeLists.txt preserve RELEASE_SERVICE_VERSION 21.03.70
    • Oliver Kellogg's avatar
      Change StereotypesModel member m_stereotypes from pointer to reference: · 959be508
      Oliver Kellogg authored
      - Change member m_stereotypes from pointer to reference.
      - At constructor change UMLStereotypeList argument from pointer to
      - Adjust code manipulating m_stereotypes to the above change.
      - In function addStereotype, if the passed in pointer is not found in
        m_stereotypes then compare the passed in stereotype's name to the
        names in m_stereotypes. If a match is found then do not add the
        pointer passed in.
      - In function removeStereotype, if the passed in pointer is not found in
        m_stereotypes then compare the passed in stereotype's name to the
        names in m_stereotypes:
        - If no match is found then return false without attempting removal.
        - If a match is found then remove the matching pointer.
      - In constructor, on initializing m_stereotypesModel pass m_stereoList
        to constructor of StereotypesModel by reference instead of address.
    • Oliver Kellogg's avatar
      Fixes for commit c7fdfefc saving of tagged values to XMI: · d6ff4174
      Oliver Kellogg authored
      - In function saveToXMI1 case !m_attrDefs.isEmpty() loop over m_attrDefs
        call writer.writeEndElement() to close the opened <UML:Attribute>.
      - In function save1end case m_TaggedValues.count(), after end of loop
        over m_TaggedValues call writer.writeEndElement() to close the opened
      CCBUG: 73847
  20. 11 Jan, 2021 1 commit
    • Oliver Kellogg's avatar
      Progress on IDL import: · 3388653c
      Oliver Kellogg authored
      - New function skipStructure skips to the end of a struct/union/
        valuetype/interface declaration.
      - New function isValidScopedName returns true if the argument conforms
        to IDL syntax for scoped names.
      - For processing unions add members m_isUnionDefault of type bool and
        m_unionCases of type QStringList.
      - In function fillSource remove compressing of sequence or bounded
        string into single lexeme.
      - In function parseStmt,
        - extend documentation;
        - make local `keyword' non const;
        - on setting stereotypes use prefix "idl" in lieu of "CORBA" for
          compatibility with IDL4;
        - start fleshing out union handling;
        - on handling "typedef" start fleshing out sequence and bounded
      CCBUG: 81301