VirtualBox

Changeset 94347 in vbox


Ignore:
Timestamp:
Mar 24, 2022 8:13:03 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
150653
Message:

Main/Unattended: ​​bugref:9781. Extending GeneralTextScript with the functionality to append a new line.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/TextScript.h

    r93115 r94347  
    231231    HRESULT prependToLine(size_t idxLine, const Utf8Str &rStrToPrepend);
    232232
     233    /**
     234     * Append a new line at the end of the list of line.
     235     */
     236    HRESULT appendLine(const Utf8Str &rStrLineToAppend);
    233237    //////////////////New functions//////////////////////////////
    234238};
     
    236240
    237241#endif /* !MAIN_INCLUDED_TextScript_h */
    238 
  • trunk/src/VBox/Main/src-all/TextScript.cpp

    r93115 r94347  
    194194HRESULT GeneralTextScript::parse()
    195195{
    196 //  AssertReturn(!mfDataParsed, mpSetError->setErrorBoth(E_FAIL, VERR_WRONG_ORDER, tr("parse called more than once")));
     196    AssertReturn(!mfDataParsed, mpSetError->setErrorBoth(E_FAIL, VERR_WRONG_ORDER, tr("parse called more than once")));
    197197
    198198    /*
     
    363363}
    364364
     365HRESULT GeneralTextScript::appendLine(const Utf8Str &rStrLineToAppend)
     366{
     367    AssertReturn(mfDataParsed, mpSetError->setErrorBoth(E_FAIL, VERR_WRONG_ORDER, tr("appendLine() called before parse()")));
     368
     369    try
     370    {
     371        mScriptContentByLines.append(rStrLineToAppend);
     372    }
     373    catch (std::bad_alloc &)
     374    {
     375        return E_OUTOFMEMORY;
     376    }
     377    return S_OK;
     378
     379}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette