diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h
index fcf04e2c7..638f50a64 100644
--- a/coreapi/linphonecore.h
+++ b/coreapi/linphonecore.h
@@ -535,7 +535,7 @@ LINPHONE_PUBLIC const char *linphone_call_state_to_string(LinphoneCallState cs);
LINPHONE_PUBLIC LinphoneCore *linphone_call_get_core(const LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
-LINPHONE_PUBLIC const LinphoneAddress * linphone_core_get_current_call_remote_address(struct _LinphoneCore *lc);
+LINPHONE_PUBLIC const LinphoneAddress * linphone_core_get_current_call_remote_address(LinphoneCore *lc);
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
LINPHONE_PUBLIC char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
@@ -694,7 +694,7 @@ LINPHONE_PUBLIC bool_t linphone_proxy_config_register_enabled(const LinphoneProx
LINPHONE_PUBLIC void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj);
LINPHONE_PUBLIC const char *linphone_proxy_config_get_contact_parameters(const LinphoneProxyConfig *obj);
LINPHONE_PUBLIC void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *obj, const char *contact_params);
-struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj);
+LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj);
LINPHONE_PUBLIC bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg);
LINPHONE_PUBLIC const char * linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg);
@@ -744,7 +744,7 @@ LINPHONE_PUBLIC LinphonePrivacyMask linphone_proxy_config_get_privacy(const Linp
**/
typedef struct _LinphoneAccountCreator{
- struct _LinphoneCore *lc;
+ LinphoneCore *lc;
struct _SipSetupContext *ssctx;
char *username;
char *password;
@@ -755,7 +755,7 @@ typedef struct _LinphoneAccountCreator{
bool_t succeeded;
}LinphoneAccountCreator;
-LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core, const char *type);
+LinphoneAccountCreator *linphone_account_creator_new(LinphoneCore *core, const char *type);
void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username);
void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password);
void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain);
@@ -920,33 +920,38 @@ typedef enum _LinphoneGlobalState{
const char *linphone_global_state_to_string(LinphoneGlobalState gs);
+/**
+ * Global state notification callback.
+ * @param lc
+ * @param gstate the global state
+ * @param message informational message.
+ */
+typedef void (*LinphoneGlobalStateCb)(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
/**Call state notification callback prototype*/
-typedef void (*LinphoneGlobalStateCb)(struct _LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
-/**Call state notification callback prototype*/
-typedef void (*LinphoneCallStateCb)(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
+typedef void (*LinphoneCallStateCb)(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
/**Call encryption changed callback prototype*/
-typedef void (*CallEncryptionChangedCb)(struct _LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token);
+typedef void (*CallEncryptionChangedCb)(LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token);
/** @ingroup Proxies
* Registration state notification callback prototype
* */
-typedef void (*LinphoneRegistrationStateCb)(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message);
+typedef void (*LinphoneRegistrationStateCb)(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message);
/** Callback prototype */
-typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc);
+typedef void (*ShowInterfaceCb)(LinphoneCore *lc);
/** Callback prototype */
-typedef void (*DisplayStatusCb)(struct _LinphoneCore *lc, const char *message);
+typedef void (*DisplayStatusCb)(LinphoneCore *lc, const char *message);
/** Callback prototype */
-typedef void (*DisplayMessageCb)(struct _LinphoneCore *lc, const char *message);
+typedef void (*DisplayMessageCb)(LinphoneCore *lc, const char *message);
/** Callback prototype */
-typedef void (*DisplayUrlCb)(struct _LinphoneCore *lc, const char *message, const char *url);
+typedef void (*DisplayUrlCb)(LinphoneCore *lc, const char *message, const char *url);
/** Callback prototype */
-typedef void (*LinphoneCoreCbFunc)(struct _LinphoneCore *lc,void * user_data);
+typedef void (*LinphoneCoreCbFunc)(LinphoneCore *lc,void * user_data);
/**
* Report status change for a friend previously \link linphone_core_add_friend() added \endlink to #LinphoneCore.
* @param lc #LinphoneCore object .
* @param lf Updated #LinphoneFriend .
*/
-typedef void (*NotifyPresenceReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * lf);
+typedef void (*NotifyPresenceReceivedCb)(LinphoneCore *lc, LinphoneFriend * lf);
/**
* Reports that a new subscription request has been received and wait for a decision.
*
Status on this subscription request is notified by \link linphone_friend_set_inc_subscribe_policy() changing policy \endlink for this friend
@@ -955,11 +960,11 @@ typedef void (*NotifyPresenceReceivedCb)(struct _LinphoneCore *lc, LinphoneFrien
* @param url of the subscriber
* Callback prototype
* */
-typedef void (*NewSubscribtionRequestCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
+typedef void (*NewSubscribtionRequestCb)(LinphoneCore *lc, LinphoneFriend *lf, const char *url);
/** Callback prototype */
-typedef void (*AuthInfoRequestedCb)(struct _LinphoneCore *lc, const char *realm, const char *username);
+typedef void (*AuthInfoRequestedCb)(LinphoneCore *lc, const char *realm, const char *username);
/** Callback prototype */
-typedef void (*CallLogUpdatedCb)(struct _LinphoneCore *lc, struct _LinphoneCallLog *newcl);
+typedef void (*CallLogUpdatedCb)(LinphoneCore *lc, struct _LinphoneCallLog *newcl);
/**
* Callback prototype
* @deprecated use #MessageReceived instead.
@@ -980,24 +985,24 @@ typedef void (*TextMessageReceivedCb)(LinphoneCore *lc, LinphoneChatRoom *room,
typedef void (*MessageReceivedCb)(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
/** Callback prototype */
-typedef void (*DtmfReceivedCb)(struct _LinphoneCore* lc, LinphoneCall *call, int dtmf);
+typedef void (*DtmfReceivedCb)(LinphoneCore* lc, LinphoneCall *call, int dtmf);
/** Callback prototype */
-typedef void (*ReferReceivedCb)(struct _LinphoneCore *lc, const char *refer_to);
+typedef void (*ReferReceivedCb)(LinphoneCore *lc, const char *refer_to);
/** Callback prototype */
-typedef void (*BuddyInfoUpdatedCb)(struct _LinphoneCore *lc, LinphoneFriend *lf);
+typedef void (*BuddyInfoUpdatedCb)(LinphoneCore *lc, LinphoneFriend *lf);
/** Callback prototype for in progress transfers. The new_call_state is the state of the call resulting of the transfer, at the other party. */
-typedef void (*LinphoneTransferStateChangedCb)(struct _LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state);
+typedef void (*LinphoneTransferStateChangedCb)(LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state);
/** Callback prototype for receiving quality statistics for calls*/
-typedef void (*CallStatsUpdatedCb)(struct _LinphoneCore *lc, LinphoneCall *call, const LinphoneCallStats *stats);
+typedef void (*CallStatsUpdatedCb)(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallStats *stats);
/** Callback prototype for receiving info messages*/
-typedef void (*LinphoneInfoReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call, const LinphoneInfoMessage *msg);
+typedef void (*LinphoneInfoReceivedCb)(LinphoneCore *lc, LinphoneCall *call, const LinphoneInfoMessage *msg);
/**
* This structure holds all callbacks that the application should implement.
* None is mandatory.
**/
-typedef struct _LinphoneVTable{
- LinphoneGlobalStateCb global_state_changed; /**lc=lc;
linphone_proxy_config_done(obj);
}
+
LinphoneAddress *guess_contact_for_register(LinphoneProxyConfig *obj){
LinphoneAddress *ret=NULL;
LinphoneAddress *proxy=linphone_address_new(obj->reg_proxy);
@@ -312,38 +312,13 @@ LinphoneAddress *guess_contact_for_register(LinphoneProxyConfig *obj){
}
#endif //BUILD_UPNP
-#ifndef USE_BELLESIP
- if(localip == NULL) {
- char localip_tmp[LINPHONE_IPADDR_SIZE] = {'\0'};
- localip = localip_tmp;
- linphone_core_get_local_ip(obj->lc,host,localip_tmp);
- }
- if(localport == -1) {
- localport = linphone_core_get_sip_port(obj->lc);
- }
- {
- LCSipTransports tr;
- linphone_core_get_sip_transports(obj->lc,&tr);
- if (tr.udp_port <= 0) {
- if (tr.tcp_port>0) {
- sal_address_set_param(contact,"transport","tcp");
- } else if (tr.tls_port>0) {
- sal_address_set_param(contact,"transport","tls");
- }
- }
- }
-#endif
linphone_address_set_port(contact,localport);
linphone_address_set_domain(contact,localip);
linphone_address_set_display_name(contact,NULL);
-#ifndef USE_BELLESIP
- ret = linphone_address_as_string(contact);
- linphone_address_destroy(contact);
-#else
ret=contact;
-#endif /*USE_BELLESIP*/
+
linphone_address_destroy (proxy);
ms_free(tmp);
}
diff --git a/mediastreamer2 b/mediastreamer2
index 8097db23c..dbe587475 160000
--- a/mediastreamer2
+++ b/mediastreamer2
@@ -1 +1 @@
-Subproject commit 8097db23c50a476593cf912f0c554ca4e391c7e3
+Subproject commit dbe58747533b5e2b3e3c25009f483158e2b0cde9
diff --git a/tools/generator.cc b/tools/generator.cc
index dddefb09a..1d0511162 100644
--- a/tools/generator.cc
+++ b/tools/generator.cc
@@ -28,6 +28,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
+string to_lower(const string &str){
+ string res=str;
+ for(string::iterator it=res.begin();it!=res.end();++it){
+ *it=tolower(*it);
+ }
+ return res;
+}
+
CplusplusGenerator::CplusplusGenerator(){
}
@@ -42,17 +50,25 @@ void CplusplusGenerator::generate(Project *proj){
for_each(classes.begin(),classes.end(),bind1st(mem_fun(&CplusplusGenerator::writeClass),this));
}
+void CplusplusGenerator::writeEnumMember(ConstField *cf, bool isLast){
+ writeTabs(1);
+ mOutfile<getName();
+ if (!isLast) mOutfile<<",";
+ if (!cf->getHelp().empty()) mOutfile<<"\t/**< "<getHelp()<<" */";
+ mOutfile<getType()!=Type::Class) return;
filename<getName()<<"/"<getName()<<".hh";
mOutfile.open(filename.str().c_str());
if (!mOutfile.is_open()){
cerr<<"Could not write into "< &methods=klass->getMethods();
+ list methods=klass->getMethods();
+ list constFields=klass->getConstFields();
mCurClass=klass;
mOutfile<<"/* Wrapper generated by lp-gen-wrappers, do not edit*/"<getName().empty())
mOutfile<<"namespace "<getName()<<"{"<getName()<<"{"<getType()==Type::Enum){
+ mOutfile<<"enum "<getName()<<"{"<::iterator cfit,next;
+ for (cfit=constFields.begin();cfit!=constFields.end();){
+ ConstField *cf=*cfit;
+ writeEnumMember(cf,++cfit==constFields.end());
+ }
+ }else{
+ mOutfile<<"class "<getName()<<"{"<getName().empty())
mOutfile<<"} //end of namespace "<getName()< classes=proj->getClasses();
mCurProj=proj;
#ifndef WIN32
- unlink(proj->getName().c_str());
- mkdir(proj->getName().c_str(),S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IROTH);
+ remove(to_lower(proj->getName()).c_str());
+ mkdir(to_lower(proj->getName()).c_str(),S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IROTH);
#else
- _mkdir(proj->getName().c_str());
+ _mkdir(to_lower(proj->getName()).c_str());
#endif
- for_each(classes.begin(),classes.end(),bind1st(mem_fun(&JavascriptGenerator::writeClass),this));
-}
-
-void JavascriptGenerator::writeClass(Class *klass){
ostringstream filename;
- if (klass->getType()!=Type::Class) return;
- filename<getName()<<"/"<getName()<<".js";
+ /*write a file for the namespace*/
+ filename<getName())<<"/"<getName())<<".js";
+ mOutfile.open(filename.str().c_str());
+ if (!mOutfile.is_open()){
+ cerr<<"Could not write into "<getName()<getName()<<" = {};"<getType()!=Type::Enum) return;
+
+ ostringstream filename;
+ list members=klass->getConstFields();
+ list::iterator it;
+ string enum_name=klass->getName();
+ int value=0;
+
+ if (strncasecmp(enum_name.c_str(),mCurProj->getName().c_str(),mCurProj->getName().size())==0){
+ //since enum is part of the namespace, drop the namespace part of the enum if any.
+ enum_name.erase(0,mCurProj->getName().size());
+ }
+
+ filename<getName())<<"/"<getName()<<" = "<getName()<<" || {};"<getHelp(),0);
+ mOutfile<getName()<<"."<getHelp().empty()){
+ writeTabs(1);
+ mOutfile<<"/**"<getHelp(),1);
+ mOutfile<getName().substr(prefix_size,string::npos)<<" : "<getType()==Type::Enum) {
+ return;
+ }
+
+ filename<getName())<<"/"<getName())<<".js";
mOutfile.open(filename.str().c_str());
if (!mOutfile.is_open()){
cerr<<"Could not write into "< &methods=klass->getMethods();
mCurClass=klass;
mOutfile<<"/* Wrapper generated by lp-gen-wrappers, do not edit*/"< &methods=klass->getMethods();
+
//if (!mCurProj->getName().empty())
// mOutfile<<"namespace "<getName()<<"{"<100 && comment[i]==' ')){
mOutfile<getName()=="userData" || prop->getName()=="userPointer") return;
mOutfile<<"/**"<getHelp(),0);
mOutfile<getClass(name);
+ klass->setHelp(node.getChild("detaileddescription").getChild("para").getText());
+ list enumValues=node.getChildren("enumvalue");
+ list::iterator it;
+ for (it=enumValues.begin();it!=enumValues.end();++it){
+ ConstField *cf=new ConstField(Type::getType("int"),(*it).getChild("name").getText());
+ cf->setHelp((*it).getChild("detaileddescription").getChild("para").getText());
+ klass->addConstField(cf);
+
+ }
+
+}
+
static void parseTypedef(Project *proj, xmlNode *node){
XmlNode tdef(node);
string typecontent=tdef.getChild("type").getText();
@@ -278,6 +294,8 @@ static void parseMemberDef(Project *proj, xmlNode *node){
parseFunction(proj,node);
}else if (kind=="typedef"){
parseTypedef(proj,node);
+ }else if (kind=="enum"){
+ parseEnum(proj,node);
}
}
@@ -321,7 +339,7 @@ static int parse_file(Project *proj, const char *filename){
int main(int argc, char *argv[]){
int i;
- Project *proj=new Project();
+ string projectName="wrapper";
OutputGenerator *gen=NULL;
list files;
list::iterator it;
@@ -330,15 +348,18 @@ int main(int argc, char *argv[]){
for(i=1;i file1 file2...\nParses xml files generated by doxygen to output wrappers in a specified language.\n",argv[0]);
return -1;
- }if (strcmp(argv[i],"--output")==0){
+ }else if (strcmp(argv[i],"--output")==0){
i++;
if (strcmp(argv[i],"c++")==0){
gen=new CplusplusGenerator();
}else if (strcmp(argv[i],"javascript")==0){
gen=new JavascriptGenerator();
}
+ }else if (strcmp(argv[i],"--project")==0){
+ i++;
+ projectName=argv[i];
}else{
files.push_back(argv[i]);
}
@@ -348,7 +369,7 @@ int main(int argc, char *argv[]){
cerr<<"No output generator selected !"< fields){
+ if (fields.size()<2) return "";
+ list::iterator it;
+ string prefix=fields.front()->getName();
+ int prefixsize;
+
+ for (prefixsize=prefix.size();prefixsize>0;prefixsize--){
+ bool isMatching=true;
+ prefix=prefix.substr(0,prefixsize);
+
+ for(it=fields.begin();it!=fields.end();++it){
+ ConstField *cf=*it;
+ if (prefix != cf->getName().substr(0,prefixsize)){
+ isMatching=false;
+ break;
+ }
+ }
+ if (isMatching){
+ cout<<"enum prefix: "<
+struct name_matcher{
+ name_matcher(const string &name) : mName(name){}
+ bool operator()(_type *cf){
+ return cf->getName()==mName;
+ }
+ string mName;
+};
+
/*actually a class or an enum*/
class Class{
public:
@@ -282,10 +341,15 @@ public:
if (mMethods.find(method->getName())==mMethods.end())
mMethods.insert(make_pair(method->getName(),method));
}
+ void addConstField(ConstField *field){
+ list::iterator it=find_if(mConstFields.begin(),mConstFields.end(),name_matcher(field->getName()));
+ if (it==mConstFields.end())
+ mConstFields.push_back(field);
+ }
void setHelp(const std::string &help){
mHelp=help;
}
- const list getMethods()const{
+ list getMethods()const{
list ret;
map::const_iterator it;
for(it=mMethods.begin();it!=mMethods.end();++it){
@@ -293,13 +357,16 @@ public:
}
return ret;
}
+ const list &getConstFields()const{
+ return mConstFields;
+ }
const string &getName()const{
return mName;
}
const string &getHelp()const{
return mHelp;
}
- const list getProperties(){
+ list getProperties(){
list ret;
map::const_iterator it;
for(it=mProperties.begin();it!=mProperties.end();++it){
@@ -333,6 +400,7 @@ public:
private:
map mMethods;
map mProperties;
+ list mConstFields;
string mName;
string mHelp;
};