diff --git a/tools/generator.cc b/tools/generator.cc index c8763f1ef..def040495 100644 --- a/tools/generator.cc +++ b/tools/generator.cc @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef WIN32 #include +#include #define strncasecmp _strnicmp #endif @@ -62,7 +63,7 @@ void CplusplusGenerator::writeEnumMember(ConstField *cf, bool isLast){ void CplusplusGenerator::writeClass(Class *klass){ ostringstream filename; - + filename<getName()<<"/"<getName()<<".hh"; mOutfile.open(filename.str().c_str()); if (!mOutfile.is_open()){ @@ -90,7 +91,7 @@ void CplusplusGenerator::writeClass(Class *klass){ mOutfile<<"public:"<getName().empty()) mOutfile<<"} //end of namespace "<getName()<getType(); - + if (type->getBasicType()==Type::Class){ if (arg->isConst()){ mOutfile<<"const "; @@ -115,7 +116,7 @@ void CplusplusGenerator::writeArgument(Argument *arg, bool isReturn){ }else if (type->getBasicType()==Type::String){ if (!isReturn) mOutfile<<"const std::string &"; - else + else mOutfile<<"std::string"; }else if (type->getBasicType()==Type::Void){ mOutfile<<"void"; @@ -138,7 +139,7 @@ void CplusplusGenerator::writeHelpComment(const std::string &comment, int ntabs) writeTabs(ntabs); mOutfile<<" * "; for(i=0;i100 && comment[i]==' ')){ mOutfile<isCallback()) return; - + Argument *retarg=method->getReturnArg(); const list &args=method->getArgs(); list::const_iterator it; - + writeTabs(1); mOutfile<<"/**"<getHelp(),1); mOutfile<getName()<<"("; - + for(it=args.begin();it!=args.end();++it){ if (it!=args.begin()) mOutfile<<", "; writeArgument(*it); @@ -190,7 +191,7 @@ void JavascriptGenerator::generate(Project *proj){ _mkdir(to_lower(proj->getName()).c_str()); #endif ostringstream filename; - + /*write a file for the namespace*/ filename<getName())<<"/"<getName())<<".js"; mOutfile.open(filename.str().c_str()); @@ -219,12 +220,12 @@ string JavascriptGenerator::getEnumName(Class *klass){ void JavascriptGenerator::writeEnum(Class *klass){ if (klass->getType()!=Type::Enum) return; - + ostringstream filename; list members=klass->getConstFields(); list::iterator it; string enum_name=getEnumName(klass); - + filename<getName())<<"/"<getName()<<" = "<getName()<<" || {};"<getHelp(),0); @@ -243,7 +244,7 @@ void JavascriptGenerator::writeEnum(Class *klass){ mOutfile<getName()<<"."<getHelp().empty()){ @@ -283,13 +284,13 @@ void JavascriptGenerator::writeEnum(Class *klass){ void JavascriptGenerator::writeClass(Class *klass){ ostringstream filename; - + if (klass->getType()==Type::Enum) { return; } const list &methods=klass->getMethods(); if (methods.empty()) return;//skip empty classes - + filename<getName())<<"/"<getName())<<".js"; mOutfile.open(filename.str().c_str()); if (!mOutfile.is_open()){ @@ -299,14 +300,14 @@ void JavascriptGenerator::writeClass(Class *klass){ mCurClass=klass; mOutfile<<"/* Wrapper generated by lp-gen-wrappers, do not edit*/"<getName().empty()) // mOutfile<<"namespace "<getName()<<"{"<getHelp()<getName()< properties=klass->getProperties(); for_each(properties.begin(),properties.end(),bind1st(mem_fun(&JavascriptGenerator::writeProperty),this)); mOutfile<getReturnArg(); const list &args=method->getArgs(); list::const_iterator it; - + if (method->isCallback()) return; if (method->getPropertyBehaviour()!=Method::None) return; if (method->getName()=="ref" || method->getName()=="unref") return; - + mOutfile<<"/**"<getHelp(),0); mOutfile<getName()<<"#"<getName()< &args=event->getArgs(); list::const_iterator it; - + if (!event->isCallback()) return; mOutfile<<"/**"<getHelp()),0); mOutfile<getName()<<"#"<getName()<