本文整理汇总了C++中YamlNode::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ YamlNode::getType方法的具体用法?C++ YamlNode::getType怎么用?C++ YamlNode::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YamlNode
的用法示例。
在下文中一共展示了YamlNode::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteChildNodes
void SequenceNode::deleteChildNodes()
{
Sequence::iterator it;
for (it = seq.begin(); it != seq.end(); ++it) {
YamlNode *yamlNode = static_cast<YamlNode *> (*it);
switch (yamlNode->getType()) {
case DOCUMENT:
break;
case SEQUENCE: {
SequenceNode *sequence = static_cast<SequenceNode *> (yamlNode);
sequence->deleteChildNodes();
delete sequence;
}
break;
case MAPPING: {
MappingNode *mapping = static_cast<MappingNode *> (yamlNode);
mapping->deleteChildNodes();
delete mapping;
}
break;
case SCALAR: {
ScalarNode *scalar = static_cast<ScalarNode *> (yamlNode);
delete scalar;
}
break;
default:
break;
}
}
}
示例2: unserialize
void SIPAccount::unserialize(const Conf::MappingNode &map)
{
using namespace Conf;
map.getValue(ALIAS_KEY, &alias_);
map.getValue(TYPE_KEY, &type_);
map.getValue(USERNAME_KEY, &username_);
map.getValue(HOSTNAME_KEY, &hostname_);
map.getValue(ACCOUNT_ENABLE_KEY, &enabled_);
map.getValue(MAILBOX_KEY, &mailBox_);
map.getValue(CODECS_KEY, &codecStr_);
// Update codec list which one is used for SDP offer
setActiveCodecs(ManagerImpl::split_string(codecStr_));
map.getValue(RINGTONE_PATH_KEY, &ringtonePath_);
map.getValue(RINGTONE_ENABLED_KEY, &ringtoneEnabled_);
map.getValue(Preferences::REGISTRATION_EXPIRE_KEY, ®istrationExpire_);
map.getValue(INTERFACE_KEY, &interface_);
int port = DEFAULT_SIP_PORT;
map.getValue(PORT_KEY, &port);
localPort_ = port;
map.getValue(PUBLISH_ADDR_KEY, &publishedIpAddress_);
map.getValue(PUBLISH_PORT_KEY, &port);
publishedPort_ = port;
map.getValue(SAME_AS_LOCAL_KEY, &publishedSameasLocal_);
map.getValue(KEEP_ALIVE_ENABLED, &keepAliveEnabled_);
std::string dtmfType;
map.getValue(DTMF_TYPE_KEY, &dtmfType);
dtmfType_ = dtmfType;
map.getValue(SERVICE_ROUTE_KEY, &serviceRoute_);
map.getValue(UPDATE_CONTACT_HEADER_KEY, &contactUpdateEnabled_);
// stun enabled
map.getValue(STUN_ENABLED_KEY, &stunEnabled_);
map.getValue(STUN_SERVER_KEY, &stunServer_);
// Init stun server name with default server name
stunServerName_ = pj_str((char*) stunServer_.data());
map.getValue(DISPLAY_NAME_KEY, &displayName_);
std::vector<std::map<std::string, std::string> > creds;
YamlNode *credNode = map.getValue(CRED_KEY);
/* We check if the credential key is a sequence
* because it was a mapping in a previous version of
* the configuration file.
*/
if (credNode && credNode->getType() == SEQUENCE) {
SequenceNode *credSeq = static_cast<SequenceNode *>(credNode);
Sequence::iterator it;
Sequence *seq = credSeq->getSequence();
for (it = seq->begin(); it != seq->end(); ++it) {
MappingNode *cred = static_cast<MappingNode *>(*it);
std::string user;
std::string pass;
std::string realm;
cred->getValue(CONFIG_ACCOUNT_USERNAME, &user);
cred->getValue(CONFIG_ACCOUNT_PASSWORD, &pass);
cred->getValue(CONFIG_ACCOUNT_REALM, &realm);
std::map<std::string, std::string> credentialMap;
credentialMap[CONFIG_ACCOUNT_USERNAME] = user;
credentialMap[CONFIG_ACCOUNT_PASSWORD] = pass;
credentialMap[CONFIG_ACCOUNT_REALM] = realm;
creds.push_back(credentialMap);
}
}
if (creds.empty()) {
// migration from old file format
std::map<std::string, std::string> credmap;
std::string password;
map.getValue(PASSWORD_KEY, &password);
credmap[CONFIG_ACCOUNT_USERNAME] = username_;
credmap[CONFIG_ACCOUNT_PASSWORD] = password;
credmap[CONFIG_ACCOUNT_REALM] = "*";
creds.push_back(credmap);
}
setCredentials(creds);
// get srtp submap
MappingNode *srtpMap = static_cast<MappingNode *>(map.getValue(SRTP_KEY));
if (srtpMap) {
srtpMap->getValue(SRTP_ENABLE_KEY, &srtpEnabled_);
srtpMap->getValue(KEY_EXCHANGE_KEY, &srtpKeyExchange_);
srtpMap->getValue(RTP_FALLBACK_KEY, &srtpFallback_);
}
// get zrtp submap
MappingNode *zrtpMap = static_cast<MappingNode *>(map.getValue(ZRTP_KEY));
if (zrtpMap) {
zrtpMap->getValue(DISPLAY_SAS_KEY, &zrtpDisplaySas_);
//.........这里部分代码省略.........