Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
savoirfairelinux
jami-daemon
Commits
92c996dc
Commit
92c996dc
authored
Jul 07, 2010
by
Alexandre Savard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#3649] Pass emitter as an argument for serialization
parent
455ae5be
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
40 additions
and
12 deletions
+40
-12
sflphone-common/src/account.h
sflphone-common/src/account.h
+1
-1
sflphone-common/src/config/serializable.h
sflphone-common/src/config/serializable.h
+2
-1
sflphone-common/src/config/yamlemitter.cpp
sflphone-common/src/config/yamlemitter.cpp
+25
-1
sflphone-common/src/config/yamlemitter.h
sflphone-common/src/config/yamlemitter.h
+1
-1
sflphone-common/src/iax/iaxaccount.cpp
sflphone-common/src/iax/iaxaccount.cpp
+1
-1
sflphone-common/src/iax/iaxaccount.h
sflphone-common/src/iax/iaxaccount.h
+1
-1
sflphone-common/src/preferences.cpp
sflphone-common/src/preferences.cpp
+4
-1
sflphone-common/src/preferences.h
sflphone-common/src/preferences.h
+1
-1
sflphone-common/src/sip/sipaccount.cpp
sflphone-common/src/sip/sipaccount.cpp
+2
-2
sflphone-common/src/sip/sipaccount.h
sflphone-common/src/sip/sipaccount.h
+2
-2
No files found.
sflphone-common/src/account.h
View file @
92c996dc
...
@@ -155,7 +155,7 @@ class Account : public Serializable{
...
@@ -155,7 +155,7 @@ class Account : public Serializable{
*/
*/
virtual
~
Account
();
virtual
~
Account
();
virtual
void
serialize
(
Engine
*
engine
)
=
0
;
virtual
void
serialize
(
Conf
::
YamlEmitter
*
emitter
)
=
0
;
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
)
=
0
;
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
)
=
0
;
...
...
sflphone-common/src/config/serializable.h
View file @
92c996dc
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include "yamlparser.h"
#include "yamlparser.h"
#include "yamlemitter.h"
#include "yamlnode.h"
#include "yamlnode.h"
class
Engine
;
class
Engine
;
...
@@ -42,7 +43,7 @@ class Serializable {
...
@@ -42,7 +43,7 @@ class Serializable {
public:
public:
virtual
void
serialize
(
Engine
*
engine
)
=
0
;
virtual
void
serialize
(
Conf
::
YamlEmitter
*
emitter
)
=
0
;
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
)
=
0
;
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
)
=
0
;
...
...
sflphone-common/src/config/yamlemitter.cpp
View file @
92c996dc
...
@@ -120,8 +120,30 @@ void YamlEmitter::writeAccount(MappingNode *map)
...
@@ -120,8 +120,30 @@ void YamlEmitter::writeAccount(MappingNode *map)
}
}
void
YamlEmitter
::
writePreference
(
MappingNode
*
map
)
{
std
::
string
preferencestr
(
"preferences"
);
if
(
map
->
getType
()
==
MAPPING
)
throw
YamlEmitterException
(
"Node type is not a mapping while writing preferences"
);
int
preferenceid
=
yaml_document_add_scalar
(
&
document
,
NULL
,
(
yaml_char_t
*
)
preferencestr
.
c_str
(),
-
1
,
YAML_PLAIN_SCALAR_STYLE
);
int
preferencemapping
=
yaml_document_add_mapping
(
&
document
,
NULL
,
YAML_BLOCK_MAPPING_STYLE
);
yaml_document_append_mapping_pair
(
&
document
,
topLevelMapping
,
preferenceid
,
preferencemapping
);
Mapping
*
internalmap
=
map
->
getMapping
();
Mapping
::
iterator
iter
=
internalmap
->
begin
();
while
(
iter
!=
internalmap
->
end
())
{
addMappingItem
(
preferencemapping
,
iter
->
first
,
iter
->
second
);
iter
++
;
}
}
void
YamlEmitter
::
addMappingItem
(
int
mappingid
,
Key
key
,
YamlNode
*
node
)
void
YamlEmitter
::
addMappingItem
(
int
mappingid
,
Key
key
,
YamlNode
*
node
)
{
{
if
(
node
->
getType
()
==
SCALAR
)
{
if
(
node
->
getType
()
==
SCALAR
)
{
...
@@ -148,6 +170,8 @@ void YamlEmitter::writeAccount(MappingNode *map)
...
@@ -148,6 +170,8 @@ void YamlEmitter::writeAccount(MappingNode *map)
iter
++
;
iter
++
;
}
}
}
}
else
throw
YamlEmitterException
(
"Unknown node type while adding mapping node"
);
}
}
...
...
sflphone-common/src/config/yamlemitter.h
View file @
92c996dc
...
@@ -77,7 +77,7 @@ class YamlEmitter {
...
@@ -77,7 +77,7 @@ class YamlEmitter {
void
writeAccount
(
MappingNode
*
map
);
void
writeAccount
(
MappingNode
*
map
);
void
writePreference
();
void
writePreference
(
MappingNode
*
map
);
void
writeAddressbook
();
void
writeAddressbook
();
...
...
sflphone-common/src/iax/iaxaccount.cpp
View file @
92c996dc
...
@@ -47,7 +47,7 @@ IAXAccount::~IAXAccount()
...
@@ -47,7 +47,7 @@ IAXAccount::~IAXAccount()
_link
=
NULL
;
_link
=
NULL
;
}
}
void
IAXAccount
::
serialize
(
Engine
*
engine
)
void
IAXAccount
::
serialize
(
Conf
::
YamlEmitter
*
emitter
)
{
{
}
}
...
...
sflphone-common/src/iax/iaxaccount.h
View file @
92c996dc
...
@@ -44,7 +44,7 @@ class IAXAccount : public Account
...
@@ -44,7 +44,7 @@ class IAXAccount : public Account
~
IAXAccount
();
~
IAXAccount
();
virtual
void
serialize
(
Engine
*
engine
);
virtual
void
serialize
(
Conf
::
YamlEmitter
*
emitter
);
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
);
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
);
...
...
sflphone-common/src/preferences.cpp
View file @
92c996dc
...
@@ -50,7 +50,7 @@ Preferences::Preferences() : _accountOrder("")
...
@@ -50,7 +50,7 @@ Preferences::Preferences() : _accountOrder("")
Preferences
::~
Preferences
()
{}
Preferences
::~
Preferences
()
{}
void
Preferences
::
serialize
(
Engine
*
engine
)
void
Preferences
::
serialize
(
Conf
::
YamlEmitter
*
emiter
)
{
{
Conf
::
MappingNode
preferencemap
(
NULL
);
Conf
::
MappingNode
preferencemap
(
NULL
);
...
@@ -86,6 +86,7 @@ void Preferences::serialize(Engine *engine)
...
@@ -86,6 +86,7 @@ void Preferences::serialize(Engine *engine)
preferencemap
.
setKeyValue
(
zeroConfenableKey
,
&
zeroConfenable
);
preferencemap
.
setKeyValue
(
zeroConfenableKey
,
&
zeroConfenable
);
preferencemap
.
setKeyValue
(
md5HashKey
,
&
md5Hash
);
preferencemap
.
setKeyValue
(
md5HashKey
,
&
md5Hash
);
}
}
void
Preferences
::
unserialize
(
Conf
::
MappingNode
*
map
)
void
Preferences
::
unserialize
(
Conf
::
MappingNode
*
map
)
...
@@ -118,4 +119,6 @@ void Preferences::unserialize(Conf::MappingNode *map)
...
@@ -118,4 +119,6 @@ void Preferences::unserialize(Conf::MappingNode *map)
val
=
(
Conf
::
ScalarNode
*
)(
map
->
getValue
(
md5HashKey
));
val
=
(
Conf
::
ScalarNode
*
)(
map
->
getValue
(
md5HashKey
));
if
(
val
)
{
_md5Hash
=
(
val
->
getValue
().
compare
(
"true"
)
==
0
)
?
true
:
false
;
val
=
NULL
;
}
if
(
val
)
{
_md5Hash
=
(
val
->
getValue
().
compare
(
"true"
)
==
0
)
?
true
:
false
;
val
=
NULL
;
}
}
}
sflphone-common/src/preferences.h
View file @
92c996dc
...
@@ -54,7 +54,7 @@ class Preferences : public Serializable {
...
@@ -54,7 +54,7 @@ class Preferences : public Serializable {
~
Preferences
();
~
Preferences
();
virtual
void
serialize
(
Engine
*
engine
);
virtual
void
serialize
(
Conf
::
YamlEmitter
*
emitter
);
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
);
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
);
...
...
sflphone-common/src/sip/sipaccount.cpp
View file @
92c996dc
...
@@ -40,7 +40,7 @@ Credentials::Credentials() : credentialCount(0) {}
...
@@ -40,7 +40,7 @@ Credentials::Credentials() : credentialCount(0) {}
Credentials
::~
Credentials
()
{}
Credentials
::~
Credentials
()
{}
void
Credentials
::
serialize
(
Engine
*
engine
)
void
Credentials
::
serialize
(
Conf
::
YamlEmitter
*
emitter
)
{
{
}
}
...
@@ -132,7 +132,7 @@ SIPAccount::~SIPAccount()
...
@@ -132,7 +132,7 @@ SIPAccount::~SIPAccount()
free
(
_tlsSetting
);
free
(
_tlsSetting
);
}
}
void
SIPAccount
::
serialize
(
Engine
*
engine
)
{
void
SIPAccount
::
serialize
(
Conf
::
YamlEmitter
*
emitter
)
{
Conf
::
MappingNode
accountmap
(
NULL
);
Conf
::
MappingNode
accountmap
(
NULL
);
...
...
sflphone-common/src/sip/sipaccount.h
View file @
92c996dc
...
@@ -134,7 +134,7 @@ class Credentials : public Serializable
...
@@ -134,7 +134,7 @@ class Credentials : public Serializable
~
Credentials
();
~
Credentials
();
virtual
void
serialize
(
Engine
*
engine
);
virtual
void
serialize
(
Conf
::
YamlEmitter
*
emitter
);
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
);
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
);
...
@@ -170,7 +170,7 @@ class SIPAccount : public Account
...
@@ -170,7 +170,7 @@ class SIPAccount : public Account
*/
*/
virtual
~
SIPAccount
();
virtual
~
SIPAccount
();
virtual
void
serialize
(
Engine
*
engine
);
virtual
void
serialize
(
Conf
::
YamlEmitter
*
emitter
);
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
);
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment