?さらに、問題としてのLinux - > C++コード:オブジェクト直列
:
正確にコードが何であるかをxmlファイルに書き込む際に、非侵入型バージョン(ブートシリアライゼーション)を使用した場合は? (oa<<
?)。私はいくつかのソリューションを試しましたが、私はエラーがあるようです。私は実際にoa<< g.
と言うことはできません。
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <dlfcn.h>
#include <iostream>
#include <fstream>
class gps_position
{
public:
int degrees;
int minutes;
float seconds;
gps_position(){};
};
namespace boost { namespace serialization {
template<class Archive>
void serialize(Archive & ar, gps_position & g, const unsigned int version)
{
ar & g.degrees;
ar & g.minutes;
ar & g.seconds;
}
} } // namespace boost::serialization
// gps_position g;
int main() {
gps_position obj;
std::ofstream ofs("filename2.xml");
if(ofs.good()) {
//const gps_position g;
try {
boost::archive::xml_oarchive oa(ofs);
// what to write in the xml?
oa << ??????????????????;
} catch(boost::archive::archive_exception& ex) {
}
}
return 0;
}
は@melyご質問に適切なタグを使用します。より良いあなたの質問にタグが付いていれば、あなたが見られるチャンスが増えます。 –
完全なC++ SOAPツールキットではなく、シリアライゼーションが必要なのですか? – sdg
@mely: "xml"を生成するだけでは不十分です。あなたが解決しようとしている問題について、さらに質問をする答えを使用しないでください:アドバイス、単に優しい作品 - それは、Webサービスが@mely(SOAPの最も可能性の高いいくつかの種類) – jalf