cdlcompilertoolkit/src/CdlTkSourceFileWriter.cpp
changeset 0 f58d6ec98e88
equal deleted inserted replaced
-1:000000000000 0:f58d6ec98e88
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #pragma warning (disable:4786)	// disable "identifier was truncated to '255' characters in the browser information" warning
       
    18 #include "CdlCompilerToolkit/CdlTkProcess.h"
       
    19 #include "CdlTkPriv.h"
       
    20 #include <fstream>
       
    21 #include <iomanip>
       
    22 #include <iostream>
       
    23 using namespace std;
       
    24 
       
    25 namespace CdlCompilerToolkit {
       
    26 
       
    27 
       
    28 CCdlTkSourceFileWriter::~CCdlTkSourceFileWriter()
       
    29 	{
       
    30 	}
       
    31 
       
    32 void CCdlTkSourceFileWriter::WriteNamespaceStart(const CCdlTkInterface& aCdl, ofstream& aStream) const
       
    33 	{
       
    34 	aStream << "namespace " << aCdl.NamespaceName()	<< endl;
       
    35 	aStream << "{" << endl;
       
    36 	}
       
    37 
       
    38 void CCdlTkSourceFileWriter::WriteNamespaceEnd(const CCdlTkInterface& aCdl, ofstream& aStream) const
       
    39 	{
       
    40 	aStream << "} // end of namespace " << aCdl.NamespaceName() << endl;
       
    41 	}
       
    42 
       
    43 std::string CCdlTkSourceFileWriter::HeaderGuardName(const std::string& aFileName) const
       
    44 	{
       
    45 	return CdlTkUtil::ToUpper(CdlTkUtil::ToCpp(CdlTkUtil::StripPath(aFileName)));
       
    46 	}
       
    47 
       
    48 void CCdlTkSourceFileWriter::WriteHeaderGuardStart(const string& aName, ofstream& aStream) const
       
    49 	{
       
    50 	string defName = HeaderGuardName(aName);
       
    51 	aStream << "#ifndef " << defName << endl;
       
    52 	aStream << "#define " << defName << endl;
       
    53 	aStream << endl;
       
    54 	}
       
    55 
       
    56 void CCdlTkSourceFileWriter::WriteHeaderGuardEnd(const string& aName, ofstream& aStream) const
       
    57 	{
       
    58 	string defName = HeaderGuardName(aName);
       
    59 	aStream << endl;
       
    60 	aStream << "#endif // " << defName << endl;
       
    61 	}
       
    62 
       
    63 }	// end of namespace CdlCompilerToolkit