コード例 #1
0
ファイル: FileTransfer.cpp プロジェクト: jineshkj/OOD
void FileTransfer::PutFile::WriteMessage(Message& msg) const
{
  msg.AddHeader("FileName", _fname); // this should do all the time

  std::ifstream file(_path, std::ios::in | std::ios::binary);

  if (!file.is_open())
    throw std::runtime_error("Could not open file " + _path);

  char buffer[4096];
  while (!file.eof())
  {
    file.read(buffer, sizeof(buffer));
    msg.WriteData(buffer, file.gcount());
  }
}
コード例 #2
0
ファイル: Command.cpp プロジェクト: jineshkj/OOD
 void WriteMessage(Message& msg) const
 {
   msg.AddHeader("Data", dat);
 }
コード例 #3
0
ファイル: TextSearch.cpp プロジェクト: jineshkj/OOD
void TextSearch::SearchString::WriteMessage(Message& msg) const
{
  msg.AddHeader("SearchString", _str); // this should do all the time
  msg.AddHeader("NumJobs", _jobs);
}