Re-organize the function ioPrintCellPage such that there is separation of concern

Separate out the disp and display function from services/io

Stop propagating the isDisplay flag

Audit functions which use the isDisplay flag

Understand how and why the isDisplay flag is being used

Come up with an approach to remove the use of isDisplay flag

Define a context class to distinguish disp from display instead of relying on a boolean flag

Make changes to the ContainedDisplayInterface class to respond to the new context class

Define 2 methods to get the container open and close delimiters, which depends on the context

Define 2 methods to get the delimiters for the contained value which DOES NOT depend on the context

Modify the getEmptyRepresentation method to return a custom empty representation depending on the context

Add a method isPaddingRequired , for the container to determine when padding spaces must be added for alignment

Provide a new API to get the old cell disp

Legend

Make the corresponding changes to CellOrStructDisplayWrapper and stringDisplayWrapper

Add a new exported function ioPrintOldCellDisp

Expose this to MATLAB as a packaged builtin function matlab.internal.display.getOldCellDisp

Add a new subclass of COSMethodInfo named OldCellDispHelperMI in mcos_impl/cos_interface/matlab_interf.hpp

Register this packaged function in registerPackageFunctions defined in mcos_impl/cos_interface/matlab_interf.cpp

Update the functions in printmat.cpp and printca.cpp to use the new methods instead of relying on the isDisplay flag

Update ioRenderCustomCompactDisplayInCell and ioComputeCompactDisplayWidthInCell to not hard code the delimiters for classes having a custom contained representation

Update ioPrintCellPage to return the display output instead of printing it right away

Update ioPrintCellPage and ioGetColumnWidth so that they do not hard code the delimiters and the empty representation.

Update ioPrintCellMember and ioPrintStringCellMember so that they do not rely on the isDisplay flag and they do not hard code the delimiters and they also do not hard code the number of padding spaces

Update ioPrintCellPage such that it passes the printing context to ioGetColumnWidth and ioPrintCellMember

Update ioPrintContainerArray to generate a printing context and pass this to ioPrintCellPage

Clean up the implementation so that there are no performance regressions

Consider using std::make_shared instead to initialize the shared_ptr .

Consider passing in the stream buffer and writing to it instead of accumulating the output and then writing it

Stress test the changes to check if memory utilization is a concern

Consider passing the stream to ioPrintCellPage instead of accumulating the output and sending it back

Update the following functions to accept an fl::io::uostream&: ioPrintCellPage, ioPrintOldCellDisp, ioPrintContainerArray, ioCellPagePrintingFunction. Update the header files and the cpp files.

Update ioCellPagePrintingFunction to pass the output stream to ioPrintCellPage. Also update it such that it does not return an fl::ustring and instead accepts a stream.text