classdef (Hidden = true) MATLABCodeWriter < rtw.connectivity.CodeWriter
%MATLABCODEWRITER This class provides code writing for the MATLAB
%programming language.
%
%   This is an undocumented class. Its methods and properties are likely to
%   change without warning from one release to the next.

%   Copyright 2011-2013 The MathWorks, Inc.
    
    
    
    properties(Access = protected)
        BlockStartString = ''
        BlockEndString = 'end'
        CommentStartString = '%'
        CommentEndString = ''
        IsLineComment = true
    end
    
    
    
    methods(Hidden)
        
        function this = MATLABCodeWriter(outWriter)
            this@rtw.connectivity.CodeWriter(outWriter);
        end
        
        
        function emitBlockMiddle(this, headStr, endLine)
        % EMITBLOCKMIDDLE This is a specialized implementation which does
        % not print the `end` to end the block. MATLAB is different in this
        % respect to the default implementation (which is closer to C-like
        % languages).
            
            oldIndent = this.IndentLevel;
            this.decIndent();
            
            this.indentOrSpace();
            
            this.IndentLevel = oldIndent;
            
            % No need to end or start the block just print the head (if any).
            if ~isempty(headStr)
                this.raw(headStr);
            end
            
            if endLine
                this.wNewLine();
            end
            
        end
        
    end
    
end
