using System;
using System.IO;
using System.Collections.Generic;
using System.Text;

using SysGen.RBuild.Framework;

namespace SysGen.BuildEngine.Framework
{
    public class CompilationUnitFileWriter : AutoGeneratedCFileWriter
    {
        private RBuildCompilationUnitFile m_CompilationUnit = null;

        public CompilationUnitFileWriter(RBuildModule module, RBuildCompilationUnitFile unit , string file)
            : base(module , file)
        {
            m_CompilationUnit = unit;
        }

        protected override void WriteHeader()
        {
            base.WriteHeader();

            WriteLine("#define ONE_COMPILATION_UNIT");
            WriteLine();
        }

        public override void WriteFile()
        {
            WriteHeader();
            WriteCompilationUnit();
        }

        private void WriteCompilationUnit()
        {
            foreach (RBuildSourceFile file in m_CompilationUnit.SourceFiles)
            {
                WriteLine("#include <{0}>", file.FullPath);
            }
        }
    }
}