本文整理汇总了C++中KVString::Prepend方法的典型用法代码示例。如果您正苦于以下问题:C++ KVString::Prepend方法的具体用法?C++ KVString::Prepend怎么用?C++ KVString::Prepend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KVString
的用法示例。
在下文中一共展示了KVString::Prepend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteClassWithTemplateImp
//___________________________________________________
void KVClassFactory::WriteClassWithTemplateImp()
{
// Writes the implementation file for the class
ofstream file_cpp;
file_cpp.open( GetImpFileName() );
WriteWhoWhen(file_cpp);
file_cpp << "#include \"" << fClassName.Data() << ".h\"" << endl;
if( fImpInc.GetSize() ){
TIter next(&fImpInc); TObjString* str;
while( (str = (TObjString*)next()) ){
file_cpp << "#include \"" << str->String().Data() << "\"" << endl;
}
}
file_cpp << endl << "ClassImp(" << fClassName.Data() << ")\n" << endl;
file_cpp <<
"////////////////////////////////////////////////////////////////////////////////"
<< endl;
file_cpp << "// BEGIN_HTML <!--" << endl;
file_cpp << "/* -->" << endl;
file_cpp << "<h2>" << fClassName.Data() << "</h2>" << endl;
file_cpp << "<h4>" << fClassDesc.Data() << "</h4>" << endl;
file_cpp << "<!-- */" << endl;
file_cpp << "// --> END_HTML" << endl;
file_cpp <<
"////////////////////////////////////////////////////////////////////////////////\n"
<< endl;
TString cppFile;
ifstream file_cpp_template;
//open file whose full path was stored in fTemplateCPP
if (!KVBase::
SearchAndOpenKVFile(fTemplateCPP.Data(), file_cpp_template)) {
//this should never happen!
cout << "<KVClassFactory::WriteClassWithTemplateImp>: cannot open "
<< fTemplateCPP.Data() << endl;
return;
}
cppFile.ReadFile(file_cpp_template);
file_cpp_template.close();
file_cpp << cppFile.ReplaceAll(fTemplateClassName.Data(),
fClassName.Data());
//write implementations of added methods
if( fMethods.GetSize() ){
KVString line;
TIter next( &fMethods ); KVClassMethod* meth;
while( (meth = (KVClassMethod*)next()) ){
meth->WriteImplementation(line);
line.Prepend("\n//________________________________________________________________\n");
file_cpp << line.Data();
}
}
file_cpp.close();
cout << "<KVClassFactory::WriteClassWithTemplateImp> : File " << GetImpFileName() << " generated." << endl;
}
示例2: WriteClassImp
//___________________________________________________
void KVClassFactory::WriteClassImp()
{
//Write the class implementation file
//This includes a class description in pure HTML
ofstream file_cpp;
file_cpp.open( GetImpFileName() );
WriteWhoWhen(file_cpp);
file_cpp << "#include \"" << fClassName.Data() << ".h\"" << endl;
if( fImpInc.GetSize() ){
TIter next(&fImpInc); TObjString* str;
while( (str = (TObjString*)next()) ){
file_cpp << "#include \"" << str->String().Data() << "\"" << endl;
}
}
file_cpp << endl << "ClassImp(" << fClassName.Data() << ")\n" << endl;
file_cpp <<
"////////////////////////////////////////////////////////////////////////////////"
<< endl;
file_cpp << "// BEGIN_HTML <!--" << endl;
file_cpp << "/* -->" << endl;
file_cpp << "<h2>" << fClassName.Data() << "</h2>" << endl;
file_cpp << "<h4>" << fClassDesc.Data() << "</h4>" << endl;
file_cpp << "<!-- */" << endl;
file_cpp << "// --> END_HTML" << endl;
file_cpp <<
"////////////////////////////////////////////////////////////////////////////////\n"
<< endl;
file_cpp << fClassName.Data() << "::" << fClassName.
Data() << "()" << endl;
file_cpp << "{\n // Default constructor\n}\n" << endl;
// any other ctors ?
KVList* ctor = (KVList*)fMethods.GetSubListWithMethod("1", "IsConstructor");
if( ctor->GetEntries() ){
KVString line;
TIter next( ctor ); KVClassMethod* meth;
while( (meth = (KVClassMethod*)next()) ){
meth->WriteImplementation(line);
line.Prepend("//________________________________________________________________\n\n");
file_cpp << line.Data() << endl;
}
}
delete ctor;
file_cpp << fClassName.Data() << "::~" << fClassName.
Data() << "()" << endl;
file_cpp << "{\n // Destructor\n}\n" << endl;
//write implementations of added methods
if( fMethods.GetSize() ){
KVString line;
TIter next( &fMethods ); KVClassMethod* meth;
while( (meth = (KVClassMethod*)next()) ){
if( !meth->IsConstructor() ){
meth->WriteImplementation(line);
line.Prepend("//________________________________________________________________\n\n");
file_cpp << line.Data() << endl;
}
}
}
file_cpp.close();
cout << "<KVClassFactory::WriteClassImp> : File " << GetImpFileName() << " generated." << endl;
}