本文整理汇总了C++中CObjectOStream::GetDataFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ CObjectOStream::GetDataFormat方法的具体用法?C++ CObjectOStream::GetDataFormat怎么用?C++ CObjectOStream::GetDataFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObjectOStream
的用法示例。
在下文中一共展示了CObjectOStream::GetDataFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Write
void CSoapMessage::Write(CObjectOStream& out) const
{
CObjectOStreamXml* os = 0;
bool schema = false, loc = false;
string ns_default;
ESerialDataFormat fmt = out.GetDataFormat();
if (fmt == eSerial_Xml) {
os = dynamic_cast<CObjectOStreamXml*>(&out);
if (os) {
schema = os->GetReferenceSchema();
os->SetReferenceSchema();
loc = os->GetUseSchemaLocation();
os->SetUseSchemaLocation(false);
ns_default = os->GetDefaultSchemaNamespace();
os->SetDefaultSchemaNamespace(GetSoapNamespace());
}
}
CSoapEnvelope env;
if (!m_Header.empty()) {
// This is to make the stream think the Header was not empty.
// Since Header is optional, we do not have to make it *always*
CRef<CAnyContentObject> h(new CAnyContentObject);
env.SetHeader().SetAnyContent().push_back(h);
}
// This is to make the stream think the Body was not empty.
// Body is mandatory
CRef<CAnyContentObject> h(new CAnyContentObject);
env.SetBody().SetAnyContent().push_back(h);
CSoapFault* flt = 0;
if (!m_FaultDetail.empty()) {
// This is to make the stream think the Detail was not empty.
// Since Detail is optional, we do not have to make it *always*
flt = dynamic_cast<CSoapFault*>(const_cast<CSerialObject*>(
GetSerialObject("Fault", eMsgBody).GetPointer()));
if (!flt) {
// throw exception here (?)
} else {
CRef<CAnyContentObject> h2(new CAnyContentObject);
flt->SetDetail().SetAnyContent().push_back(h2);
}
}
CObjectTypeInfo typeH = CType<CSoapHeader>();
typeH.SetLocalWriteHook(out, new CSoapWriteHook(m_Header));
CObjectTypeInfo typeB = CType<CSoapBody>();
typeB.SetLocalWriteHook(out, new CSoapWriteHook(m_Body));
CObjectTypeInfo typeF = CType<CSoapFault::C_Detail>();
typeF.SetLocalWriteHook(out, new CSoapWriteHook(m_FaultDetail));
x_VerifyFaultObj(true);
out << env;
x_VerifyFaultObj(false);
if (flt) {
flt->SetDetail().SetAnyContent().clear();
}
if (os) {
os->SetReferenceSchema(schema);
os->SetUseSchemaLocation(loc);
os->SetDefaultSchemaNamespace(ns_default);
}
}